[*] Update protobuf support / automatic include reference

[*] Update TS support (more effort required)
This commit is contained in:
Reece Wilson 2022-06-23 16:53:39 +01:00
parent d551cda998
commit 0491620ee1
4 changed files with 46 additions and 9 deletions

View File

@ -407,6 +407,10 @@ local function auBlockProjectRefKeyDepends(processor, value, taskMap, taskArray,
end, true)
end
local function auBlockProjectRefKeyProtobuf(processor, value, taskMap, taskArray, inc, resolve)
auProtobufIncludeProject(processor:getMeta().name)
end
local function auBlockProjectRefKeySoftDepends(processor, value, taskMap, taskArray, inc, resolve)
filterForKey(value, "value", function(obj)
resolve(processor:translateDep(obj), true)
@ -496,6 +500,7 @@ auProjectRefHandlers["soft-depends"] = auBlockProjectRefKeySoftDepends
auProjectRefHandlers["include-soft-depends"] = auBlockProjectRefKeyInclSoftDepends
auProjectRefHandlers["include-depends"] = auBlockProjectRefKeyInclDepends
auProjectRefHandlers["depends"] = auBlockProjectRefKeyDepends
auProjectRefHandlers["protobuf"] = auBlockProjectRefKeyProtobuf
kGenericTasks = {
"sourcePaths", "includes","include", "sources", "clangIgnore",
@ -507,7 +512,7 @@ kGenericTasks = {
"bigObject"
}
local kReferenceTasks = {"eval", "includes", "include", "includes"} --, "features"}
local kReferenceTasks = {"eval", "includes", "include", "includes", "protobuf"} --, "features"}
-- , "include-depends", "include-soft-depends"
__pRunTasks = function(processor, object, map, tasks, inc, resolve)

View File

@ -14,7 +14,7 @@ local function processJson(meta, object, result)
object.targetVersion = result.target or "esnext"
object.module = result.moduleLoader or "esnext"
object.base = result.base or "Source"
object.base = result.base
object.exportIDE = result.exportIDE
object.bundle = result.bundle
object.typeDirs = result.typeDirs
@ -22,15 +22,25 @@ local function processJson(meta, object, result)
object.depends = result.depends
object.removeComments = result.removeComments
object.flags = result.flags or {}
if (not object.base) then
if (os.isdir("Source")) then
object.base = "Source"
else
object.base = path.normalize(os.getcwd())
end
end
end
local function processProject(meta, object)
object.files = os.matchfiles(object.sources)
object.files = auMap(object.files, os.realpath)
files(object.files)
object.typeDirs = auMap(object.typeDirs, os.realpath)
local path = _G.path
local compilerPath = path.join(Aurora.Settings.sAbsCompilerWd, "Typescript")
os.mkdir(compilerPath)
@ -65,6 +75,10 @@ local function processProject(meta, object)
args = args .. ' --rootDir \"' .. rootdir .. "\""
args = args .. ' --outDir \"' .. path.normalize(compilerPath) .. "\""
auForEach(object.flags, function(flag)
args = args .. ' --' .. flag
end)
if (object.bundle) then
args = args .. ' --outFile \"' .. path.normalize(path.join(compilerPath, meta.name)) .. ".js\""
end

View File

@ -1,6 +1,5 @@
local function addProtobufFiles(files)
local projName = auGetCurrentProject()
local proj = auGetCurrentProjectMeta()
local function getPath(projName)
local proj = auGetProjectMeta(projName)
local basePath = Aurora.Settings.sAbsRoot
@ -20,6 +19,13 @@ local function addProtobufFiles(files)
os.mkdir(baseProto)
os.mkdir(targetBase)
return targetBase, basePath
end
local function addProtobufFiles(files)
local targetBase, basePath = getPath(auGetCurrentProject())
files = os.matchfiles(files)
local compiledFiles = auMap(files, function(file)
local rel = path.getrelative(basePath, file)
return path.join(targetBase, rel:sub(1, #rel - 6)) .. ".pb.cc"
@ -31,4 +37,12 @@ local function addProtobufFiles(files)
auAddResource(files, {targetBase = targetBase, basePath = basePath}, path.join(Aurora.Settings.sAbsScripts, "Core", "Protobuf", "run.lua"))
end
return addProtobufFiles
local function includeProtobuf(projName)
local targetBase, basePath = getPath(projName)
includedirs(targetBase)
end
return {
addProtobufFiles = addProtobufFiles,
linkProject = includeProtobuf
}

View File

@ -159,7 +159,11 @@ function auAddResource(...)
end
function auProtobufFiles(files)
protobuf(files)
protobuf.addProtobufFiles(files)
end
function auProtobufIncludeProject(projectName)
protobuf.linkProject(projectName)
end
function auAddVala(info)