[+] Added api to pull the base project during reference and linkage

This commit is contained in:
Reece Wilson 2022-01-20 15:53:31 +00:00
parent 7107098c12
commit a3bba89553
3 changed files with 26 additions and 7 deletions

View File

@ -100,17 +100,20 @@ function JsonProcessor(info)
local cur = auGetCurrentProjectMeta() local cur = auGetCurrentProjectMeta()
local staticImport = circular
local pendingOps = {} local pendingOps = {}
if (cur and cur.isShared) then if (cur and cur.isShared and not circular) then
table.insert(pendingOps, "dllimport") table.insert(pendingOps, "dllimport")
elseif (cur and cur.isStatic) then elseif (cur and cur.isStatic and not circular) then
table.insert(pendingOps, "dllexport") table.insert(pendingOps, "dllexport")
table.insert(pendingOps, "staticImport") table.insert(pendingOps, "staticImport")
end table.insert(pendingOps, "staticImpDefines")
elseif (circular) then
if (this.info.isStatic) then table.insert(pendingOps, "staticImport")
table.insert(pendingOps, "staticImpDefines") table.insert(pendingOps, "staticImpDefines")
end end
table.insert(pendingOps, "include") table.insert(pendingOps, "include")
table.insert(pendingOps, "include-depends") table.insert(pendingOps, "include-depends")
table.insert(pendingOps, "include-soft-depends") table.insert(pendingOps, "include-soft-depends")

View File

@ -8,6 +8,7 @@ _auProjectsBlocked = {}
_auNamespacesEmitted = {} _auNamespacesEmitted = {}
_auResolvedDep = {} _auResolvedDep = {}
_auCurrentProject = {} _auCurrentProject = {}
_auCurrentBaseProject = {}
------------------------------------------------------- -------------------------------------------------------
-- utils -- utils
@ -299,11 +300,15 @@ processProject = function(name, required, noNs)
end end
end end
local oldBaeProjName = _auCurrentBaseProject
_auCurrentBaseProject = name;
-- ensure the project is initializd -- ensure the project is initializd
processInit(a) processInit(a)
-- recursion protection -- recursion protection
if (_auProjectsBlocked[name]) then if (_auProjectsBlocked[name]) then
_auCurrentBaseProject = oldBaeProjName
return true return true
end end
_auProjectsBlocked[name] = name _auProjectsBlocked[name] = name
@ -324,6 +329,8 @@ processProject = function(name, required, noNs)
processNS(ns) processNS(ns)
end end
_auCurrentBaseProject = oldBaeProjName
return true return true
end end
@ -335,7 +342,7 @@ function isWeakCircularReference(depName)
-- TODO: recursion -- TODO: recursion
for index, value in ipairs(dep.deps) do for index, value in ipairs(dep.deps) do
if value == _auCurrentProject then if (value == _auCurrentProject or value == _auCurrentBaseProject) then
return true return true
end end
end end
@ -377,6 +384,10 @@ local function getCurrentProjectName()
return _auCurrentProject return _auCurrentProject
end end
local function getBaseProjectName()
return _auCurrentBaseProject
end
local function includeAuProject(dep, soft) local function includeAuProject(dep, soft)
local processor = getProjectProcessor(dep) local processor = getProjectProcessor(dep)
if (not processor) then if (not processor) then
@ -473,5 +484,6 @@ return {
getProjectProcessor = getProjectProcessor, getProjectProcessor = getProjectProcessor,
isProjectLoaded = isProjectLoaded, isProjectLoaded = isProjectLoaded,
getCurrentProjectName = getCurrentProjectName, getCurrentProjectName = getCurrentProjectName,
processSolution = processSolution processSolution = processSolution,
getBaseProjectName = getBaseProjectName
} }

View File

@ -117,6 +117,10 @@ function auAddFeature(...)
main.addFeature(...) main.addFeature(...)
end end
function auGetBaseProjectName()
return main.getBaseProjectName()
end
function auGetCurrentProject() function auGetCurrentProject()
return main.getCurrentProjectName() return main.getCurrentProjectName()
end end