[*] i really cant be arsed anymore

This commit is contained in:
Reece Wilson 2024-11-02 21:27:49 +00:00
parent f28545cabd
commit 68649ebb5d
2 changed files with 59 additions and 7 deletions

View File

@ -1,4 +1,5 @@
local kPathPrefix = "!"
local kOldMode = false
local function processJson(meta, object, result)
auMergeTable(object,
@ -72,6 +73,7 @@ local function processProject(meta, object)
args = args .. ' --sourceMap'
args = args .. ' --declarationMap'
args = args .. ' --inlineSources'
args = args .. ' --resolveJsonModule'
args = args .. ' --module ' .. object.module
args = args .. ' --moduleDetection ' .. object.moduleDetection
args = args .. ' --sourceRoot \"' .. rootdir .. "\""
@ -149,9 +151,11 @@ local function processProject(meta, object)
table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "*."))
end)
auAddBuildAction("pre", "cmd", "tsc", false, args)
if (kOldMode) then
auAddBuildAction("pre", "cmd", "tsc", false, args)
else
auAddBuildAction("pre", "cmd", "tsc", false, "--project \"" .. rootdir .. "\"")
end
local requiredDirs = {}
local requiredCopies = {}
@ -167,6 +171,8 @@ local function processProject(meta, object)
mkdir = "mkdir -p \"PATH\"";
end
local primarySourceList = {}
local primaryTypeList = {}
if (object.bundle) then
else
@ -193,6 +199,8 @@ local function processProject(meta, object)
local dbg2p = part .. ".d.ts.map"
if (not isD) then
table.insert(primarySourceList, part)
auForEach(meta.out, function(dest)
if (dest:starts(kPathPrefix)) then
dest = Aurora.Settings.sAbsWd .. dest:sub(#kPathPrefix + 1)
@ -222,6 +230,8 @@ local function processProject(meta, object)
path.translate(path.normalize(path.join(compilerPath, link)), path.getDefaultSeparator()),
path.translate(path.normalize(path.join(linkPath, link2)), path.getDefaultSeparator()), pathSuffix))
else
table.insert(primaryTypeList, part)
prebuildcommands(string.format("{COPY} \"%s\" \"%s%s",
file,
path.translate(path.normalize(path.join(linkPath, link2)), path.getDefaultSeparator()), pathSuffix))
@ -233,18 +243,58 @@ local function processProject(meta, object)
local compilerOptions = {}
auMergeTable(compilerOptions, object.flags)
if (not kOldMode) then
table.remove(typeDirs, 1)
end
compilerOptions.typeRoots = typeDirs
compilerOptions.target = object.targetVersion
compilerOptions.module = object.module
compilerOptions.moduleDetection = object.moduleDetection
if (not kOldMode) then
if (object.bundle) then
compilerOptions.outFile = path.normalize(path.join(compilerPath, meta.name)) .. ".js"
end
compilerOptions.declaration = true
compilerOptions.moduleDetection = object.moduleDetection
compilerOptions.resolveJsonModule = true
compilerOptions.inlineSources = true
compilerOptions.declarationMap = true
compilerOptions.sourceMap = true
compilerOptions.sourceRoot = rootdir
compilerOptions.mapRoot = path.normalize(symPath)
compilerOptions.rootDir = rootdir
compilerOptions.outDir = compilerPath
compilerOptions.moduleResolution = "classic"
end
local IDE = {
autogeneratedfile = "DO NOT MODIFY OR ATTEMPT TO COMPILE. IDE LINT, TOOLTIP, AND AUTOCOMPLETE USAGE ONLY",
--autogeneratedfile = "DO NOT MODIFY OR ATTEMPT TO COMPILE. IDE LINT, TOOLTIP, AND AUTOCOMPLETE USAGE ONLY",
include = auMergeArray(ew3, ew2),
compilerOptions = compilerOptions
}
io.writefile("tsconfig.json", json.encode(IDE, 4))
local extended = {
base = IDE,
files = object.files,
out = meta.out,
typeSources = ew3,
expandedSources = ew2,
settings = Aurora.Settings,
dependsNoSource = object.depends2,
dependsWithSource = object.depends,
primarySourceList = primarySourceList,
primaryTypeList = primaryTypeList
}
io.writefile("tsconfig.json", json.encode_pretty(IDE))
if (Aurora.Settings.bWantExtendedTSConfig) then
io.writefile("tsconfig.extended.json", json.encode_pretty(extended))
end
files "tsconfig.json"
end
end

View File

@ -126,6 +126,8 @@ auSetDefault(settings, "bForceWin32EscLd", true)
auSetDefault(settings, "bActionsIncludeFull", false)
auSetDefault(settings, "bWantExtendedTSConfig", true)
-- Premake5 binary name to look for when when tied into cmake. Used by build actions and other lua scripted features
auSetDefault(settings, "sDefaultCmakePremakeBin", "premake5")