[*] Add requireAbs in Aurora.lua for requiring remote and local scripts + features

[*] Fix buildaction binscript exec
[*] Minor fixes in json processor
This commit is contained in:
Reece Wilson 2021-06-04 19:39:11 +01:00
parent 630939c6ac
commit d4d6151260
4 changed files with 47 additions and 23 deletions

View File

@ -55,13 +55,13 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject)
command = command .. " --project_arch=\"%{cfg.architecture}\""
command = command .. " --project_platform=\"%{cfg.system}\""
local cur = getProjectInfo(getCurrentProjectName())
if (cwdRelToProject) then
command = command .. " --actualcwd=\"" .. cur.path .. "\""
else
command = command .. " --actualcwd=\"" .. os.realpath(cwd) .. "\""
end
local cur = getProjectInfo(getCurrentProjectName())
if (cur and cur.path) then
command = command .. " --project_root=\"" .. cur.path .. "\""
end
@ -69,7 +69,8 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject)
command = command .. " --scripts=\"" .. os.realpath(cwd .. "/Build_Scripts") .. "\""
if (when == "post") then
local postBuildSuffix = " --cur_binary=\"" .. os.realpath(_G.hack_outputpath) .. "\""
local postBuildSuffix = " --cur_binary=\"%{cfg.buildtarget.abspath}\""
command = command .. postBuildSuffix
end

View File

@ -100,23 +100,31 @@ function JsonProcessor(info)
handleDllImportMaybe(this)
end
local handleReference = function(this)
local handleReference = function(this, circular)
local type = this.result.type
if ((type:lower() == "utility") or (type:lower() == "blank")) then
return
end
local cur = getProjectInfo(getCurrentProjectName())
local cur = nil
if (circular) then
cur = getProjectInfo(getCurrentProjectName())
else
cur = this.info
end
if (cur and cur.isShared) then
-- shared libraries are only allowed to import other shared libraries
handleDllImportMaybe(this)
elseif (cur and cur.isStatic) then
-- static libs are allowed to reference dllexports in translation units of the parent shared module
handleDllExportMaybe(this)
forEach(result.staticImport, defines)
end
this:handleInclude()
handleInclude(this, false)
defines(("_auhas_" .. this.result.name):upper() .. "=1")
end
@ -211,15 +219,15 @@ function JsonProcessor(info)
if (isWeakCircularReference(dep)) then
print("handling circular reference", dep)
iface:handleReference()
iface:handleReference(true)
return
end
local iface = _G["projectsprocessor"][dep].processor
local iface = proj.processor
if (isProjectLoaded(dep)) then
defines(("_auhas_" .. dep):upper() .. "=1")
iface:includeHeaders()
iface:handleReference()
iface:handleLink()
else
defines(("_auhas_" .. dep):upper() .. "=0")
@ -259,6 +267,12 @@ function JsonProcessor(info)
forEach(object.depends, handleDepends, a, false)
forEach(object["soft-depends"], handleDepends, a, true)
forEach(object.impDefines, defines)
if (usingMSVC) then
forEach(object.msvcIgnore, disablewarnings)
end
if (usingClang) then
forEach(object.clangIgnore, disablewarnings)
end
end
function handleEval(object)
@ -336,7 +350,6 @@ function JsonProcessor(info)
interface.result = result
interface.info = info
interface.process = handleProcess
interface.includeHeaders = handleInclude
interface.handleLink = handleLink
interface.handleReference = handleReference
return interface

View File

@ -86,8 +86,10 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root)
objdir(getroot() .. "/Build_CompilerWorkingDirectory/" .. name)
if (root and (root ~= "MAGIC")) then
if (root) then
location(root)
else
location(os.getcwd())
end
-- V8 takes minutes to start up on an i9-9900k, QST/VM tests result in highs of ~30MB/s from 900MB/s
@ -136,11 +138,9 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root)
return
end
-- dont question it. supporting legacy code
if (not annoyingfirst) then
if (not root) then
location(path)
end
if (os.isfile(path)) then
files {path}
return
end
annoyingfirst = true
@ -162,6 +162,7 @@ local boilerplateProject = function(name, projectType, src, inc, dest, root)
end
local debugDir = nil
if (type(dest) == "string") then debugDir = dest end
if (type(dest) == "table") then debugDir = dest[1] end
setBestDebugDir(debugDir)

View File

@ -53,6 +53,15 @@ local extendInfo = function(this)
this.isWindowed = type == "windowedapp"
end
local requireAbs = function(path)
local absRefPath = os.realpath(getroot() .. "/Build_Scripts/")
local relPath = _G.path.getrelative(absRefPath, path)
if (os.isfile(relPath)) then
fatal("Script not found: ", relPath)
end
return require(relPath:sub(1, #relPath - 4))
end
function addVisit(ina)
local args = {
namespace = ina.namespace,
@ -92,12 +101,12 @@ function addVisit(ina)
local localLua = cwd .. "/Build_UserScripts/" .. args.name .. ".aurora.lua"
if (os.isfile(localLua)) then
project.processor = require(localLua)(info)
project.processor = requireAbs(localLua)(info)
elseif (os.isfile(localJson)) then
info.jpath = localJson
project.processor = jsonProcessor(info)
elseif (os.isfile(remoteLua)) then
project.processor = require(remoteLua)(info)
project.processor = requireAbs(remoteLua)(info)
elseif (os.isfile(remoteJson)) then
info.jpath = remoteJson
project.processor = jsonProcessor(info)
@ -278,13 +287,13 @@ end
-- executes inline under iprocessor::process
function addFeature(feature)
local script = os.getcwd() .. "/Build_Script/Features/" .. feature:lower() .. ".lua"
local script = os.getcwd() .. "/Build_Scripts/Features/" .. feature:lower() .. ".lua"
if (not os.isfile(script)) then
return
end
require(script)()
requireAbs(script)()
end
require ("Boilerplate.workspace")