[*] Begin updating build events to work on WIP branch

[*] Improve auFatalMsg logging
This commit is contained in:
Reece Wilson 2022-03-04 17:05:38 +00:00
parent 3a79d9e0df
commit a9588c9d40
7 changed files with 93 additions and 32 deletions

View File

@ -75,6 +75,7 @@ local getPremakeExec = function()
end
local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
local scriptPath = path
local cwd = auGetRoot()
@ -97,20 +98,16 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
command = command .. getPremakeExec()
local oldBootstrapPrefix = Aurora.Settings.sAbsRepoScripts
local bootstrapPrefix = _G.path.getrelative(Aurora.Settings.sAbsCompilerWd .. "/" .. auGetCurrentProjectName(), Aurora.Settings.sAbsRepoScripts)
local bootstrap = bootstrapPrefix .. "/Core/Actions/buildActionBootstrap.lua"
if (cdAware) then
command = command .. " --file=\"" .. bootstrap .. "\""
else
local bootstrap = Aurora.Settings.sAbsScripts .. "/Core/Actions/buildActionBootstrap.lua"
command = command .. " --file=\"" .. os.realpath(bootstrap) .. "\""
end
--command = command .. " --project_name=\"%{prj.name}\""
command = command .. " --project_name=\"" .. cur.name .. "\""
command = command .. " --project_type=\"" .. cur.projectType .. "\""
command = command .. " --project_config=\"%{cfg.longname}\""
command = command .. " --project_arch=\"%{cfg.architecture}\""
command = command .. " --project_platform=\"%{cfg.system}\""
command = command .. " --project_platform=\"%{cfg.platform}\""
-- Aurora.Settings could take up too much of the win32 max command line buffer (8191 characters)
-- This seems like a lot, but it should be well within the 9k limit
@ -152,18 +149,31 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
cliArgs = " " .. argsEscaped
end
if (args) then
command = command .. " --additional=\"" .. base64.encode(args) .. "\""
end
if (scriptType == "lua") then
if (os.isfile(Aurora.Settings.sAbsRepoScripts .. path)) then
command = command .. " --luascript=\"" .. path .. "\""
else
command = command .. " --luaabsscript=\"" .. _G.path.getrelative(settings.sAbsRoot, path) .. "\""
end
if (args) then
command = command .. " --additional=\"" .. base64.encode(args) .. "\""
end
elseif (scriptType == "bin") then
command = command .. " --binscript=\"" .. _G.path.getrelative(settings.sAbsRoot, path) .. cliArgs .. "\""
elseif (scriptType == "cmd") then
command = command .. " --cmd=\"" .. base64.encode(path) .. "\""
elseif (scriptType == "project") then
command = command .. " --projectbins_=\"%{cfg.targetdir}\""
command = command .. " --projectname_=" .. path
command = command .. " --projectnameex_=" .. tostring(Aurora.Settings.bDefinePartialABIInTargetName)
end
if (when == "post") then

View File

@ -7,6 +7,13 @@ function auFetchGlobal(name)
return ret
end
local function escapeBinaryPath(path)
if (os.host() == "windows") then
return "\"" .. path .. "\""
end
return path:gsub(" ", "\\ ")
end
require("./../../Utilities/Utilities")
local triggers =
@ -22,7 +29,12 @@ local triggers =
"project_root",
"additional",
"project_type",
"luaabsscript"
"luaabsscript",
"projectname_",
"projectbins_",
"projectnameex_",
"project_config",
"project_name"
}
auForEach(triggers, function(trigger)
@ -35,18 +47,26 @@ end)
local settings = _OPTIONS["settings"]
if (settings) then
Aurora.Settings = json.decode(base64.decode(settings))
require("./../../Public/Paths")
require("./../../Public/paths")
end
require("./../Target/platform")
local preconfig = path.join(Aurora.Settings.sAbsRoot, "preconfig.lua")
if (os.isfile(preconfig) then
if (os.isfile(preconfig)) then
auRequireAbs(preconfig)
end
local projRoot = path.join(Aurora.Settings.sAbsRoot, _OPTIONS["project_root"] or "./")
local projectBins = _OPTIONS["projectbins_"]
if (projectBins) then
projectBins = os.realpath(path.join(projRoot, projectBins))
end
local cwd = _OPTIONS["cwd"]
if (cwd) then
os.chdir(projRoot)
@ -61,7 +81,7 @@ end
local binSuffx = ""
if (args) then
binSuffx = " " .. binSuffx
binSuffx = " " .. args
end
local binScript = _OPTIONS["binscript"]
@ -69,23 +89,44 @@ if (binScript) then
os.exit(os.execute(path.join(Aurora.Settings.sAbsRoot, binScript) .. binSuffx))
end
local cmd = _OPTIONS["cmd"]
if (cmd) then
os.exit(os.execute(cmd .. binSuffx))
os.exit(os.execute(base64.decode(cmd)))
end
local projName = _OPTIONS["project_name"]
local projType = _OPTIONS["project_type"]
local projPlatform = _OPTIONS["project_platform"]
local projCfg = _OPTIONS["project_config"]
local projArch = _OPTIONS["project_arch"]
local targetName = projName .. "." .. projPlatform .. "." .. projArch
if (string.find(projCfg, "|")) then
projCfg = projCfg:match("([^,]+)|([^,]+)")
end
local targetName = projName .. "." .. projCfg .. "." .. projPlatform .. "." .. projArch
local fileName = targetName
local platform = Aurora.Platforms[platformName]
local platform = Aurora.Platforms[projPlatform]
if (platform) then
fileName = fileName .. (platform.exts or {})[type] or ""
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))
end
auBuild =
@ -101,12 +142,10 @@ auBuild =
root = cwd
}
_G["build"] = auBuild
local luaScript = _OPTIONS["luascript"]
local luaAbsScript = _OPTIONS["luaabsscript"]
if (luaScript) then
auRequireAbs(os.realpath(build.root .. Aurora.Settings.sRelRepoScripts .. "/" .. luaScript))
auRequireAbs(path.join(Aurora.Settings.sAbsRepoScripts, luaScript))
elseif (luaAbsScript) then
auRequireAbs(path.join(Aurora.Settings.sAbsRoot, luaAbsScript))
end

