[-] Nuke legacy aurora.lua, minor clean up
This commit is contained in:
parent
baa55a507f
commit
e847e1024f
@ -93,11 +93,11 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
|
||||
command = "call "
|
||||
end
|
||||
|
||||
local cur = getProjectInfo(getCurrentProjectName())
|
||||
local cur = auGetCurrentProjectMeta()
|
||||
command = command .. getPremakeExec()
|
||||
|
||||
local oldBootstrapPrefix = Aurora.Settings.sAbsRepoScripts
|
||||
local bootstrapPrefix = _G.path.getrelative(Aurora.Settings.sAbsCompilerWd .. "/" .. getCurrentProjectName(), Aurora.Settings.sAbsRepoScripts)
|
||||
local bootstrapPrefix = _G.path.getrelative(Aurora.Settings.sAbsCompilerWd .. "/" .. auGetCurrentProjectName(), Aurora.Settings.sAbsRepoScripts)
|
||||
|
||||
local bootstrap = bootstrapPrefix .. "/Core/Actions/buildActionBootstrap.lua"
|
||||
|
||||
|
@ -274,7 +274,7 @@ local function handleDepends(processor, dep, soft)
|
||||
dep = processor:translateDep(dep)
|
||||
local macro = ("_auhas_" .. dep):upper():gsub("%-", "_");
|
||||
|
||||
if (isProjectLoaded(dep)) then
|
||||
if (auIsProjectIntialized(dep)) then
|
||||
defines(macro .. "=1")
|
||||
auLinkAndRefProject(dep, soft)
|
||||
else
|
||||
|
@ -96,8 +96,8 @@ function JsonProcessor(info)
|
||||
local handleDependsShort = function(dep, this, soft)
|
||||
dep = translateDep(this, dep)
|
||||
|
||||
local proj = _G["projectsprocessor"][dep]
|
||||
if (not proj) then
|
||||
local processor = auGetProjectProcessor(this:translateDep(dep))
|
||||
if (not processor) then
|
||||
if (soft) then
|
||||
print("Not including, ", dep)
|
||||
return
|
||||
@ -105,9 +105,8 @@ function JsonProcessor(info)
|
||||
fatal("Missing project", dep)
|
||||
end
|
||||
|
||||
local iface = proj.processor
|
||||
if (isProjectLoaded(dep) and not _G["_linkingcur"][dep]) then
|
||||
iface:handleLink()
|
||||
if (auIsProjectIntialized(dep) and not _G["_linkingcur"][dep]) then
|
||||
processor:handleLink()
|
||||
end
|
||||
end
|
||||
|
||||
@ -201,24 +200,19 @@ function JsonProcessor(info)
|
||||
end
|
||||
|
||||
local publicDepends = function(name, this, soft)
|
||||
name = translateDep(this, name)
|
||||
includeAuProject(name, soft) -- evil recursion
|
||||
auIncludeProject(this:translateDep(name), soft) -- evil recursion
|
||||
end
|
||||
|
||||
local handleReference = function(this, circular)
|
||||
local type = this.result.type
|
||||
--print("handleReference ", this.info.name)
|
||||
|
||||
|
||||
if ((type:lower() == "utility") or (type:lower() == "blank")) then
|
||||
return
|
||||
end
|
||||
|
||||
--print("handleReference function ", this.info.name, getCurrentProjectName())
|
||||
|
||||
local cur = nil
|
||||
if (circular) then
|
||||
cur = getProjectInfo(getCurrentProjectName())
|
||||
cur = auGetCurrentProjectMeta()
|
||||
else
|
||||
cur = this.info
|
||||
end
|
||||
@ -248,7 +242,7 @@ function JsonProcessor(info)
|
||||
local handleDependsPreemptive = function(dep, this, soft, resolve)
|
||||
dep = translateDep(this, dep)
|
||||
|
||||
if (not isProjectLoaded(dep)) then
|
||||
if (not auIsProjectIntialized(dep)) then
|
||||
resolve(dep, soft)
|
||||
end
|
||||
end
|
||||
@ -345,10 +339,8 @@ function JsonProcessor(info)
|
||||
handleInclude(a, true)
|
||||
|
||||
local handleDepends = function(dep, this, soft)
|
||||
dep = translateDep(this, dep)
|
||||
|
||||
local proj = _G["projectsprocessor"][dep]
|
||||
if (not proj) then
|
||||
local processor = auGetProjectProcessor(this:translateDep(dep))
|
||||
if (not processor) then
|
||||
if (soft) then
|
||||
print("Not including, ", dep)
|
||||
return
|
||||
@ -356,17 +348,15 @@ function JsonProcessor(info)
|
||||
fatal("Missing project", dep)
|
||||
end
|
||||
|
||||
local iface = proj.processor
|
||||
|
||||
local macro = ("_auhas_" .. dep):upper():gsub("%-", "_");
|
||||
|
||||
if (isProjectLoaded(dep)) then
|
||||
if (auIsProjectIntialized(dep)) then
|
||||
defines(macro .. "=1")
|
||||
|
||||
iface:handleReference(isWeakCircularReference(dep))
|
||||
processor:handleReference(isWeakCircularReference(dep))
|
||||
|
||||
if (not this.info.isStatic) then
|
||||
iface:handleLink()
|
||||
processor:handleLink()
|
||||
end
|
||||
else
|
||||
defines(macro .. "=0")
|
||||
|
@ -20,9 +20,9 @@ local function findVala()
|
||||
|
||||
local localCMingw = "C:\\msys64\\mingw64\\bin\\valac.exe"
|
||||
if (os.isfile(localCMingw)) then return localCMingw end
|
||||
else
|
||||
return "vallac"
|
||||
end
|
||||
|
||||
return "vallac"
|
||||
end
|
||||
|
||||
local function addVala(extended)
|
||||
@ -55,7 +55,7 @@ local function addVala(extended)
|
||||
|
||||
local myBrainHurts = false
|
||||
|
||||
local info = getProjectInfo(getCurrentProjectName())
|
||||
local info = auGetCurrentProjectMeta()
|
||||
if ((info.projectType:lower() == "sharedlib") or (extended.girFile)) then
|
||||
args = args .. " --library=" .. (extended.name or info.name)
|
||||
if (usingClang) then
|
||||
|
@ -1,23 +1,19 @@
|
||||
local jsonProcessor = auRequire("Core/Legacy/jsonProcessor")
|
||||
|
||||
-------------------------------------------------------
|
||||
-- globals
|
||||
-------------------------------------------------------
|
||||
_G["projectsprocessor"] = {}
|
||||
_G["projectsblocked"] = {}
|
||||
_G["projectsemitted"] = {}
|
||||
_G["namespacesemitted"] = {}
|
||||
_G["usingClang"] = false
|
||||
_G["usingMSVC"] = false
|
||||
_auProjects = {}
|
||||
_auProjectsBlocked = {}
|
||||
_auNamespacesEmitted = {}
|
||||
_auResolvedDep = {}
|
||||
_auCurrentProject = {}
|
||||
|
||||
-------------------------------------------------------
|
||||
-- process command line arguments into global space
|
||||
-- utils
|
||||
-------------------------------------------------------
|
||||
|
||||
-------------------------------------------------------
|
||||
-- API
|
||||
-------------------------------------------------------
|
||||
local jsonProcessor = require("jsonProcessor")
|
||||
|
||||
local normalizeSourceRoot = function(path)
|
||||
local function normalizeSourceRoot(path)
|
||||
local backup = path
|
||||
path = os.realpath(_G.path.join(os.getcwd(), path));
|
||||
if (not path) then
|
||||
@ -27,7 +23,7 @@ local normalizeSourceRoot = function(path)
|
||||
return path
|
||||
end
|
||||
|
||||
local extendInfo = function(this)
|
||||
local function extendInfo(this)
|
||||
local type = this.projectType:lower()
|
||||
this.isShared = type == "sharedlib"
|
||||
this.isStatic = type == "staticlib"
|
||||
@ -36,7 +32,11 @@ local extendInfo = function(this)
|
||||
this.isWindowed = type == "windowedapp"
|
||||
end
|
||||
|
||||
function addVisit(ina)
|
||||
-------------------------------------------------------
|
||||
-- project loading
|
||||
-------------------------------------------------------
|
||||
|
||||
local function addVisit(ina)
|
||||
local args = {
|
||||
namespace = ina.namespace,
|
||||
name = ina.name, -- OPT: recommended
|
||||
@ -94,10 +94,11 @@ function addVisit(ina)
|
||||
|
||||
auRequire("Core").project.expendBaseProcessor(project)
|
||||
|
||||
projectsprocessor[info.name] = project
|
||||
_auProjects[info.name] = project
|
||||
end
|
||||
|
||||
function addScript(ina)
|
||||
|
||||
local function addScript(ina)
|
||||
local args = {
|
||||
namespace = ina.namespace,
|
||||
script = ina.script,
|
||||
@ -145,32 +146,26 @@ function addScript(ina)
|
||||
return
|
||||
end
|
||||
|
||||
projectsprocessor[info.name] = project
|
||||
_auProjects[info.name] = project
|
||||
end
|
||||
|
||||
-- private
|
||||
local processLocalProject = function(proj)
|
||||
processProject(proj.info.name)
|
||||
local function processInit(project)
|
||||
if (project.isInitialized) then
|
||||
return
|
||||
end
|
||||
project.isInitialized = true
|
||||
|
||||
-- private
|
||||
local processInit = function(project)
|
||||
if (not project.isInitialized) then
|
||||
if (project.processor.init) then
|
||||
project.processor:init()
|
||||
end
|
||||
project.isInitialized = true
|
||||
end
|
||||
end
|
||||
|
||||
-- private
|
||||
_G["_resolved_dep_res"] = {}
|
||||
_G["_resolved_dep"] = {}
|
||||
function processDepSearch(proj, resolveProject)
|
||||
local function initializeDependencyTree(proj, resolveProject)
|
||||
local name = proj.info.name
|
||||
|
||||
|
||||
_G["_resolved_dep"][name] = name
|
||||
_auResolvedDep[name] = name
|
||||
|
||||
if (not proj.resolvedDeps) then
|
||||
if (proj.processor.resolveDependencies) then
|
||||
@ -178,11 +173,11 @@ function processDepSearch(proj, resolveProject)
|
||||
|
||||
table.insert(proj.deps, name)
|
||||
|
||||
if (_G["_resolved_dep"][name]) then
|
||||
if (_auResolvedDep[name]) then
|
||||
return
|
||||
end
|
||||
|
||||
local depProj = projectsprocessor[name]
|
||||
local depProj = _auProjects[name]
|
||||
if (not depProj) then
|
||||
if (not soft) then
|
||||
auFatal("missing dependency: ", name)
|
||||
@ -191,7 +186,7 @@ function processDepSearch(proj, resolveProject)
|
||||
end
|
||||
end
|
||||
|
||||
processDepSearch(depProj, true)
|
||||
initializeDependencyTree(depProj, true)
|
||||
end)
|
||||
end
|
||||
proj.resolvedDeps = true
|
||||
@ -200,12 +195,13 @@ function processDepSearch(proj, resolveProject)
|
||||
processInit(proj)
|
||||
end
|
||||
|
||||
local processProject = {}
|
||||
-- private
|
||||
local processNS = function(namespace)
|
||||
local function processNS(namespace)
|
||||
local projs = {}
|
||||
local projsIdxs = {}
|
||||
|
||||
auForEach(projectsprocessor, function(proj)
|
||||
auForEach(_auProjects, function(proj)
|
||||
if (proj.info.namespace ~= namespace) then
|
||||
return
|
||||
end
|
||||
@ -221,19 +217,19 @@ local processNS = function(namespace)
|
||||
end)
|
||||
|
||||
auForEach(projsIdxs, function(idx)
|
||||
processDepSearch(projs[idx], true)
|
||||
initializeDependencyTree(projs[idx], true)
|
||||
end)
|
||||
|
||||
auForEach(projsIdxs, function(idx)
|
||||
processLocalProject(projs[idx])
|
||||
processProject(projs[idx].info.name)
|
||||
end)
|
||||
end
|
||||
|
||||
function processSolution()
|
||||
local function processSolution()
|
||||
local hack = {}
|
||||
|
||||
local hackIdx = {}
|
||||
auForEach(projectsprocessor, function(proj)
|
||||
auForEach(_auProjects, function(proj)
|
||||
table.insert(hackIdx, proj.info.namespace)
|
||||
end)
|
||||
|
||||
@ -244,9 +240,9 @@ function processSolution()
|
||||
auForEach(hackIdx, processNS)
|
||||
end
|
||||
|
||||
function attemptNS(ns)
|
||||
local function attemptNS(ns)
|
||||
local attemptLoad = false
|
||||
if (not namespacesemitted[ns]) then
|
||||
if (not _auNamespacesEmitted[ns]) then
|
||||
auStartGroup(ns) -- only print the group once
|
||||
|
||||
attemptLoad = true
|
||||
@ -256,10 +252,8 @@ function attemptNS(ns)
|
||||
return attemptLoad
|
||||
end
|
||||
|
||||
resolved = {}
|
||||
|
||||
function processProject(name, required, noNs)
|
||||
local a = projectsprocessor[name]
|
||||
processProject = function(name, required, noNs)
|
||||
local a = _auProjects[name]
|
||||
if (not a) then
|
||||
if (required) then
|
||||
auFatal("missing project: ", name)
|
||||
@ -271,35 +265,32 @@ function processProject(name, required, noNs)
|
||||
-- ensure the project is initializd
|
||||
processInit(a)
|
||||
|
||||
-- legacy recursion
|
||||
if (projectsblocked[name]) then
|
||||
-- recursion protection
|
||||
if (_auProjectsBlocked[name]) then
|
||||
return true
|
||||
end
|
||||
_auProjectsBlocked[name] = name
|
||||
|
||||
projectsblocked[name] = name
|
||||
|
||||
-- process all within the namespace before processing the actual project
|
||||
-- process all within the namespace before processing the requested project
|
||||
local ns = a.info.namespace
|
||||
local loadOthers = attemptNS(ns)
|
||||
|
||||
-- {
|
||||
local cwd = os.getcwd()
|
||||
local old = _G["current_project"]
|
||||
local old = _auCurrentProject
|
||||
|
||||
_G["current_project"] = name
|
||||
_auCurrentProject = name
|
||||
os.chdir(a.info.path)
|
||||
|
||||
a.processor:process()
|
||||
|
||||
os.chdir(cwd)
|
||||
_G["current_project"] = old
|
||||
_auCurrentProject = old
|
||||
-- }
|
||||
|
||||
projectsemitted[name] = name
|
||||
|
||||
-- cont
|
||||
if (loadOthers) then
|
||||
namespacesemitted[ns] = "";
|
||||
_auNamespacesEmitted[ns] = "";
|
||||
processNS(ns)
|
||||
end
|
||||
|
||||
@ -307,16 +298,15 @@ function processProject(name, required, noNs)
|
||||
end
|
||||
|
||||
function isWeakCircularReference(depName)
|
||||
local curName = getCurrentProjectName()
|
||||
|
||||
local dep = projectsprocessor[depName]
|
||||
local dep = _auProjects[depName]
|
||||
if (not dep) then
|
||||
return
|
||||
end
|
||||
|
||||
-- TODO: recursion
|
||||
for index, value in ipairs(dep.deps) do
|
||||
if value == curName then
|
||||
print(value, _auCurrentProject)
|
||||
if value == _auCurrentProject then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -324,8 +314,8 @@ function isWeakCircularReference(depName)
|
||||
return false
|
||||
end
|
||||
|
||||
function isProjectLoaded(name)
|
||||
local a = projectsprocessor[name]
|
||||
local function isProjectLoaded(name)
|
||||
local a = _auProjects[name]
|
||||
if (not a) then
|
||||
return false
|
||||
end
|
||||
@ -333,106 +323,58 @@ function isProjectLoaded(name)
|
||||
return a.isInitialized
|
||||
end
|
||||
|
||||
function getProjectInfo(name)
|
||||
local function getProjectProcessor(name)
|
||||
if (not name) then
|
||||
return
|
||||
end
|
||||
local scre = projectsprocessor[name]
|
||||
if (not scre) then
|
||||
return
|
||||
end
|
||||
return scre.info
|
||||
end
|
||||
|
||||
function getProjectProcessor(name)
|
||||
if (not name) then
|
||||
return
|
||||
end
|
||||
local scre = projectsprocessor[name]
|
||||
local scre = _auProjects[name]
|
||||
if (not scre) then
|
||||
return
|
||||
end
|
||||
return scre.processor
|
||||
end
|
||||
|
||||
function getCurrentProjectName()
|
||||
return current_project
|
||||
local function getProjectProcessorOrThrow(name)
|
||||
local ret = getProjectProcessor(name)
|
||||
|
||||
if (not ret) then
|
||||
auFatal("Missing project", name)
|
||||
end
|
||||
|
||||
function importAndLinkProject(dep, soft)
|
||||
local proj = _G["projectsprocessor"][dep]
|
||||
if (not proj) then
|
||||
if (soft) then
|
||||
return false
|
||||
end
|
||||
auFatal("Missing project", dep)
|
||||
return ret
|
||||
end
|
||||
|
||||
local iface = proj.processor
|
||||
if (not isProjectLoaded(dep)) then
|
||||
if (soft) then
|
||||
return false
|
||||
end
|
||||
auFatal("missing project: ", dep)
|
||||
local function getCurrentProjectName()
|
||||
return _auCurrentProject
|
||||
end
|
||||
|
||||
local circular = isWeakCircularReference(dep)
|
||||
iface:handleReference(isWeakCircularReference(dep))
|
||||
if (getProjectInfo(getCurrentProjectName()).isStatic) then
|
||||
local function importAndLinkProject(dep, soft)
|
||||
local processor = getProjectProcessorOrThrow(dep)
|
||||
|
||||
processor:handleReference(isWeakCircularReference(dep))
|
||||
|
||||
if (auGetCurrentProjectMeta().isStatic) then
|
||||
return true
|
||||
end
|
||||
processor:handleLink()
|
||||
return true
|
||||
end
|
||||
|
||||
iface:handleLink()
|
||||
local function includeAuProject(dep, soft)
|
||||
local processor = getProjectProcessorOrThrow(dep)
|
||||
processor:handleReference()
|
||||
return true
|
||||
end
|
||||
|
||||
function includeAuProject(dep, soft)
|
||||
local proj = _G["projectsprocessor"][dep]
|
||||
|
||||
if (not proj) then
|
||||
if (soft) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local iface = proj.processor
|
||||
if (not isProjectLoaded(dep)) then
|
||||
if (soft) then
|
||||
return false
|
||||
end
|
||||
auFatal("missing project: ", dep)
|
||||
end
|
||||
|
||||
iface:handleReference()
|
||||
return true
|
||||
end
|
||||
|
||||
function linkAuProject(dep, soft)
|
||||
local proj = _G["projectsprocessor"][dep]
|
||||
if (not proj) then
|
||||
if (soft) then
|
||||
return false
|
||||
end
|
||||
auFatal("Missing project", dep)
|
||||
end
|
||||
|
||||
local processor = proj.processor
|
||||
if (not isProjectLoaded(dep)) then
|
||||
if (soft) then
|
||||
return false
|
||||
end
|
||||
auFatal("missing project: ", dep)
|
||||
end
|
||||
|
||||
local function linkAuProject(dep, soft)
|
||||
local processor = getProjectProcessorOrThrow(dep)
|
||||
if (not processor:getMeta().isStatic) then
|
||||
processor:handleLink()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
-- executes inline under iprocessor::process
|
||||
function addFeature(feature)
|
||||
local function addFeature(feature)
|
||||
print("adding feature ", feature)
|
||||
local script = auGetRoot() .. "/Build_Scripts/Features/" .. feature:lower() .. ".lua"
|
||||
|
||||
@ -443,3 +385,16 @@ function addFeature(feature)
|
||||
|
||||
auRequireAbs(script)()
|
||||
end
|
||||
|
||||
return {
|
||||
addVisit = addVisit,
|
||||
addScript = addScript,
|
||||
addFeature = addFeature,
|
||||
linkAuProject = linkAuProject,
|
||||
includeAuProject = includeAuProject,
|
||||
importAndLinkProject = importAndLinkProject,
|
||||
getProjectProcessor = getProjectProcessor,
|
||||
isProjectLoaded = isProjectLoaded,
|
||||
getCurrentProjectName = getCurrentProjectName,
|
||||
processSolution = processSolution
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
-- private
|
||||
local buildAction = auRequire("Core/Actions")
|
||||
local target = auRequire("Core/Target")
|
||||
local main = auRequire("Core/Main")
|
||||
|
||||
-- executes inline under iprocessor::process
|
||||
function auAddBuildAction(...)
|
||||
@ -33,6 +34,10 @@ function auStartProject(project)
|
||||
auRequire("Core").project.startProject(project)
|
||||
end
|
||||
|
||||
function auProcessSolution()
|
||||
main.processSolution()
|
||||
end
|
||||
|
||||
function auFilterForPlatforms(callback, ...)
|
||||
target.auFilterForPlatforms(callback, ...)
|
||||
end
|
||||
@ -46,7 +51,7 @@ function auFilterForConfigPlatforms(callback, ...)
|
||||
end
|
||||
|
||||
function auAddVisit(...)
|
||||
addVisit(...)
|
||||
main.addVisit(...)
|
||||
end
|
||||
|
||||
-- Returns an array of filter tables where each optional table is checked against the current combination of config/platform/arch
|
||||
@ -91,27 +96,39 @@ function auFilter(filter)
|
||||
end
|
||||
|
||||
function auLinkProject(...)
|
||||
linkAuProject(...)
|
||||
main.linkAuProject(...)
|
||||
end
|
||||
|
||||
function auIncludeProject(...)
|
||||
includeAuProject(...)
|
||||
main.includeAuProject(...)
|
||||
end
|
||||
|
||||
function auLinkAndRefProject(...)
|
||||
importAndLinkProject(...)
|
||||
main.importAndLinkProject(...)
|
||||
end
|
||||
|
||||
function auAddFeature(...)
|
||||
addFeature(...)
|
||||
main.addFeature(...)
|
||||
end
|
||||
|
||||
function auGetCurrentProject()
|
||||
return getCurrentProjectName()
|
||||
return main.getCurrentProjectName()
|
||||
end
|
||||
|
||||
function auGetProjectProcessor(name)
|
||||
return main.getProjectProcessor(name)
|
||||
end
|
||||
|
||||
function auGetProjectMeta(name)
|
||||
local processor = auGetProjectProcessor(name)
|
||||
if (not processor) then
|
||||
return
|
||||
end
|
||||
return processor:getMeta()
|
||||
end
|
||||
|
||||
function auGetCurrentProjectProcessor()
|
||||
return getProjectProcessor(auGetCurrentProject())
|
||||
return main.getProjectProcessor(auGetCurrentProject())
|
||||
end
|
||||
|
||||
function auGetCurrentProjectMeta()
|
||||
@ -119,9 +136,5 @@ function auGetCurrentProjectMeta()
|
||||
end
|
||||
|
||||
function auIsProjectIntialized(name)
|
||||
return isProjectLoaded(name)
|
||||
end
|
||||
|
||||
function auProcessSolution()
|
||||
processSolution()
|
||||
return main.isProjectLoaded(name)
|
||||
end
|
@ -1,7 +1,5 @@
|
||||
-- If this is your entrypoint, you should consider starting premake from the public/global directory
|
||||
|
||||
|
||||
|
||||
-- Developers should look to the public/global directory for the user facing API
|
||||
require("Public.base")
|
||||
|
||||
@ -11,6 +9,3 @@ function startSolution(name)
|
||||
name = name
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
require("Core.Legacy.aurora")
|
Loading…
Reference in New Issue
Block a user