diff options
| author | Arslaan Pathan <[email protected]> | 2026-03-01 18:26:30 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-03-01 18:26:30 +1300 |
| commit | 6cd1cd5f1dfdda4c43a272bee7b36cbb83f65a2c (patch) | |
| tree | e64bb850e322d827d7d8e8f36e05653f5e491acc /internal/build/build.go | |
| download | kiiro-6cd1cd5f1dfdda4c43a272bee7b36cbb83f65a2c.tar.xz kiiro-6cd1cd5f1dfdda4c43a272bee7b36cbb83f65a2c.zip | |
Initial commit
Diffstat (limited to 'internal/build/build.go')
| -rw-r--r-- | internal/build/build.go | 42 |
1 files changed, 42 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 |