View File

@ -221,11 +221,15 @@ local function auBlockProjectKeyBuildEvent(processor, value)
type = "lua"
elseif (value.bin) then
type = "bin"
elseif (value.project) then
type = "project"
elseif (value.cmd) then
type = "cmd"
else
return
end
auAddBuildAction(obj.when, type, value[type], value.isCwdProjRoot)
auAddBuildAction(value.when, type, value[type], value.isCwdProjRoot, value.args)
end, processor)
end
@ -381,7 +385,6 @@ local auProjectRefHandlers =
{
linkDepends = auHeaderProjectKeyLinkDepends,
eval = auBlockProjectKeyEval,
events = auBlockProjectKeyBuildEvent,
actions = auBlockProjectKeyBuildAction,
links = auBlockProjectKeyLinks,
defines = auBlockProjectKeyDefines,

View File

@ -9,6 +9,7 @@ _auNamespacesEmitted = {}
_auResolvedDep = {}
_auCurrentProject = {}
_auCurrentBaseProject = {}
_auFatalMsg = {}
-------------------------------------------------------
-- utils
@ -321,6 +322,7 @@ processProject = function(name, required, noNs)
_auFatalMsg = {}
_auFatalMsg["processing project"] = a.info.name
a.processor:process()
_auFatalMsg = {}
end)
-- cont
@ -409,10 +411,9 @@ local function includeAuProject(dep, soft)
end
pushProject(a, function()
_auFatalMsg = {}
_auFatalMsg["processing project ref"] = a.info.name
processor:handleReference(isWeakCircularReference(dep))
_auFatalMsg["processing project ref"] = nil
end)
return true
end
@ -443,9 +444,9 @@ local function linkAuProject(dep, soft)
--if (not processor:getMeta().isStatic) then
pushProject(a, function()
_auFatalMsg = {}
_auFatalMsg["processing project link"] = a.info.name
processor:handleLink()
_auFatalMsg["processing project link"] = nil
end)
--end
return true

View File

@ -8,7 +8,7 @@ function auAddBuildAction(...)
buildAction(...)
end
function auAddBuildAction(...)
function auAddBuildActionO(...)
local type = {
-- stage: pre, post
-- filter: ...

View File

@ -8,7 +8,7 @@ function auBuildActionO()
return {
stage = "post", -- pre, post,
-- filter: ...,
-- lua/bin/targetName/command: relative path - lua script; relative path - executable; project name; command line
-- lua/bin/project/cmd: relative path - lua script; relative path - executable; project name; command line
-- args: lua private passthrough; binary or target name command args
cwd = "sln" -- sln, prj
}

View File

@ -1,3 +1,4 @@
print("hello paths")
if (not Aurora.Settings.sAbsRoot) then
Aurora.Settings.sAbsRoot = os.realpath(os.getcwd() .. "/../..") .. "/"
@ -21,11 +22,17 @@ end
local function resolvePathAbs(key)
local path = resolvePathAbs2(key, "sAbsRoot")
if (not path) then
return
end
if (not os.isdir(path)) then
os.mkdir(path)
end
end
resolvePathAbs("sRelDebug")
resolvePathAbs("sRelStage")
resolvePathAbs("sRelShip")
@ -34,6 +41,7 @@ resolvePathAbs("sRelSymbols")
resolvePathAbs("sRelLinkLibs")
resolvePathAbs("sRelCompilerWd")
local function resolveAuPathAbs(key)
return resolvePathAbs2(key, "sAbsAuRoot")
end