[*] Improve how dependencies are resolved to nuke a double lock bug
This commit is contained in:
parent
353237353a
commit
d625f7b9e2
@ -145,14 +145,25 @@ function JsonProcessor(info)
|
|||||||
return dep
|
return dep
|
||||||
end
|
end
|
||||||
|
|
||||||
local handleDependsPreemptive = function(dep, this, soft)
|
local handleDependsPreemptive = function(dep, this, soft, resolve)
|
||||||
dep = translateDep(this, dep)
|
dep = translateDep(this, dep)
|
||||||
|
|
||||||
if (not isProjectLoaded(dep)) then
|
if (not isProjectLoaded(dep)) then
|
||||||
processProject(dep, not soft)
|
resolve(dep, soft)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local pokeDeps = function(this, resolve)
|
||||||
|
local result = this.result
|
||||||
|
forEach(result.depends, handleDependsPreemptive, this, false, resolve)
|
||||||
|
forEach(result["soft-depends"], handleDependsPreemptive, this, true, resolve)
|
||||||
|
end
|
||||||
|
|
||||||
|
local handleParse = function(this)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
local handleProcess = function (a)
|
local handleProcess = function (a)
|
||||||
local result = a.result
|
local result = a.result
|
||||||
local name = a.info.name
|
local name = a.info.name
|
||||||
@ -160,11 +171,6 @@ function JsonProcessor(info)
|
|||||||
|
|
||||||
local isUtility = false
|
local isUtility = false
|
||||||
|
|
||||||
forEach(result.depends, handleDependsPreemptive, a, false)
|
|
||||||
forEach(result["soft-depends"], handleDependsPreemptive, a, true)
|
|
||||||
|
|
||||||
attemptNS(a.info.namespace)
|
|
||||||
|
|
||||||
if (result.type:lower() == "aurora") then
|
if (result.type:lower() == "aurora") then
|
||||||
local srcPath = path .. "/Source"
|
local srcPath = path .. "/Source"
|
||||||
local incPath = path .. "/Include"
|
local incPath = path .. "/Include"
|
||||||
@ -209,8 +215,8 @@ function JsonProcessor(info)
|
|||||||
dependson(dep)
|
dependson(dep)
|
||||||
end
|
end
|
||||||
|
|
||||||
local handleDepends = function(dep, soft)
|
local handleDepends = function(dep, this, soft)
|
||||||
dep = translateDep(a, dep)
|
dep = translateDep(this, dep)
|
||||||
|
|
||||||
local proj = _G["projectsprocessor"][dep]
|
local proj = _G["projectsprocessor"][dep]
|
||||||
if (not proj) then
|
if (not proj) then
|
||||||
@ -221,14 +227,14 @@ function JsonProcessor(info)
|
|||||||
fatal("Missing project", dep)
|
fatal("Missing project", dep)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local iface = proj.processor
|
||||||
|
|
||||||
if (isWeakCircularReference(dep)) then
|
if (isWeakCircularReference(dep)) then
|
||||||
print("handling circular reference", dep)
|
print("handling circular reference", dep)
|
||||||
iface:handleReference(true)
|
iface:handleReference(true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local iface = proj.processor
|
|
||||||
|
|
||||||
if (isProjectLoaded(dep)) then
|
if (isProjectLoaded(dep)) then
|
||||||
defines(("_auhas_" .. dep):upper() .. "=1")
|
defines(("_auhas_" .. dep):upper() .. "=1")
|
||||||
iface:handleReference()
|
iface:handleReference()
|
||||||
@ -358,6 +364,7 @@ function JsonProcessor(info)
|
|||||||
local interface = {}
|
local interface = {}
|
||||||
interface.result = result
|
interface.result = result
|
||||||
interface.info = info
|
interface.info = info
|
||||||
|
interface.resolveDependencies = pokeDeps
|
||||||
interface.process = handleProcess
|
interface.process = handleProcess
|
||||||
interface.handleLink = handleLink
|
interface.handleLink = handleLink
|
||||||
interface.handleReference = handleReference
|
interface.handleReference = handleReference
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
function fatal(...)
|
function fatal(...)
|
||||||
print(...)
|
print(...)
|
||||||
|
print(debug.traceback())
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
33
aurora.lua
33
aurora.lua
@ -225,27 +225,48 @@ function attemptNS(ns)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function processProject(name, required)
|
function processProject(name, required)
|
||||||
if (projectsblocked[name]) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
projectsblocked[name] = name
|
|
||||||
local a = projectsprocessor[name]
|
local a = projectsprocessor[name]
|
||||||
if (not a) then
|
if (not a) then
|
||||||
if (required) then
|
if (required) then
|
||||||
fatal("missing project: ", name)
|
fatal("missing project: ", name)
|
||||||
else
|
else
|
||||||
|
print("missing: ", name)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (not a.isParsed) then
|
||||||
|
if (a.processor.parse) then
|
||||||
|
a.processor:parse()
|
||||||
|
end
|
||||||
|
a.isParsed = true
|
||||||
|
end
|
||||||
|
|
||||||
|
attemptNS(a.info.namespace)
|
||||||
|
|
||||||
|
if (projectsblocked[name]) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
projectsblocked[name] = name
|
||||||
|
|
||||||
|
|
||||||
|
if (not a.resolvedDeps) then
|
||||||
|
if (a.processor.resolveDependencies) then
|
||||||
|
a.processor:resolveDependencies(function(name, soft)
|
||||||
|
processProject(name, not soft)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
a.resolvedDeps = true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local cwd = os.getcwd()
|
local cwd = os.getcwd()
|
||||||
local old = _G["current_project"]
|
local old = _G["current_project"]
|
||||||
|
|
||||||
_G["current_project"] = name
|
_G["current_project"] = name
|
||||||
os.chdir(a.info.path)
|
os.chdir(a.info.path)
|
||||||
|
|
||||||
a.processor:process(a.processor)
|
a.processor:process()
|
||||||
|
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
_G["current_project"] = old
|
_G["current_project"] = old
|
||||||
|
Loading…
Reference in New Issue
Block a user