Begin deprecating jsonProcessor.lua
[*] Move M4 and unpack [*] Move funcs out of Utilities.lua
This commit is contained in:
parent
3b4d6cccf2
commit
252f239f69
@ -352,6 +352,31 @@ local function auBlockProjectKeyVala(processor, value)
|
||||
end, false)
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyUnpack(processor, value)
|
||||
__pushFilter(value, "files", function(fileName)
|
||||
local referencePath = path.join(Aurora.Settings.sAbsRepoScripts, fileName)
|
||||
local destinationPath = path.join(processor:getMeta().path, fileName)
|
||||
|
||||
if (not os.isfile(destinationPath)) then
|
||||
os.copyfile(referencePath, destinationPath)
|
||||
end
|
||||
end, true)
|
||||
end
|
||||
|
||||
local function auBlockProjectKeyM4(processor, value)
|
||||
processor.m4_files = processor.m4_files or {}
|
||||
__pushFilter(value, nil, function(obj)
|
||||
for fk, fv in pairs(obj) do
|
||||
local fileTbl = info.m4_files[fk] or {}
|
||||
info.m4_files[fk] = fileTbl
|
||||
|
||||
for k, v in pairs(fv) do
|
||||
fileTbl[k] = v
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
end
|
||||
|
||||
local function auBlockProjectKeySoftDepends(processor, value)
|
||||
__pushFilter(value, "value", function(obj)
|
||||
handleDepends(processor, obj, true)
|
||||
@ -431,7 +456,9 @@ auProjectBlockHandlers =
|
||||
features = auBlockKeyFeature,
|
||||
resourceScript = auBlockProjectKeyResourceScript,
|
||||
protobuf = auBlockProjectKeyProtobuf,
|
||||
vala = auBlockProjectKeyVala
|
||||
vala = auBlockProjectKeyVala,
|
||||
unpack = auBlockProjectKeyUnpack,
|
||||
m4 = auBlockProjectKeyM4
|
||||
}
|
||||
|
||||
auProjectBlockHandlers["soft-depends"] = auBlockProjectKeySoftDepends
|
||||
@ -460,7 +487,7 @@ auProjectRefHandlers["depends"] = auBlockProjectRefKeyDepends
|
||||
"impInclude", "implInclude", "impIncludes", "implIncludes", "clangIgnore",
|
||||
"msvcIgnore", "excludes", "depends", "require",
|
||||
"eval", "lua", "events", "actions", "staticImpDefines", "features",
|
||||
"links", "soft-depends", "resourceScript", "protobuf", "vala"
|
||||
"links", "soft-depends", "resourceScript", "protobuf", "vala", "unpack", "m4"
|
||||
}
|
||||
|
||||
local kReferenceTasks = {"eval", "includes", "include", "includes"} --, "features"}
|
||||
@ -476,6 +503,10 @@ __pRunTasks = function(processor, object, map, tasks, inc, resolve)
|
||||
end)
|
||||
end
|
||||
|
||||
local function postRunMain(processor)
|
||||
-- TODO: m4
|
||||
end
|
||||
|
||||
local function __pRunLinkTasks(processor, object, resolve)
|
||||
__pRunTasks(processor, object, auProjectRefHandlers, { "links", "depends", "soft-depends", "eval", "linkDepends", "defines", "actions"}, false, resolve)
|
||||
end
|
||||
@ -514,6 +545,7 @@ local function __pRunMainTasks(processor, object)
|
||||
if (not object.noRootInclude) then
|
||||
_includeDirectoryEx(processor:getMeta().path, isIncludeLocalProject)
|
||||
end
|
||||
postRunMain(processor)
|
||||
end
|
||||
|
||||
return auCopyTables(auProjectHeaderHandlers, auProjectBlockHandlers, {
|
||||
|
@ -139,22 +139,6 @@ function JsonProcessor(info)
|
||||
|
||||
local isUtility = false
|
||||
|
||||
info.copy_build_files = {}
|
||||
|
||||
local function runCopies(prefix, rootPath, name)
|
||||
local referenceRoot = auGetRoot() .. Aurora.Settings.sRelRepoScripts .. "/" .. name .. "/"
|
||||
local referencePath = referenceRoot .. prefix
|
||||
local copyRoot = rootPath .. "/" .. prefix
|
||||
|
||||
info.copy_build_files[_G.path.getrelative(referencePath, path)] = prefix
|
||||
|
||||
if (not os.isfile(copyRoot)) then
|
||||
os.copyfile(referencePath, copyRoot)
|
||||
end
|
||||
end
|
||||
|
||||
auForEach(result.unpack, runCopies, info.path, info.name)
|
||||
|
||||
local prj_ = {
|
||||
name = info.name,
|
||||
projectType = info.projectType or result.projectType,
|
||||
@ -208,29 +192,8 @@ function JsonProcessor(info)
|
||||
|
||||
handleInclude(a, true)
|
||||
|
||||
info.m4_files = {}
|
||||
|
||||
local addM4Defines = function(obj)
|
||||
if (not obj) then return end
|
||||
for fk, fv in pairs(obj) do
|
||||
local fileTbl = info.m4_files[fk] or {}
|
||||
info.m4_files[fk] = fileTbl
|
||||
|
||||
for k, v in pairs(fv) do
|
||||
fileTbl[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local processJsonBlock = function(object)
|
||||
auRequire("Core/JSON/JSON").projectHandlers.runProjectBlock(a, object)
|
||||
|
||||
auForEach(object.unpack, runCopies, info.path, info.name)
|
||||
addM4Defines(object.m4Defines)
|
||||
end
|
||||
|
||||
if (not isUtility) then
|
||||
processJsonBlock(result)
|
||||
auRequire("Core/JSON/JSON").projectHandlers.runProjectBlock(a, result)
|
||||
|
||||
if (a.info.projectType:lower() == "sharedlib") then
|
||||
auForEach(result.dllexport, defines)
|
||||
@ -239,18 +202,16 @@ function JsonProcessor(info)
|
||||
end
|
||||
|
||||
auForEach(result.subprojs, function(subproj)
|
||||
|
||||
local subinfo = {
|
||||
namespace = info.namespace,
|
||||
path = info.path .. "/" .. subproj.path,
|
||||
path = path.join(info.path, subproj.path),
|
||||
projectType = subproj.projectType,
|
||||
out = info.out,
|
||||
name = nil,
|
||||
translations = info.translations
|
||||
name = subproj.name,
|
||||
translations = auCopyTables(info.translations, subproj.translations)
|
||||
}
|
||||
|
||||
addVist(subinfo)
|
||||
|
||||
auAddVist(subinfo)
|
||||
end)
|
||||
|
||||
local interface = {}
|
||||
|
@ -12,18 +12,3 @@ require("./requireAbs")
|
||||
require("./merge")
|
||||
require("./settings")
|
||||
require("./contains")
|
||||
|
||||
function table.copy(t)
|
||||
local u = { }
|
||||
for k, v in pairs(t) do u[k] = v end
|
||||
--setmetatable(u, getmetatable(t))
|
||||
return u
|
||||
end
|
||||
|
||||
function auMap(array, func)
|
||||
local tbl = {}
|
||||
auForEach(array, function(value)
|
||||
table.insert(tbl, func(value))
|
||||
end)
|
||||
return tbl
|
||||
end
|
@ -12,8 +12,10 @@ function auCopyTables(...)
|
||||
local args = table.pack(...)
|
||||
for i=1, args.n do
|
||||
local tbl = args[i]
|
||||
if (tbl) then
|
||||
auForEachKV(tbl, function(key, value) dest[key] = value end)
|
||||
end
|
||||
end
|
||||
return dest
|
||||
end
|
||||
|
||||
@ -25,3 +27,18 @@ function auMergeArray(dest, src)
|
||||
end)
|
||||
return dest
|
||||
end
|
||||
|
||||
function table.copy(t)
|
||||
local u = { }
|
||||
for k, v in pairs(t) do u[k] = v end
|
||||
--setmetatable(u, getmetatable(t))
|
||||
return u
|
||||
end
|
||||
|
||||
function auMap(array, func)
|
||||
local tbl = {}
|
||||
auForEach(array, function(value)
|
||||
table.insert(tbl, func(value))
|
||||
end)
|
||||
return tbl
|
||||
end
|
Loading…
Reference in New Issue
Block a user