Merge branch 'dotnet8_rollforward_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-dotnet8_rollforward_fix
This commit is contained in:
@@ -1650,9 +1650,9 @@ bool InitHostfxr()
|
|||||||
const ::String csharpLibraryPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.dll");
|
const ::String csharpLibraryPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.dll");
|
||||||
const ::String csharpRuntimeConfigPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.runtimeconfig.json");
|
const ::String csharpRuntimeConfigPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.runtimeconfig.json");
|
||||||
if (!FileSystem::FileExists(csharpLibraryPath))
|
if (!FileSystem::FileExists(csharpLibraryPath))
|
||||||
LOG(Fatal, "Failed to initialize managed runtime, missing file: {0}", csharpLibraryPath);
|
LOG(Fatal, "Failed to initialize .NET runtime, missing file: {0}", csharpLibraryPath);
|
||||||
if (!FileSystem::FileExists(csharpRuntimeConfigPath))
|
if (!FileSystem::FileExists(csharpRuntimeConfigPath))
|
||||||
LOG(Fatal, "Failed to initialize managed runtime, missing file: {0}", csharpRuntimeConfigPath);
|
LOG(Fatal, "Failed to initialize .NET runtime, missing file: {0}", csharpRuntimeConfigPath);
|
||||||
const FLAX_CORECLR_STRING& libraryPath = FLAX_CORECLR_STRING(csharpLibraryPath);
|
const FLAX_CORECLR_STRING& libraryPath = FLAX_CORECLR_STRING(csharpLibraryPath);
|
||||||
|
|
||||||
// Get path to hostfxr library
|
// Get path to hostfxr library
|
||||||
@@ -1703,9 +1703,9 @@ bool InitHostfxr()
|
|||||||
Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet/7.0"));
|
Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet/7.0"));
|
||||||
#endif
|
#endif
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
LOG(Fatal, "Missing .NET 7 SDK installation required to run Flax Editor.");
|
LOG(Fatal, "Missing .NET 7 or later SDK installation required to run Flax Editor.");
|
||||||
#else
|
#else
|
||||||
LOG(Fatal, "Missing .NET 7 Runtime installation required to run this application.");
|
LOG(Fatal, "Missing .NET 7 or later Runtime installation required to run this application.");
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1735,14 +1735,13 @@ bool InitHostfxr()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement picking different version of hostfxr, currently prefers highest available version.
|
// TODO: Implement support for picking RC/beta updates of .NET runtime
|
||||||
// Allow future and preview versions of .NET
|
// Uncomment for enabling support for upcoming .NET major release candidates
|
||||||
String dotnetRollForward;
|
#if 0
|
||||||
String dotnetRollForwardPr;
|
String dotnetRollForwardPr;
|
||||||
if (Platform::GetEnvironmentVariable(TEXT("DOTNET_ROLL_FORWARD"), dotnetRollForward))
|
|
||||||
Platform::SetEnvironmentVariable(TEXT("DOTNET_ROLL_FORWARD"), TEXT("LatestMajor"));
|
|
||||||
if (Platform::GetEnvironmentVariable(TEXT("DOTNET_ROLL_FORWARD_TO_PRERELEASE"), dotnetRollForwardPr))
|
if (Platform::GetEnvironmentVariable(TEXT("DOTNET_ROLL_FORWARD_TO_PRERELEASE"), dotnetRollForwardPr))
|
||||||
Platform::SetEnvironmentVariable(TEXT("DOTNET_ROLL_FORWARD_TO_PRERELEASE"), TEXT("1"));
|
Platform::SetEnvironmentVariable(TEXT("DOTNET_ROLL_FORWARD_TO_PRERELEASE"), TEXT("1"));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize hosting component
|
// Initialize hosting component
|
||||||
const char_t* argv[1] = { libraryPath.Get() };
|
const char_t* argv[1] = { libraryPath.Get() };
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
"tfm": "net7.0",
|
"tfm": "net7.0",
|
||||||
"framework": {
|
"framework": {
|
||||||
"name": "Microsoft.NETCore.App",
|
"name": "Microsoft.NETCore.App",
|
||||||
"version": "7.0.0"
|
"version": "7.0.0",
|
||||||
|
"rollForward": "latestMajor"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ namespace Flax.Build
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static Version MinimumVersion => new Version(7, 0);
|
public static Version MinimumVersion => new Version(7, 0);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum SDK version.
|
||||||
|
/// </summary>
|
||||||
|
public static Version MaximumVersion => new Version(8, 0);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override TargetPlatform[] Platforms
|
public override TargetPlatform[] Platforms
|
||||||
{
|
{
|
||||||
@@ -245,21 +250,24 @@ namespace Flax.Build
|
|||||||
dotnetSdkVersions = GetVersions(Path.Combine(dotnetPath, "sdk"));
|
dotnetSdkVersions = GetVersions(Path.Combine(dotnetPath, "sdk"));
|
||||||
if (dotnetRuntimeVersions == null)
|
if (dotnetRuntimeVersions == null)
|
||||||
dotnetRuntimeVersions = GetVersions(Path.Combine(dotnetPath, "shared/Microsoft.NETCore.App"));
|
dotnetRuntimeVersions = GetVersions(Path.Combine(dotnetPath, "shared/Microsoft.NETCore.App"));
|
||||||
string dotnetSdkVersion = dotnetSdkVersions.OrderByDescending(ParseVersion).FirstOrDefault();
|
|
||||||
string dotnetRuntimeVersion = dotnetRuntimeVersions.OrderByDescending(ParseVersion).FirstOrDefault();
|
dotnetSdkVersions = dotnetSdkVersions.OrderByDescending(ParseVersion);
|
||||||
|
dotnetRuntimeVersions = dotnetRuntimeVersions.OrderByDescending(ParseVersion);
|
||||||
|
|
||||||
|
string dotnetSdkVersion = dotnetSdkVersions.FirstOrDefault(x => ParseVersion(x).Major >= MinimumVersion.Major && ParseVersion(x).Major <= MaximumVersion.Major);
|
||||||
|
string dotnetRuntimeVersion = dotnetRuntimeVersions.FirstOrDefault(x => ParseVersion(x).Major >= MinimumVersion.Major && ParseVersion(x).Major <= MaximumVersion.Major);
|
||||||
if (string.IsNullOrEmpty(dotnetSdkVersion))
|
if (string.IsNullOrEmpty(dotnetSdkVersion))
|
||||||
dotnetSdkVersion = dotnetPath;
|
dotnetSdkVersion = dotnetPath;
|
||||||
|
if (dotnetSdkVersion == null && dotnetSdkVersions.Count() > 0)
|
||||||
|
{
|
||||||
|
Log.Warning($"Unsupported .NET SDK {dotnetSdkVersions.First()} version found. Minimum version required is .NET {MinimumVersion}.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(dotnetSdkVersion) || string.IsNullOrEmpty(dotnetRuntimeVersion))
|
if (string.IsNullOrEmpty(dotnetSdkVersion) || string.IsNullOrEmpty(dotnetRuntimeVersion))
|
||||||
{
|
{
|
||||||
Log.Warning("Missing .NET SDK");
|
Log.Warning("Missing .NET SDK");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int majorVersion = int.Parse(dotnetSdkVersion.Substring(0, dotnetSdkVersion.IndexOf(".")));
|
|
||||||
if (majorVersion < MinimumVersion.Major)
|
|
||||||
{
|
|
||||||
Log.Warning($"Unsupported .NET SDK {dotnetSdkVersion} version found. Minimum version required is .NET {MinimumVersion}.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RootPath = dotnetPath;
|
RootPath = dotnetPath;
|
||||||
Version = ParseVersion(dotnetSdkVersion);
|
Version = ParseVersion(dotnetSdkVersion);
|
||||||
VersionName = dotnetSdkVersion;
|
VersionName = dotnetSdkVersion;
|
||||||
@@ -452,8 +460,9 @@ namespace Flax.Build
|
|||||||
|
|
||||||
private static string GetVersion(IEnumerable<string> versions)
|
private static string GetVersion(IEnumerable<string> versions)
|
||||||
{
|
{
|
||||||
// TODO: reject 'future' versions like .Net 8?
|
return versions.OrderByDescending(ParseVersion)
|
||||||
return versions.OrderByDescending(ParseVersion).FirstOrDefault();
|
.Where(x => ParseVersion(x).Major >= MinimumVersion.Major && ParseVersion(x).Major <= MaximumVersion.Major)
|
||||||
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string SearchForDotnetLocationLinux()
|
private static string SearchForDotnetLocationLinux()
|
||||||
|
|||||||
Reference in New Issue
Block a user