[+] 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 staticImport = circular
local pendingOps = {}
if (cur and cur.isShared) then
if (cur and cur.isShared and not circular) then
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, "staticImport")
end
if (this.info.isStatic) then
table.insert(pendingOps, "staticImpDefines")
elseif (circular) then
table.insert(pendingOps, "staticImport")
table.insert(pendingOps, "staticImpDefines")
end
table.insert(pendingOps, "include")
table.insert(pendingOps, "include-depends")
table.insert(pendingOps, "include-soft-depends")

View File

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

View File

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