2021-11-13 08:31:32 +00:00
|
|
|
local aurora = {}
|
|
|
|
_G["Aurora"] = aurora
|
|
|
|
|
|
|
|
function auFetchGlobal(name)
|
|
|
|
local ret = aurora[name] or {}
|
|
|
|
aurora[name] = ret
|
|
|
|
return ret
|
|
|
|
end
|
|
|
|
|
2022-03-04 17:05:38 +00:00
|
|
|
local function escapeBinaryPath(path)
|
|
|
|
if (os.host() == "windows") then
|
|
|
|
return "\"" .. path .. "\""
|
|
|
|
end
|
|
|
|
return path:gsub(" ", "\\ ")
|
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
require("./../../Utilities/Utilities")
|
|
|
|
|
|
|
|
local triggers =
|
|
|
|
{
|
|
|
|
"binscript",
|
|
|
|
"luascript",
|
|
|
|
"cwd",
|
2021-11-21 17:23:31 +00:00
|
|
|
"cmd",
|
2021-11-13 08:31:32 +00:00
|
|
|
"settings",
|
|
|
|
"project_name",
|
|
|
|
"project_arch",
|
|
|
|
"project_platform",
|
|
|
|
"project_root",
|
|
|
|
"additional",
|
|
|
|
"project_type",
|
2022-03-04 17:05:38 +00:00
|
|
|
"luaabsscript",
|
|
|
|
"projectname_",
|
|
|
|
"projectbins_",
|
|
|
|
"projectnameex_",
|
|
|
|
"project_config",
|
|
|
|
"project_name"
|
2021-11-13 08:31:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auForEach(triggers, function(trigger)
|
|
|
|
newoption
|
|
|
|
{
|
|
|
|
trigger = trigger,
|
|
|
|
description = ""
|
|
|
|
}
|
|
|
|
end)
|
|
|
|
|
|
|
|
local settings = _OPTIONS["settings"]
|
|
|
|
if (settings) then
|
2022-03-04 17:05:38 +00:00
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
Aurora.Settings = json.decode(base64.decode(settings))
|
|
|
|
|
2022-03-04 17:05:38 +00:00
|
|
|
require("./../../Public/paths")
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
2022-03-04 17:05:38 +00:00
|
|
|
require("./../Target/platform")
|
|
|
|
|
2021-11-14 16:38:07 +00:00
|
|
|
local preconfig = path.join(Aurora.Settings.sAbsRoot, "preconfig.lua")
|
2022-03-04 17:05:38 +00:00
|
|
|
if (os.isfile(preconfig)) then
|
2021-11-14 16:38:07 +00:00
|
|
|
auRequireAbs(preconfig)
|
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
local projRoot = path.join(Aurora.Settings.sAbsRoot, _OPTIONS["project_root"] or "./")
|
|
|
|
|
2022-03-04 17:05:38 +00:00
|
|
|
local projectBins = _OPTIONS["projectbins_"]
|
|
|
|
if (projectBins) then
|
|
|
|
projectBins = os.realpath(path.join(projRoot, projectBins))
|
|
|
|
end
|
|
|
|
|
|
|
|
local cwd = _OPTIONS["cwd"]
|
2021-11-13 08:31:32 +00:00
|
|
|
if (cwd) then
|
|
|
|
os.chdir(projRoot)
|
|
|
|
else
|
|
|
|
os.chdir(Aurora.Settings.sAbsRoot)
|
2021-11-21 17:23:31 +00:00
|
|
|
end
|
2021-11-13 08:31:32 +00:00
|
|
|
|
|
|
|
local args = _OPTIONS["additional"]
|
|
|
|
if (args) then
|
|
|
|
args = base64.decode(args)
|
|
|
|
end
|
|
|
|
|
2021-11-21 17:23:31 +00:00
|
|
|
local binSuffx = ""
|
|
|
|
if (args) then
|
2022-03-04 17:05:38 +00:00
|
|
|
binSuffx = " " .. args
|
2021-11-21 17:23:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local binScript = _OPTIONS["binscript"]
|
|
|
|
if (binScript) then
|
|
|
|
os.exit(os.execute(path.join(Aurora.Settings.sAbsRoot, binScript) .. binSuffx))
|
|
|
|
end
|
|
|
|
|
|
|
|
local cmd = _OPTIONS["cmd"]
|
|
|
|
if (cmd) then
|
2022-03-04 17:05:38 +00:00
|
|
|
os.exit(os.execute(base64.decode(cmd)))
|
2021-11-21 17:23:31 +00:00
|
|
|
end
|
|
|
|
|
2021-11-13 08:31:32 +00:00
|
|
|
local projName = _OPTIONS["project_name"]
|
|
|
|
local projType = _OPTIONS["project_type"]
|
|
|
|
local projPlatform = _OPTIONS["project_platform"]
|
2022-03-04 17:05:38 +00:00
|
|
|
local projCfg = _OPTIONS["project_config"]
|
2021-11-13 08:31:32 +00:00
|
|
|
local projArch = _OPTIONS["project_arch"]
|
|
|
|
|
2022-03-04 17:05:38 +00:00
|
|
|
if (string.find(projCfg, "|")) then
|
|
|
|
projCfg = projCfg:match("([^,]+)|([^,]+)")
|
|
|
|
end
|
|
|
|
|
2022-03-04 17:11:29 +00:00
|
|
|
local targetName = string.format("%s.%s.%s.%s", projName, projCfg, projPlatform, projArch)
|
2021-11-13 08:31:32 +00:00
|
|
|
local fileName = targetName
|
|
|
|
|
2022-03-04 17:05:38 +00:00
|
|
|
local platform = Aurora.Platforms[projPlatform]
|
2021-11-13 08:31:32 +00:00
|
|
|
if (platform) then
|
2022-03-04 17:05:38 +00:00
|
|
|
fileName = fileName .. (platform.exts or {})[projType] or ""
|
|
|
|
end
|
|
|
|
|
|
|
|
if (projectBins) then
|
|
|
|
local projectName = _OPTIONS["projectname_"]
|
|
|
|
local projectNameEx = _OPTIONS["projectnameex_"] == "true"
|
|
|
|
local extension = (platform.exts or {})["ConsoleApp"]
|
|
|
|
|
|
|
|
local binName = projectName
|
|
|
|
|
|
|
|
if (projectNameEx) then
|
|
|
|
binName = string.format("%s.%s.%s.%s", binName, projCfg, projPlatform, projArch)
|
|
|
|
end
|
|
|
|
|
|
|
|
binName = binName .. extension
|
|
|
|
local cmd = escapeBinaryPath(path.join(projectBins, binName)) .. binSuffx
|
|
|
|
|
|
|
|
os.exit(os.execute(cmd))
|
2021-11-13 08:31:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
auBuild =
|
|
|
|
{
|
2021-11-14 16:38:07 +00:00
|
|
|
platform = projPlatform,
|
2021-11-13 08:31:32 +00:00
|
|
|
architecture = projArch,
|
2021-11-14 16:38:07 +00:00
|
|
|
projectName = projName,
|
|
|
|
projectType = projType,
|
|
|
|
projectRoot = projRoot,
|
2021-11-13 08:31:32 +00:00
|
|
|
projectTargetName = targetName,
|
|
|
|
projectTargetFileName = fileName,
|
2021-11-14 16:38:07 +00:00
|
|
|
args = args,
|
|
|
|
root = cwd
|
2021-11-13 08:31:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local luaScript = _OPTIONS["luascript"]
|
|
|
|
local luaAbsScript = _OPTIONS["luaabsscript"]
|
|
|
|
if (luaScript) then
|
2022-03-04 17:05:38 +00:00
|
|
|
auRequireAbs(path.join(Aurora.Settings.sAbsRepoScripts, luaScript))
|
2021-11-13 08:31:32 +00:00
|
|
|
elseif (luaAbsScript) then
|
|
|
|
auRequireAbs(path.join(Aurora.Settings.sAbsRoot, luaAbsScript))
|
|
|
|
end
|
|
|
|
|
|
|
|
os.exit()
|