diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/build/build.go | 42 | ||||
| -rw-r--r-- | internal/git/git.go | 7 | ||||
| -rw-r--r-- | internal/manifest/manifest.go | 11 | ||||
| -rw-r--r-- | internal/registry/registry.go | 1 | ||||
| -rw-r--r-- | internal/repo/repo.go | 7 |
5 files changed, 68 insertions, 0 deletions
diff --git a/internal/build/build.go b/internal/build/build.go new file mode 100644 index 0000000..3758729 --- /dev/null +++ b/internal/build/build.go @@ -0,0 +1,42 @@ +package build + +import ( + "github.com/yuin/gopher-lua" +) + +type Kiirofile struct { + Path string +} + +func (k *Kiirofile) Load(L *lua.LState) error { + if err := L.DoFile(k.Path); err != nil { + // just return it, they can do the err detection + return err + } + return nil +} + +func (k *Kiirofile) RunBuild(L *lua.LState) error { + // just return it because if its an error notmyfault they detect it + // notmyfault you forgot to Kiirofile.Load() + // or that the Kiirofile maintainer typed it wrong + return L.CallByParam(lua.P{ + Fn: L.GetGlobal("build"), + NRet: 0, + Protect: true, + }) +} + +func (k *Kiirofile) RunPackage(L *lua.LState) error { + // just return it because if its an error notmyfault they detect it + // notmyfault you forgot to Kiirofile.Load() + // or that the Kiirofile maintainer typed it wrong + return L.CallByParam(lua.P{ + Fn: L.GetGlobal("package"), + NRet: 0, + Protect: true, + }) +} + +// TODO: Add auto-detection and methods for MakeBuild, CargoBuild, CMakeBuild, etc for the projects that don't have a Kiirofile +// That's probably for later because right now we need basic package manager with Kiirofile parsing working diff --git a/internal/git/git.go b/internal/git/git.go new file mode 100644 index 0000000..ed88e71 --- /dev/null +++ b/internal/git/git.go @@ -0,0 +1,7 @@ +package git + +import "os/exec" + +func Clone(url string, dest string) error { + return exec.Command("git", "clone", url, dest).Run() +} diff --git a/internal/manifest/manifest.go b/internal/manifest/manifest.go new file mode 100644 index 0000000..5914b0e --- /dev/null +++ b/internal/manifest/manifest.go @@ -0,0 +1,11 @@ +package manifest + +type KiiroToml struct { + Name string `toml:"pkgname"` + Version string `toml:"version"` + Architectures string `toml:"archs"` + Authors []string `toml:"authors"` + Maintainers []string `toml:"maintainers"` + Depends []string `toml:"deps"` +} + diff --git a/internal/registry/registry.go b/internal/registry/registry.go new file mode 100644 index 0000000..b2a276f --- /dev/null +++ b/internal/registry/registry.go @@ -0,0 +1 @@ +package registry diff --git a/internal/repo/repo.go b/internal/repo/repo.go new file mode 100644 index 0000000..6c3ccef --- /dev/null +++ b/internal/repo/repo.go @@ -0,0 +1,7 @@ +package repo + +type PackageListing struct { + Repository string `json:"repo"` + KiirofileOverride *string `json:"kiirofile_override"` + KiirotomlOverride *string `json:"kiirotoml_override"` +} |
