Build/Core/Actions/buildActionBootstrap.lua

97 lines
2.1 KiB
Lua

local aurora = {}
_G["Aurora"] = aurora
function auFetchGlobal(name)
local ret = aurora[name] or {}
aurora[name] = ret
return ret
end
require("./../../Utilities/Utilities")
local triggers =
{
"binscript",
"luascript",
"cwd",
"settings",
"project_name",
"project_arch",
"project_platform",
"project_root",
"additional",
"project_type",
"luaabsscript"
}
auForEach(triggers, function(trigger)
newoption
{
trigger = trigger,
description = ""
}
end)
local settings = _OPTIONS["settings"]
if (settings) then
Aurora.Settings = json.decode(base64.decode(settings))
require("./../../Public/Paths")
end
local projRoot = path.join(Aurora.Settings.sAbsRoot, _OPTIONS["project_root"] or "./")
local cwd =_OPTIONS["cwd"]
if (cwd) then
os.chdir(projRoot)
else
os.chdir(Aurora.Settings.sAbsRoot)
end
local binScript = _OPTIONS["binscript"]
if (binScript) then
os.exit(os.execute(path.join(Aurora.Settings.sAbsRoot, binScript)))
end
local args = _OPTIONS["additional"]
if (args) then
args = base64.decode(args)
end
local projName = _OPTIONS["project_name"]
local projType = _OPTIONS["project_type"]
local projPlatform = _OPTIONS["project_platform"]
local projArch = _OPTIONS["project_arch"]
local targetName = projName .. "." .. projPlatform .. "." .. projArch
local fileName = targetName
local platform = Aurora.Platforms[platformName]
if (platform) then
fileName = fileName .. (platform.exts or {})[type] or ""
end
auBuild =
{
platform = projPlatform,
architecture = projArch,
projectName = projName,
projectType = projType,
projectRoot = projRoot,
projectTargetName = targetName,
projectTargetFileName = fileName,
args = args,
root = cwd
}
_G["build"] = auBuild
local luaScript = _OPTIONS["luascript"]
local luaAbsScript = _OPTIONS["luaabsscript"]
if (luaScript) then
auRequireAbs(os.realpath(build.root .. "/Build_UserScripts/" .. luaScript))
elseif (luaAbsScript) then
auRequireAbs(path.join(Aurora.Settings.sAbsRoot, luaAbsScript))
end
os.exit()