Build/Public/api.lua
Jamie Reece Wilson 85a130e167 [+] auProcessSolutionByJsonDocument
[+] auProcessSolutionByPath
[+] Core/JSON/jsonSolution
2023-12-12 01:39:58 +00:00

192 lines
4.2 KiB
Lua

-- private
local buildAction = auRequire("Core/Actions")
local target = auRequire("Core/Target")
local main = auRequire("Core/main")
local resourceCompiler = auRequire("Core/ResourceCompiler")
local protobuf = auRequire("Core/Protobuf")
local vala = auRequire("Core/Vala")
local crJSON = auRequire("Core/JSON")
-- executes inline under iprocessor::process
function auAddBuildAction(...)
buildAction(...)
end
function auAddBuildActionO(...)
local type = {
-- stage: pre, post
-- filter: ...
-- lua/bin/targetName/command: relative path - lua script; relative path - executable; project name; command line
-- args: lua private passthrough; binary or target name command args
-- cwd: sln(default),prj
}
end
function auStart()
if (_auStart) then return end
_auStart = true
auRequire("Core/base")
end
function auStartSolution(sln)
auRequire("Core").solution.start(sln)
end
function auStartProject(project)
auStart()
auRequire("Core").project.startProject(project)
end
function auProcessSolution()
main.processSolution()
end
function auProcessSolutionByJsonDocument(doc)
crJSON.jsonSolution(doc)
end
function auProcessSolutionByPath(path)
if (not os.isfile(path)) then
auFatal("Missing solution file", path)
return
end
local result, err = json.decode(io.readfile(path))
if (not result) then
auFatal("Solution parse error", err)
return
end
auProcessSolutionByJsonDocument(result)
end
function auFilterForPlatforms(callback, ...)
target.auFilterForPlatforms(callback, ...)
end
function auFilterForConfigs(callback, ...)
target.auFilterForConfigs(callback, ...)
end
function auFilterForConfigPlatforms(callback, ...)
target.auFilterForConfigPlatforms(callback, ...)
end
function auAddVisit(...)
main.addVisit(...)
end
-- Returns an array of filter tables where each optional table is checked against the current combination of config/platform/arch
-- Varargs are logical anded with the final filter table
-- in object -> defer to objects.lua
function auFilterOf(obj, ...)
return target.auFilterOf(obj, ...)
end
function auFilterConfig(configs)
return auFilterOf({
configs = configs
})
end
function auFilterArch(arch)
return auFilterOf({
archs = arch
})
end
function auFilterPlatform(platform)
return auFilterOf({
platforms = platform
})
end
function auGetSetting(name)
return Aurora.Settings[name]
end
_G.filterStack = {}
function auFilter(filter)
local tbl = _G.filterStack;
if (not filter or #filter == 0) then
table.remove(tbl, #tbl)
else
table.insert(tbl, filter)
end
local filterArray = {}
auForEach(tbl, function(val)
filterArray = auMergeArray(filterArray, val)
end)
--print("FILTERING ", json.encode(filterArray), json.encode(filter))
_G.filter(filterArray)
end
function auLinkProject(...)
main.linkAuProject(...)
end
function auIncludeProject(...)
main.includeAuProject(...)
end
function auLinkAndRefProject(...)
main.importAndLinkProject(...)
end
function auAddFeature(...)
main.addFeature(...)
end
function auGetBaseProjectName()
return main.getBaseProjectName()
end
function auGetCurrentProject()
return main.getCurrentProjectName()
end
function auGetProjectProcessor(name)
return main.getProjectProcessor(name)
end
function auGetProjectMeta(name)
local processor = auGetProjectProcessor(name)
if (not processor) then
return
end
return processor:getMeta()
end
function auGetCurrentProjectProcessor()
return main.getProjectProcessor(auGetCurrentProject())
end
function auGetCurrentProjectMeta()
local temp = auGetCurrentProjectProcessor()
if (not temp) then return end
return auGetCurrentProjectProcessor():getMeta()
end
function auIsProjectIntialized(name)
return main.isProjectLoaded(name)
end
function auAddResource(...)
resourceCompiler(...)
end
function auProtobufFiles(files, extended)
protobuf.addProtobufFiles(files, extended)
end
function auProtobufIncludeProject(projectName)
protobuf.linkProject(projectName)
end
function auAddVala(info)
vala(info)
end