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