[*] project names containing hyphens will screw with the macro preprocessor in vs (and other compilers. msvc compiles, vs doesnt like it, other compilers will probably complain)

This commit is contained in:
Reece Wilson 2021-07-05 14:36:37 +01:00
parent 8059031835
commit 66b3281934
2 changed files with 11 additions and 8 deletions

View File

@ -141,8 +141,6 @@ function JsonProcessor(info)
_G["info"] = info _G["info"] = info
local loadstring = loadstring or load
if (_if) then if (_if) then
local val = eval("return " .. _if) local val = eval("return " .. _if)
if (not val) then if (not val) then
@ -328,8 +326,10 @@ function JsonProcessor(info)
local iface = proj.processor local iface = proj.processor
local macro = ("_auhas_" .. dep):upper():gsub("%-", "_");
if (isProjectLoaded(dep)) then if (isProjectLoaded(dep)) then
defines(("_auhas_" .. dep):upper() .. "=1") defines(macro .. "=1")
iface:handleReference(isWeakCircularReference(dep)) iface:handleReference(isWeakCircularReference(dep))
@ -337,7 +337,7 @@ function JsonProcessor(info)
iface:handleLink() iface:handleLink()
end end
else else
defines(("_auhas_" .. dep):upper() .. "=0") defines(macro .. "=0")
if (not soft) then if (not soft) then
fatal("missing project: ", dep) fatal("missing project: ", dep)
end end

View File

@ -270,16 +270,13 @@ function attemptNS(ns)
attemptLoad = true attemptLoad = true
end end
-- this seems to be singleshot.
-- once you switch namespaces, theres no going back, it seems.
-- we try to preserve namespace-project contiguity as much as possible through sorting and evil recursion
group(ns) group(ns)
return attemptLoad return attemptLoad
end end
resolved = {} resolved = {}
function processProject(name, required, noNs) function processProject(name, required, noNs)
local a = projectsprocessor[name] local a = projectsprocessor[name]
if (not a) then if (not a) then
if (required) then if (required) then
@ -289,17 +286,21 @@ function processProject(name, required, noNs)
end end
end end
-- ensure the project is initializd
processInit(a) processInit(a)
-- legacy recursion
if (projectsblocked[name]) then if (projectsblocked[name]) then
return true return true
end end
projectsblocked[name] = name projectsblocked[name] = name
-- process all within the namespace before processing the actual project
local ns = a.info.namespace local ns = a.info.namespace
local loadOthers = attemptNS(ns) local loadOthers = attemptNS(ns)
-- {
local cwd = os.getcwd() local cwd = os.getcwd()
local old = _G["current_project"] local old = _G["current_project"]
@ -310,9 +311,11 @@ function processProject(name, required, noNs)
os.chdir(cwd) os.chdir(cwd)
_G["current_project"] = old _G["current_project"] = old
-- }
projectsemitted[name] = name projectsemitted[name] = name
-- cont
if (loadOthers) then if (loadOthers) then
namespacesemitted[ns] = ""; namespacesemitted[ns] = "";
processNS(ns) processNS(ns)