[*] Fix recursive includes

This commit is contained in:
Reece Wilson 2024-01-29 12:32:06 +00:00
parent ed840f6a3f
commit a5febd5cb6

View File

@ -9,7 +9,10 @@ _auNamespacesEmitted = {}
_auResolvedDep = {} _auResolvedDep = {}
_auCurrentProject = {} _auCurrentProject = {}
_auCurrentBaseProject = nil _auCurrentBaseProject = nil
_auRefGuardStart = false
_auFatalMsg = {} _auFatalMsg = {}
_auLinkGuard = {}
_auRefGuard = {}
------------------------------------------------------- -------------------------------------------------------
-- utils -- utils
@ -169,8 +172,6 @@ local function pushProject(project, callback)
pushProjectState(project.info.name, project.info.path, callback) pushProjectState(project.info.name, project.info.path, callback)
end end
_auLinkGuard = {}
-- private -- private
local function processInit(project) local function processInit(project)
if (project.isInitialized) then if (project.isInitialized) then
@ -267,7 +268,9 @@ local function processNS(namespace)
_auFatalMsg["starting projects"] = namespace _auFatalMsg["starting projects"] = namespace
auForEach(projsIdxs, function(idx) auForEach(projsIdxs, function(idx)
_auLinkGuard = {} _auLinkGuard = {}
_auLinkGuard[projs[idx].info.name]= {} _auRefGuard = {}
_auLinkGuard[projs[idx].info.name] = {}
_auRefGuard[projs[idx].info.name] = {}
processProject(projs[idx].info.name) processProject(projs[idx].info.name)
end) end)
end end
@ -409,11 +412,31 @@ local function includeAuProject(dep, soft)
end end
end end
local linkStart = false
if (auGetCurrentProjectMeta()) then
if (_auRefGuard[dep] ) then
return
end
_auRefGuard[dep] = dep
end
if (not _auRefGuardStart) then
_auRefGuardStart = true
linkStart = true
end
pushProject(a, function() pushProject(a, function()
_auFatalMsg["processing project ref"] = a.info.name _auFatalMsg["processing project ref"] = a.info.name
processor:handleReference(isWeakCircularReference(dep)) processor:handleReference(isWeakCircularReference(dep))
_auFatalMsg["processing project ref"] = nil _auFatalMsg["processing project ref"] = nil
end) end)
if (linkStart) then
_auRefGuard = {}
_auRefGuardStart = false
end
return true return true
end end