diff options
Diffstat (limited to 'internal/build')
| -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 |
