From 6cd1cd5f1dfdda4c43a272bee7b36cbb83f65a2c Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Sun, 1 Mar 2026 18:26:30 +1300 Subject: Initial commit --- internal/build/build.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 internal/build/build.go (limited to 'internal/build/build.go') 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 -- cgit v1.2.3