Add dotnet7 for Android (wip)
This commit is contained in:
@@ -319,6 +319,11 @@ public:
|
||||
/// </summary>
|
||||
String GetPlatformBinariesRoot() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the platform and architecture for the current BuildPlatform.
|
||||
/// </summary>
|
||||
void GetBuildPlatformName(const Char*& platform, const Char*& architecture) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -219,6 +219,71 @@ String CookingData::GetPlatformBinariesRoot() const
|
||||
return Globals::StartupFolder / TEXT("Source/Platforms") / Tools->GetName() / TEXT("Binaries");
|
||||
}
|
||||
|
||||
void CookingData::GetBuildPlatformName(const Char*& platform, const Char*& architecture) const
|
||||
{
|
||||
switch (Platform)
|
||||
{
|
||||
case BuildPlatform::Windows32:
|
||||
platform = TEXT("Windows");
|
||||
architecture = TEXT("x86");
|
||||
break;
|
||||
case BuildPlatform::Windows64:
|
||||
platform = TEXT("Windows");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::UWPx86:
|
||||
platform = TEXT("UWP");
|
||||
architecture = TEXT("x86");
|
||||
break;
|
||||
case BuildPlatform::UWPx64:
|
||||
platform = TEXT("UWP");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::XboxOne:
|
||||
platform = TEXT("XboxOne");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::LinuxX64:
|
||||
platform = TEXT("Linux");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::PS4:
|
||||
platform = TEXT("PS4");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::XboxScarlett:
|
||||
platform = TEXT("XboxScarlett");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::AndroidARM64:
|
||||
platform = TEXT("Android");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::Switch:
|
||||
platform = TEXT("Switch");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::PS5:
|
||||
platform = TEXT("PS5");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::MacOSx64:
|
||||
platform = TEXT("Mac");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::MacOSARM64:
|
||||
platform = TEXT("Mac");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::iOSARM64:
|
||||
platform = TEXT("iOS");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
default:
|
||||
LOG(Fatal, "Unknown or unsupported build platform.");
|
||||
}
|
||||
}
|
||||
|
||||
void CookingData::StepProgress(const String& info, const float stepProgress) const
|
||||
{
|
||||
const float singleStepProgress = 1.0f / (StepsCount + 1);
|
||||
|
||||
@@ -154,68 +154,7 @@ bool CompileScriptsStep::Perform(CookingData& data)
|
||||
String target = project->GameTarget;
|
||||
StringView workingDir;
|
||||
const Char *platform, *architecture, *configuration = ::ToString(data.Configuration);
|
||||
switch (data.Platform)
|
||||
{
|
||||
case BuildPlatform::Windows32:
|
||||
platform = TEXT("Windows");
|
||||
architecture = TEXT("x86");
|
||||
break;
|
||||
case BuildPlatform::Windows64:
|
||||
platform = TEXT("Windows");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::UWPx86:
|
||||
platform = TEXT("UWP");
|
||||
architecture = TEXT("x86");
|
||||
break;
|
||||
case BuildPlatform::UWPx64:
|
||||
platform = TEXT("UWP");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::XboxOne:
|
||||
platform = TEXT("XboxOne");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::LinuxX64:
|
||||
platform = TEXT("Linux");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::PS4:
|
||||
platform = TEXT("PS4");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::XboxScarlett:
|
||||
platform = TEXT("XboxScarlett");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::AndroidARM64:
|
||||
platform = TEXT("Android");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::Switch:
|
||||
platform = TEXT("Switch");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::PS5:
|
||||
platform = TEXT("PS5");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::MacOSx64:
|
||||
platform = TEXT("Mac");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::MacOSARM64:
|
||||
platform = TEXT("Mac");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
case BuildPlatform::iOSARM64:
|
||||
platform = TEXT("iOS");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
default:
|
||||
LOG(Error, "Unknown or unsupported build platform.");
|
||||
return true;
|
||||
}
|
||||
data.GetBuildPlatformName(platform, architecture);
|
||||
String targetBuildInfo = project->ProjectFolderPath / TEXT("Binaries") / target / platform / architecture / configuration / target + TEXT(".Build.json");
|
||||
if (target.IsEmpty())
|
||||
{
|
||||
|
||||
@@ -68,6 +68,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
if (FileSystem::DirectoryExists(srcDotnet))
|
||||
{
|
||||
// Use prebuilt .Net installation for that platform
|
||||
LOG(Info, "Using .Net Runtime {} at {}", data.Tools->GetName(), srcDotnet);
|
||||
if (FileSystem::CopyDirectory(dstDotnet, srcDotnet, true))
|
||||
{
|
||||
data.Error(TEXT("Failed to copy .Net runtime data files."));
|
||||
@@ -91,61 +92,95 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
canUseSystemDotnet = PLATFORM_TYPE == PlatformType::Mac;
|
||||
break;
|
||||
}
|
||||
if (!canUseSystemDotnet)
|
||||
if (canUseSystemDotnet)
|
||||
{
|
||||
data.Error(TEXT("Missing .Net files for a target platform."));
|
||||
return true;
|
||||
}
|
||||
// Ask Flax.Build to provide .Net SDK location for the current platform
|
||||
String sdks;
|
||||
bool failed = ScriptsBuilder::RunBuildTool(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printSDKs"), data.CacheDirectory);
|
||||
failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks);
|
||||
int32 idx = sdks.Find(TEXT("] DotNetSdk, "), StringSearchCase::CaseSensitive);
|
||||
if (idx != -1)
|
||||
{
|
||||
idx = sdks.Find(TEXT(", "), StringSearchCase::CaseSensitive, idx + 14);
|
||||
idx += 2;
|
||||
int32 end = sdks.Find(TEXT("\n"), StringSearchCase::CaseSensitive, idx);
|
||||
if (sdks[end] == '\r')
|
||||
end--;
|
||||
srcDotnet = String(sdks.Get() + idx, end - idx).TrimTrailing();
|
||||
}
|
||||
if (failed || !FileSystem::DirectoryExists(srcDotnet))
|
||||
{
|
||||
data.Error(TEXT("Failed to get .Net SDK location for a current platform."));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ask Flax.Build to provide .Net SDK location for current platform (assuming there are no prebuilt dotnet files)
|
||||
String sdks;
|
||||
bool failed = ScriptsBuilder::RunBuildTool(TEXT("-log -printSDKs -logfile=SDKs.txt"), data.CacheDirectory);
|
||||
failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks);
|
||||
int32 idx = sdks.Find(TEXT("] DotNetSdk, "), StringSearchCase::CaseSensitive);
|
||||
if (idx != -1)
|
||||
{
|
||||
idx = sdks.Find(TEXT(", "), StringSearchCase::CaseSensitive, idx + 14);
|
||||
idx += 2;
|
||||
int32 end = sdks.Find(TEXT("\n"), StringSearchCase::CaseSensitive, idx);
|
||||
if (sdks[end] == '\r')
|
||||
end--;
|
||||
srcDotnet = String(sdks.Get() + idx, end - idx).TrimTrailing();
|
||||
}
|
||||
if (failed || !FileSystem::DirectoryExists(srcDotnet))
|
||||
{
|
||||
data.Error(TEXT("Failed to get .Net SDK location for a current platform."));
|
||||
return true;
|
||||
}
|
||||
// Select version to use
|
||||
Array<String> versions;
|
||||
FileSystem::GetChildDirectories(versions, srcDotnet / TEXT("host/fxr"));
|
||||
if (versions.Count() == 0)
|
||||
{
|
||||
data.Error(TEXT("Failed to get .Net SDK location for a current platform."));
|
||||
return true;
|
||||
}
|
||||
for (String& version : versions)
|
||||
{
|
||||
version = StringUtils::GetFileName(version);
|
||||
if (!version.StartsWith(TEXT("7.")))
|
||||
version.Clear();
|
||||
}
|
||||
Sorting::QuickSort(versions.Get(), versions.Count());
|
||||
const String version = versions.Last();
|
||||
LOG(Info, "Using .Net Runtime {} at {}", version, srcDotnet);
|
||||
|
||||
// Select version to use
|
||||
Array<String> versions;
|
||||
FileSystem::GetChildDirectories(versions, srcDotnet / TEXT("host/fxr"));
|
||||
if (versions.Count() == 0)
|
||||
{
|
||||
data.Error(TEXT("Failed to get .Net SDK location for a current platform."));
|
||||
return true;
|
||||
// Deploy runtime files
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), srcDotnet / TEXT("LICENSE.txt"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), srcDotnet / TEXT("LICENSE.TXT"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"), srcDotnet / TEXT("ThirdPartyNotices.txt"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"), srcDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"));
|
||||
failed |= FileSystem::CopyDirectory(dstDotnet / TEXT("host/fxr") / version, srcDotnet / TEXT("host/fxr") / version, true);
|
||||
failed |= FileSystem::CopyDirectory(dstDotnet / TEXT("shared/Microsoft.NETCore.App") / version, srcDotnet / TEXT("shared/Microsoft.NETCore.App") / version, true);
|
||||
if (failed)
|
||||
{
|
||||
data.Error(TEXT("Failed to copy .Net runtime data files."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (String& version : versions)
|
||||
else
|
||||
{
|
||||
version = StringUtils::GetFileName(version);
|
||||
if (!version.StartsWith(TEXT("7.")))
|
||||
version.Clear();
|
||||
}
|
||||
Sorting::QuickSort(versions.Get(), versions.Count());
|
||||
const String version = versions.Last();
|
||||
LOG(Info, "Using .Net Runtime {} at {}", version, srcDotnet);
|
||||
// Ask Flax.Build to provide .Net Host Runtime location for the target platform
|
||||
String sdks;
|
||||
const Char* platformName, *archName;
|
||||
data.GetBuildPlatformName(platformName, archName);
|
||||
String args = String::Format(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printDotNetRuntime -platform={} -arch={}"), platformName, archName);
|
||||
bool failed = ScriptsBuilder::RunBuildTool(args, data.CacheDirectory);
|
||||
failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks);
|
||||
Array<String> parts;
|
||||
sdks.Split(',', parts);
|
||||
failed |= parts.Count() != 3;
|
||||
if (!failed)
|
||||
{
|
||||
srcDotnet = parts[2].TrimTrailing();
|
||||
}
|
||||
if (failed || !FileSystem::DirectoryExists(srcDotnet))
|
||||
{
|
||||
data.Error(TEXT("Failed to get .Net SDK location for a current platform."));
|
||||
return true;
|
||||
}
|
||||
LOG(Info, "Using .Net Runtime {} at {}", TEXT("Host"), srcDotnet);
|
||||
|
||||
// Deploy runtime files
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), srcDotnet / TEXT("LICENSE.txt"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), srcDotnet / TEXT("LICENSE.TXT"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"), srcDotnet / TEXT("ThirdPartyNotices.txt"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"), srcDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"));
|
||||
failed |= FileSystem::CopyDirectory(dstDotnet / TEXT("host/fxr") / version, srcDotnet / TEXT("host/fxr") / version, true);
|
||||
failed |= FileSystem::CopyDirectory(dstDotnet / TEXT("shared/Microsoft.NETCore.App") / version, srcDotnet / TEXT("shared/Microsoft.NETCore.App") / version, true);
|
||||
if (failed)
|
||||
{
|
||||
data.Error(TEXT("Failed to copy .Net runtime data files."));
|
||||
return true;
|
||||
// Deploy runtime files
|
||||
const String packFolder = srcDotnet / TEXT("../../../");
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.txt"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("LICENSE.TXT"), packFolder / TEXT("LICENSE.TXT"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"), packFolder / TEXT("ThirdPartyNotices.txt"));
|
||||
FileSystem::CopyFile(dstDotnet / TEXT("THIRD-PARTY-NOTICES.TXT"), packFolder / TEXT("THIRD-PARTY-NOTICES.TXT"));
|
||||
failed |= FileSystem::CopyDirectory(dstDotnet / TEXT("shared/Microsoft.NETCore.App"), srcDotnet / TEXT("../lib/net7.0"), true);
|
||||
failed |= FileSystem::CopyFile(dstDotnet / TEXT("shared/Microsoft.NETCore.App") / TEXT("System.Private.CoreLib.dll"), srcDotnet / TEXT("System.Private.CoreLib.dll"));
|
||||
if (failed)
|
||||
{
|
||||
data.Error(TEXT("Failed to copy .Net runtime data files."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user