From cf1146839c1fe3dded2fd189b5d575423575cce6 Mon Sep 17 00:00:00 2001 From: Reece Date: Fri, 18 Feb 2022 09:08:35 +0000 Subject: [PATCH] [+] Added alt platform name stylization [*] Fix 2x crashes and lock when importing au projects from external pipelines --- Core/BuildHooks/BuildHooks.lua | 13 +++++++++---- Core/Target/Target.lua | 14 ++++++++++++++ Core/Target/platform.lua | 2 ++ Core/main.lua | 17 ++++++++++++----- Core/project.lua | 5 +++-- Public/api.lua | 2 ++ 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Core/BuildHooks/BuildHooks.lua b/Core/BuildHooks/BuildHooks.lua index 6fdb5d5..ff2f9b1 100644 --- a/Core/BuildHooks/BuildHooks.lua +++ b/Core/BuildHooks/BuildHooks.lua @@ -1,7 +1,7 @@ local kPathPrefix = "!" local function normalizeCpyPath(absPath) - return "../../" .. path.getrelative(Aurora.Settings.sAbsRoot, absPath) + return absPath -- path.getrelative(os.getcwd(), Aurora.Settings.sAbsRoot) .. '/' .. path.getrelative(Aurora.Settings.sAbsRoot, absPath) end -- file name, type, directory, extension, is windows, configuration, real name @@ -14,8 +14,13 @@ local function formatCpy(name, type, dir, ex, iswin, config, platformName, arch, pathSuffix = "\""; end + local platform = Aurora.Platforms[platformName] + if (platform) then + platformName = platform.outputName + end + if (Aurora.Settings.bDefinePartialABIInTargetName) then - name = string.format("%s.%s.%s.%s", name, config, platformName:gsub("^%l", string.upper), arch) + name = string.format("%s.%s.%s.%s", name, config, platformName, arch) end local outputPath = string.format("%s/%s%s", dir, name, ex) @@ -103,13 +108,13 @@ local function postBuildCommands(name, type, config, platformName, arch) if (type == "SharedLib" or type == "StaticLib") then - postbuildcommands(formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sRelLinkLibs), ".lib", true, config, platformName, arch, name)) + postbuildcommands(formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sAbsLinkLibs), ".lib", true, config, platformName, arch, name)) end else if (type == "SharedLib" or type == "StaticLib") then local ext = (auFetchGlobal("Platforms")[platformName][type] or "") - postbuildcommands(formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sRelLinkLibs), ext, true, config, platformName, arch, name)) + postbuildcommands(formatCpy(Aurora.Settings.sLibPrefix .. name, type, normalizeCpyPath(Aurora.Settings.sAbsLinkLibs), ext, true, config, platformName, arch, name)) end end diff --git a/Core/Target/Target.lua b/Core/Target/Target.lua index 6986f08..9be28ec 100644 --- a/Core/Target/Target.lua +++ b/Core/Target/Target.lua @@ -27,6 +27,20 @@ local function start() addTarget("target", Aurora.Platforms, _auCurrentPlatforms) addTarget("target", Aurora.Architectures, _auCurrentArchs) addTarget("flag", Aurora.Flags, _auCurrentFlags) + + auForEach(_auCurrentPlatforms, function(platformName) + local name = nil + local alt = Aurora.Platforms[platformName].stylizedName + + if (alt) then + name = alt + else + name = platformName:gsub("^%l", string.upper) + end + + Aurora.Platforms[platformName].outputName = name + end) + _auExtendedArch = #_auCurrentArchs > 1 end diff --git a/Core/Target/platform.lua b/Core/Target/platform.lua index 39b0f31..29afbc9 100644 --- a/Core/Target/platform.lua +++ b/Core/Target/platform.lua @@ -11,6 +11,7 @@ local platforms = { freebsd = { targetLocal = true, forceLLVMStl = true, + stylizedName = "BSD", devChainRequiresElfStrip = true, devChainSupportsElfStrip = true, devChainCoreUtils = true, @@ -44,6 +45,7 @@ local platforms = { }, ios = { devChainCoreUtils = true, + stylizedName = "iOS", defines = "_APPLE_MOBILE_AURORA_PREPROCESSOR" }, android = { diff --git a/Core/main.lua b/Core/main.lua index 864cba3..2cd5923 100644 --- a/Core/main.lua +++ b/Core/main.lua @@ -432,10 +432,14 @@ local function linkAuProject(dep, soft) end end - if (_auLinkGuard[dep] ) then - return + if (auGetCurrentProjectMeta()) then + if (_auLinkGuard[dep] ) then + return + end + _auLinkGuard[dep] = dep end - _auLinkGuard[dep] = dep + + dependson(dep) --if (not processor:getMeta().isStatic) then pushProject(a, function() @@ -452,8 +456,11 @@ local function importAndLinkProject(dep, soft) includeAuProject(dep, soft) - if (auGetCurrentProjectMeta().isStatic) then - return true + local this = auGetCurrentProjectMeta() + if (this) then + if (this.isStatic) then + return true + end end linkAuProject(dep, soft) diff --git a/Core/project.lua b/Core/project.lua index 30dc192..6231048 100644 --- a/Core/project.lua +++ b/Core/project.lua @@ -36,12 +36,13 @@ local function configureProjectForSolution(prj) filter {} auFilterForConfigPlatforms(function(config, platformName, arch) + local platform = Aurora.Platforms[platformName] + if (Aurora.Settings.bDefinePartialABIInTargetName) then - targetname(string.format("%s.%s.%s.%s", prj.name, config, platformName:gsub("^%l", string.upper), arch)) + targetname(string.format("%s.%s.%s.%s", prj.name, config, platform.outputName, arch)) end if (not(config == Aurora.Settings.sNameOfShip)) then return end - local platform = Aurora.Platforms[platformName] if (platform.requiresElfStrip and not platform.supportsElfStrip) then symbols "Off" diff --git a/Public/api.lua b/Public/api.lua index b60000d..c18efde 100644 --- a/Public/api.lua +++ b/Public/api.lua @@ -142,6 +142,8 @@ function auGetCurrentProjectProcessor() end function auGetCurrentProjectMeta() + local temp = auGetCurrentProjectProcessor() + if (not temp) then return end return auGetCurrentProjectProcessor():getMeta() end