From 4f34946f1ddc097b7012319cfea5c3e83abe52b7 Mon Sep 17 00:00:00 2001 From: Reece Wilson Date: Sun, 5 Mar 2023 20:38:25 +0000 Subject: [PATCH] [*] updated tsc support --- Core/JSON/jsonProjectHandlers.lua | 11 ++++++- Core/OtherLang/TS/TS.lua | 55 +++++++++++++++++++++++++++---- Core/solution.lua | 6 +++- Public/settings.lua | 5 +++ 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/Core/JSON/jsonProjectHandlers.lua b/Core/JSON/jsonProjectHandlers.lua index fecc7b3..679b2cb 100644 --- a/Core/JSON/jsonProjectHandlers.lua +++ b/Core/JSON/jsonProjectHandlers.lua @@ -437,6 +437,14 @@ local function auBlockProjectKeyBigObject(processor, value) end) end +local function auBlockProjectKeyBigRtti(processor, value) + if (value) then + rtti "On" + else + rtti "Off" + end +end + local auProjectHeaderHandlers = { linkDepends = auHeaderProjectKeyLinkDepends, @@ -480,7 +488,8 @@ auProjectBlockHandlers = vala = auBlockProjectKeyVala, unpack = auBlockProjectKeyUnpack, m4 = auBlockProjectKeyM4, - bigObject = auBlockProjectKeyBigObject + bigObject = auBlockProjectKeyBigObject, + rtti = auBlockProjectKeyRtti } auProjectBlockHandlers["soft-depends"] = auBlockProjectKeySoftDepends diff --git a/Core/OtherLang/TS/TS.lua b/Core/OtherLang/TS/TS.lua index 5bf21d5..0ba06a5 100644 --- a/Core/OtherLang/TS/TS.lua +++ b/Core/OtherLang/TS/TS.lua @@ -14,12 +14,14 @@ local function processJson(meta, object, result) object.targetVersion = result.target or "esnext" object.module = result.moduleLoader or "esnext" + object.moduleDetection = result.moduleDetection or "force" object.base = result.base object.exportIDE = result.exportIDE object.bundle = result.bundle object.typeDirs = result.typeDirs object.sources = result.sources object.depends = result.depends + object.depends2 = result.depends2 object.removeComments = result.removeComments object.flags = result.flags or {} @@ -70,6 +72,8 @@ local function processProject(meta, object) args = args .. ' --sourceMap' args = args .. ' --declarationMap' args = args .. ' --inlineSources' + args = args .. ' --module ' .. object.module + args = args .. ' --moduleDetection ' .. object.moduleDetection args = args .. ' --sourceRoot \"' .. rootdir .. "\"" args = args .. ' --mapRoot \"' .. path.normalize(symPath) .. "\"" args = args .. ' --rootDir \"' .. rootdir .. "\"" @@ -91,18 +95,53 @@ local function processProject(meta, object) end local typeDirs = {} - if (object.depends) then + + if (object.depends ) then + auForEach(object.depends, function(dependency) + local typeDir = path.normalize(path.join(linkPath2, dependency)) + table.insert(typeDirs, typeDir) + end) + end + + if (object.depends2) then + auForEach(object.depends2, function(dependency) + local typeDir = path.normalize(path.join(linkPath2, dependency)) + table.insert(typeDirs, typeDir) + end) + end + + + local ew = "" + local ew2 = {} + + if (object.depends or object.depends2) then args = args .. ' --typeRoots "' - auForEach(object.depends, function(dependency) - local typeDir = path.join(linkPath2, dependency) - table.insert(typeDirs, typeDir) - args = args .. typeDir .. "," + auForEach(typeDirs, function(dependency) + args = args .. path.normalize(dependency) .. "\",\"" + + table.insert(ew2, dependency .. "/**/*.d.ts") + table.insert(ew2, dependency .. "/*.d.ts") + + auForEach(os.matchfiles(dependency .. "/**.d.ts"), function(file) + ew = ew .. " \"" .. file .. "\"" + end) + end) args = args .. '"' + args = args .. ew end + args = args:gsub(",\"\"", "") + + local ew3 = {} + + auForEach(object.sources, function(func) + table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "**/*.")) + table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "*.")) + end) + auAddBuildAction("pre", "cmd", "tsc", false, args) @@ -177,14 +216,16 @@ local function processProject(meta, object) auMergeTable(compilerOptions, object.flags) compilerOptions.typeRoots = typeDirs compilerOptions.target = object.targetVersion + compilerOptions.module = object.module + compilerOptions.moduleDetection = object.moduleDetection local IDE = { autogeneratedfile = "DO NOT MODIFY OR ATTEMPT TO COMPILE. IDE LINT, TOOLTIP, AND AUTOCOMPLETE USAGE ONLY", - files = object.files, + include = auMergeArray(ew3, ew2), compilerOptions = compilerOptions } - io.writefile("tsconfig.json", json.encode(IDE)) + io.writefile("tsconfig.json", json.encode(IDE, 4)) files "tsconfig.json" end end diff --git a/Core/solution.lua b/Core/solution.lua index de1d96f..b4e3009 100644 --- a/Core/solution.lua +++ b/Core/solution.lua @@ -36,7 +36,11 @@ local function auStartSolution(sln) "MultiProcessorCompile" } end - + + if (Aurora.Settings.bLTO) then + flags "LinkTimeOptimization" + end + auFilterForPlatforms(function(platform) if (platform == "win32") then if (not Aurora.Settings.bForceClangWin32) then diff --git a/Public/settings.lua b/Public/settings.lua index 0b47052..d04c546 100644 --- a/Public/settings.lua +++ b/Public/settings.lua @@ -94,8 +94,13 @@ auSetDefault(settings, "bDefinePartialABIInTargetName", true) auSetDefault(settings, "bStaticRuntime", true) +-- +auSetDefault(settings, "bLTO", false) + +-- auSetDefault(settings, "bEditAndCont", false) +-- auSetDefault(settings, "bSplitTargetDirByArch", false)