Update Switch platform support

This commit is contained in:
Wojtek Figat
2023-04-11 15:53:53 +02:00
parent aa64da9869
commit 68c6a01805
12 changed files with 98 additions and 203 deletions

View File

@@ -415,89 +415,6 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data)
return false;
}
void UWPPlatformTools::OnConfigureAOT(CookingData& data, AotConfig& config)
{
const auto platformDataPath = data.GetPlatformBinariesRoot();
const bool useInterpreter = true; // TODO: support using Full AOT instead of interpreter
const bool enableDebug = data.Configuration != BuildConfiguration::Release;
const Char* aotMode = useInterpreter ? TEXT("full,interp") : TEXT("full");
const Char* debugMode = enableDebug ? TEXT("soft-debug") : TEXT("nodebug");
config.AotCompilerArgs = String::Format(TEXT("--aot={0},verbose,stats,print-skipped,{1} -O=all"),
aotMode,
debugMode);
if (enableDebug)
config.AotCompilerArgs = TEXT("--debug ") + config.AotCompilerArgs;
config.AotCompilerPath = platformDataPath / TEXT("Tools/mono.exe");
}
bool UWPPlatformTools::OnPerformAOT(CookingData& data, AotConfig& config, const String& assemblyPath)
{
// Skip .dll.dll which could be a false result from the previous AOT which could fail
if (assemblyPath.EndsWith(TEXT(".dll.dll")))
{
LOG(Warning, "Skip AOT for file '{0}' as it can be a result from the previous task", assemblyPath);
return false;
}
// Check if skip this assembly (could be already processed)
const String filename = StringUtils::GetFileName(assemblyPath);
const String outputPath = config.AotCachePath / filename + TEXT(".dll");
if (FileSystem::FileExists(outputPath) && FileSystem::GetFileLastEditTime(assemblyPath) < FileSystem::GetFileLastEditTime(outputPath))
return false;
LOG(Info, "Calling AOT tool for \"{0}\"", assemblyPath);
// Cleanup temporary results (fromm the previous AT that fail or sth)
const String resultPath = assemblyPath + TEXT(".dll");
const String resultPathExp = resultPath + TEXT(".exp");
const String resultPathLib = resultPath + TEXT(".lib");
const String resultPathPdb = resultPath + TEXT(".pdb");
if (FileSystem::FileExists(resultPath))
FileSystem::DeleteFile(resultPath);
if (FileSystem::FileExists(resultPathExp))
FileSystem::DeleteFile(resultPathExp);
if (FileSystem::FileExists(resultPathLib))
FileSystem::DeleteFile(resultPathLib);
if (FileSystem::FileExists(resultPathPdb))
FileSystem::DeleteFile(resultPathPdb);
// Call tool
CreateProcessSettings procSettings;
procSettings.FileName = String::Format(TEXT("\"{0}\" {1} \"{2}\""), config.AotCompilerPath, config.AotCompilerArgs, assemblyPath);
procSettings.WorkingDirectory = StringUtils::GetDirectoryName(config.AotCompilerPath);
procSettings.Environment = config.EnvVars;
const int32 result = Platform::CreateProcess(procSettings);
if (result != 0)
{
data.Error(TEXT("AOT tool execution failed with result code {1} for assembly \"{0}\". See log for more info."), assemblyPath, result);
return true;
}
// Copy result
if (FileSystem::CopyFile(outputPath, resultPath))
{
data.Error(TEXT("Failed to copy the AOT tool result file. It can be missing."));
return true;
}
// Copy pdb file if exists
if (data.Configuration != BuildConfiguration::Release && FileSystem::FileExists(resultPathPdb))
{
FileSystem::CopyFile(config.AotCachePath / StringUtils::GetFileName(resultPathPdb), resultPathPdb);
}
// Clean intermediate results
if (FileSystem::DeleteFile(resultPath)
|| (FileSystem::FileExists(resultPathExp) && FileSystem::DeleteFile(resultPathExp))
|| (FileSystem::FileExists(resultPathLib) && FileSystem::DeleteFile(resultPathLib))
|| (FileSystem::FileExists(resultPathPdb) && FileSystem::DeleteFile(resultPathPdb))
)
{
LOG(Warning, "Failed to remove the AOT tool result file(s).");
}
return false;
}
bool UWPPlatformTools::OnPostProcess(CookingData& data)
{
LOG(Error, "UWP (Windows Store) platform has been deprecated and soon will be removed!");

View File

@@ -32,8 +32,6 @@ public:
DotNetAOTModes UseAOT() const override;
bool OnScriptsStepDone(CookingData& data) override;
bool OnDeployBinaries(CookingData& data) override;
void OnConfigureAOT(CookingData& data, AotConfig& config) override;
bool OnPerformAOT(CookingData& data, AotConfig& config, const String& assemblyPath) override;
bool OnPostProcess(CookingData& data) override;
};

View File

@@ -3,7 +3,6 @@
#pragma once
#include "CookingData.h"
#include "Engine/Core/Collections/Dictionary.h"
#include "Editor/Scripting/ScriptsBuilder.h"
#include "Engine/Graphics/PixelFormat.h"
@@ -134,62 +133,6 @@ public:
return false;
}
/// <summary>
/// The C# scripts AOT configuration options.
/// </summary>
struct AotConfig
{
String AotCompilerPath;
String AotCompilerArgs;
String AssemblerPath;
String AssemblerArgs;
String ArchiverPath;
String ArchiverArgs;
String AuxToolPath;
String AuxToolArgs;
String AotCachePath;
Dictionary<String, String> EnvVars;
Array<String> AssembliesSearchDirs;
Array<String> Assemblies;
AotConfig(CookingData& data)
{
Platform::GetEnvironmentVariables(EnvVars);
}
};
/// <summary>
/// Called to configure AOT options.
/// </summary>
/// <param name="data">The cooking data.</param>
/// <param name="config">The configuration.</param>
virtual void OnConfigureAOT(CookingData& data, AotConfig& config)
{
}
/// <summary>
/// Called to execute AOT for the given assembly.
/// </summary>
/// <param name="data">The cooking data.</param>
/// <param name="config">The configuration.</param>
/// <param name="assemblyPath">The input managed library file path.</param>
/// <returns>True if failed, otherwise false.<returns>
virtual bool OnPerformAOT(CookingData& data, AotConfig& config, const String& assemblyPath)
{
return false;
}
/// <summary>
/// Called after AOT execution for the assemblies.
/// </summary>
/// <param name="data">The cooking data.</param>
/// <param name="config">The configuration.</param>
/// <returns>True if failed, otherwise false.<returns>
virtual bool OnPostProcessAOT(CookingData& data, AotConfig& config)
{
return false;
}
/// <summary>
/// Called during staged build post-processing.
/// </summary>