Add dotnet7 for Android (wip)
This commit is contained in:
@@ -319,6 +319,11 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
String GetPlatformBinariesRoot() const;
|
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:
|
public:
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -219,6 +219,71 @@ String CookingData::GetPlatformBinariesRoot() const
|
|||||||
return Globals::StartupFolder / TEXT("Source/Platforms") / Tools->GetName() / TEXT("Binaries");
|
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
|
void CookingData::StepProgress(const String& info, const float stepProgress) const
|
||||||
{
|
{
|
||||||
const float singleStepProgress = 1.0f / (StepsCount + 1);
|
const float singleStepProgress = 1.0f / (StepsCount + 1);
|
||||||
|
|||||||
@@ -154,68 +154,7 @@ bool CompileScriptsStep::Perform(CookingData& data)
|
|||||||
String target = project->GameTarget;
|
String target = project->GameTarget;
|
||||||
StringView workingDir;
|
StringView workingDir;
|
||||||
const Char *platform, *architecture, *configuration = ::ToString(data.Configuration);
|
const Char *platform, *architecture, *configuration = ::ToString(data.Configuration);
|
||||||
switch (data.Platform)
|
data.GetBuildPlatformName(platform, architecture);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
String targetBuildInfo = project->ProjectFolderPath / TEXT("Binaries") / target / platform / architecture / configuration / target + TEXT(".Build.json");
|
String targetBuildInfo = project->ProjectFolderPath / TEXT("Binaries") / target / platform / architecture / configuration / target + TEXT(".Build.json");
|
||||||
if (target.IsEmpty())
|
if (target.IsEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
|||||||
if (FileSystem::DirectoryExists(srcDotnet))
|
if (FileSystem::DirectoryExists(srcDotnet))
|
||||||
{
|
{
|
||||||
// Use prebuilt .Net installation for that platform
|
// Use prebuilt .Net installation for that platform
|
||||||
|
LOG(Info, "Using .Net Runtime {} at {}", data.Tools->GetName(), srcDotnet);
|
||||||
if (FileSystem::CopyDirectory(dstDotnet, srcDotnet, true))
|
if (FileSystem::CopyDirectory(dstDotnet, srcDotnet, true))
|
||||||
{
|
{
|
||||||
data.Error(TEXT("Failed to copy .Net runtime data files."));
|
data.Error(TEXT("Failed to copy .Net runtime data files."));
|
||||||
@@ -91,15 +92,11 @@ bool DeployDataStep::Perform(CookingData& data)
|
|||||||
canUseSystemDotnet = PLATFORM_TYPE == PlatformType::Mac;
|
canUseSystemDotnet = PLATFORM_TYPE == PlatformType::Mac;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!canUseSystemDotnet)
|
if (canUseSystemDotnet)
|
||||||
{
|
{
|
||||||
data.Error(TEXT("Missing .Net files for a target platform."));
|
// Ask Flax.Build to provide .Net SDK location for the current platform
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ask Flax.Build to provide .Net SDK location for current platform (assuming there are no prebuilt dotnet files)
|
|
||||||
String sdks;
|
String sdks;
|
||||||
bool failed = ScriptsBuilder::RunBuildTool(TEXT("-log -printSDKs -logfile=SDKs.txt"), data.CacheDirectory);
|
bool failed = ScriptsBuilder::RunBuildTool(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printSDKs"), data.CacheDirectory);
|
||||||
failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks);
|
failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks);
|
||||||
int32 idx = sdks.Find(TEXT("] DotNetSdk, "), StringSearchCase::CaseSensitive);
|
int32 idx = sdks.Find(TEXT("] DotNetSdk, "), StringSearchCase::CaseSensitive);
|
||||||
if (idx != -1)
|
if (idx != -1)
|
||||||
@@ -148,6 +145,44 @@ bool DeployDataStep::Perform(CookingData& data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 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
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deploy engine data for the target platform
|
// Deploy engine data for the target platform
|
||||||
|
|||||||
@@ -10,9 +10,16 @@
|
|||||||
#include "Engine/Core/Collections/Dictionary.h"
|
#include "Engine/Core/Collections/Dictionary.h"
|
||||||
#include "Engine/Debug/DebugLog.h"
|
#include "Engine/Debug/DebugLog.h"
|
||||||
#include "Engine/Engine/Globals.h"
|
#include "Engine/Engine/Globals.h"
|
||||||
|
#if DOTNET_HOST_CORECRL
|
||||||
#include <nethost.h>
|
#include <nethost.h>
|
||||||
#include <coreclr_delegates.h>
|
#include <coreclr_delegates.h>
|
||||||
#include <hostfxr.h>
|
#include <hostfxr.h>
|
||||||
|
#elif DOTNET_HOST_MONO
|
||||||
|
#include <mono/jit/jit.h>
|
||||||
|
typedef char char_t;
|
||||||
|
#else
|
||||||
|
#error "Unknown .NET runtime host."
|
||||||
|
#endif
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
#include <combaseapi.h>
|
#include <combaseapi.h>
|
||||||
#undef SetEnvironmentVariable
|
#undef SetEnvironmentVariable
|
||||||
@@ -22,6 +29,7 @@
|
|||||||
static Dictionary<String, void*> CachedFunctions;
|
static Dictionary<String, void*> CachedFunctions;
|
||||||
static const char_t* NativeInteropTypeName = FLAX_CORECLR_TEXT("FlaxEngine.NativeInterop, FlaxEngine.CSharp");
|
static const char_t* NativeInteropTypeName = FLAX_CORECLR_TEXT("FlaxEngine.NativeInterop, FlaxEngine.CSharp");
|
||||||
|
|
||||||
|
#if DOTNET_HOST_CORECRL
|
||||||
hostfxr_initialize_for_runtime_config_fn hostfxr_initialize_for_runtime_config;
|
hostfxr_initialize_for_runtime_config_fn hostfxr_initialize_for_runtime_config;
|
||||||
hostfxr_initialize_for_dotnet_command_line_fn hostfxr_initialize_for_dotnet_command_line;
|
hostfxr_initialize_for_dotnet_command_line_fn hostfxr_initialize_for_dotnet_command_line;
|
||||||
hostfxr_get_runtime_delegate_fn hostfxr_get_runtime_delegate;
|
hostfxr_get_runtime_delegate_fn hostfxr_get_runtime_delegate;
|
||||||
@@ -31,9 +39,11 @@ get_function_pointer_fn get_function_pointer;
|
|||||||
hostfxr_set_error_writer_fn hostfxr_set_error_writer;
|
hostfxr_set_error_writer_fn hostfxr_set_error_writer;
|
||||||
hostfxr_get_dotnet_environment_info_result_fn hostfxr_get_dotnet_environment_info_result;
|
hostfxr_get_dotnet_environment_info_result_fn hostfxr_get_dotnet_environment_info_result;
|
||||||
hostfxr_run_app_fn hostfxr_run_app;
|
hostfxr_run_app_fn hostfxr_run_app;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool CoreCLR::InitHostfxr(const String& configPath, const String& libraryPath)
|
bool CoreCLR::InitHostfxr(const String& configPath, const String& libraryPath)
|
||||||
{
|
{
|
||||||
|
#if DOTNET_HOST_CORECRL
|
||||||
const FLAX_CORECLR_STRING& library_path = FLAX_CORECLR_STRING(libraryPath);
|
const FLAX_CORECLR_STRING& library_path = FLAX_CORECLR_STRING(libraryPath);
|
||||||
|
|
||||||
// Get path to hostfxr library
|
// Get path to hostfxr library
|
||||||
@@ -128,6 +138,10 @@ bool CoreCLR::InitHostfxr(const String& configPath, const String& libraryPath)
|
|||||||
|
|
||||||
hostfxr_close(handle);
|
hostfxr_close(handle);
|
||||||
get_function_pointer = (get_function_pointer_fn)pget_function_pointer;
|
get_function_pointer = (get_function_pointer_fn)pget_function_pointer;
|
||||||
|
#elif DOTNET_HOST_MONO
|
||||||
|
LOG(Fatal, "TODO: init mono hosting runtime");
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,8 +151,12 @@ void* CoreCLR::GetStaticMethodPointer(const String& methodName)
|
|||||||
if (CachedFunctions.TryGet(methodName, fun))
|
if (CachedFunctions.TryGet(methodName, fun))
|
||||||
return fun;
|
return fun;
|
||||||
|
|
||||||
|
#if DOTNET_HOST_CORECRL
|
||||||
int rc = get_function_pointer(NativeInteropTypeName, FLAX_CORECLR_STRING(methodName).Get(), UNMANAGEDCALLERSONLY_METHOD, nullptr, nullptr, &fun);
|
int rc = get_function_pointer(NativeInteropTypeName, FLAX_CORECLR_STRING(methodName).Get(), UNMANAGEDCALLERSONLY_METHOD, nullptr, nullptr, &fun);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
|
#else
|
||||||
|
int rc = -1;
|
||||||
|
#endif
|
||||||
LOG(Fatal, "Failed to get unmanaged function pointer for method {0}: 0x{1:x}", methodName.Get(), (unsigned int)rc);
|
LOG(Fatal, "Failed to get unmanaged function pointer for method {0}: 0x{1:x}", methodName.Get(), (unsigned int)rc);
|
||||||
|
|
||||||
CachedFunctions.Add(methodName, fun);
|
CachedFunctions.Add(methodName, fun);
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ public class Scripting : EngineModule
|
|||||||
{
|
{
|
||||||
if (EngineConfiguration.WithDotNet(options))
|
if (EngineConfiguration.WithDotNet(options))
|
||||||
{
|
{
|
||||||
options.PublicDependencies.Add("nethost");
|
options.PrivateDependencies.Add("nethost");
|
||||||
|
options.ScriptingAPI.Defines.Add("USE_NETCORE");
|
||||||
|
options.PublicDefinitions.Add("USE_NETCORE");
|
||||||
|
|
||||||
if (options.Target is EngineTarget engineTarget && engineTarget.UseSeparateMainExecutable(options))
|
if (options.Target is EngineTarget engineTarget && engineTarget.UseSeparateMainExecutable(options))
|
||||||
{
|
{
|
||||||
|
|||||||
19
Source/ThirdParty/nethost/nethost.Build.cs
vendored
19
Source/ThirdParty/nethost/nethost.Build.cs
vendored
@@ -41,6 +41,7 @@ public class nethost : ThirdPartyModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup build configuration
|
// Setup build configuration
|
||||||
|
bool useMonoHost = false;
|
||||||
switch (options.Platform.Target)
|
switch (options.Platform.Target)
|
||||||
{
|
{
|
||||||
case TargetPlatform.Windows:
|
case TargetPlatform.Windows:
|
||||||
@@ -51,7 +52,6 @@ public class nethost : ThirdPartyModule
|
|||||||
options.DependencyFiles.Add(Path.Combine(hostRuntimePath, "nethost.dll"));
|
options.DependencyFiles.Add(Path.Combine(hostRuntimePath, "nethost.dll"));
|
||||||
break;
|
break;
|
||||||
case TargetPlatform.Linux:
|
case TargetPlatform.Linux:
|
||||||
case TargetPlatform.Android:
|
|
||||||
options.OutputFiles.Add(Path.Combine(hostRuntimePath, "libnethost.a"));
|
options.OutputFiles.Add(Path.Combine(hostRuntimePath, "libnethost.a"));
|
||||||
options.DependencyFiles.Add(Path.Combine(hostRuntimePath, "libnethost.so"));
|
options.DependencyFiles.Add(Path.Combine(hostRuntimePath, "libnethost.so"));
|
||||||
break;
|
break;
|
||||||
@@ -65,11 +65,24 @@ public class nethost : ThirdPartyModule
|
|||||||
options.OutputFiles.Add(Path.Combine(hostRuntimePath, "libnethost.a"));
|
options.OutputFiles.Add(Path.Combine(hostRuntimePath, "libnethost.a"));
|
||||||
//options.OutputFiles.Add(Path.Combine(hostRuntimePath, "libhostfxr.a"));
|
//options.OutputFiles.Add(Path.Combine(hostRuntimePath, "libhostfxr.a"));
|
||||||
break;
|
break;
|
||||||
|
case TargetPlatform.Android:
|
||||||
|
useMonoHost = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidPlatformException(options.Platform.Target);
|
throw new InvalidPlatformException(options.Platform.Target);
|
||||||
}
|
}
|
||||||
options.PublicIncludePaths.Add(hostRuntimePath);
|
|
||||||
options.ScriptingAPI.Defines.Add("USE_NETCORE");
|
|
||||||
options.DependencyFiles.Add(Path.Combine(FolderPath, "FlaxEngine.CSharp.runtimeconfig.json"));
|
options.DependencyFiles.Add(Path.Combine(FolderPath, "FlaxEngine.CSharp.runtimeconfig.json"));
|
||||||
|
if (useMonoHost)
|
||||||
|
{
|
||||||
|
// Use Mono for runtime hosting
|
||||||
|
options.PublicDefinitions.Add("DOTNET_HOST_MONO");
|
||||||
|
options.PublicIncludePaths.Add(Path.Combine(hostRuntimePath, "include", "mono-2.0"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use CoreCRL for runtime hosting
|
||||||
|
options.PublicDefinitions.Add("DOTNET_HOST_CORECRL");
|
||||||
|
options.PublicIncludePaths.Add(hostRuntimePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,19 @@ using Microsoft.Win32;
|
|||||||
|
|
||||||
namespace Flax.Build
|
namespace Flax.Build
|
||||||
{
|
{
|
||||||
|
partial class Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Prints all .NET Runtimes found on system (use plaform/arch switches to filter results).
|
||||||
|
/// </summary>
|
||||||
|
[CommandLine("printDotNetRuntime", "Prints all .NET Runtimes found on system (use plaform/arch switches to filter results).")]
|
||||||
|
public static void PrintDotNetRuntime()
|
||||||
|
{
|
||||||
|
Log.Info("Printing .NET Runtimes...");
|
||||||
|
DotNetSdk.Instance.PrintRuntimes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The DotNet SDK.
|
/// The DotNet SDK.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -169,6 +182,7 @@ namespace Flax.Build
|
|||||||
TryAddHostRuntime(TargetPlatform.Windows, TargetArchitecture.ARM64, "win-arm64");
|
TryAddHostRuntime(TargetPlatform.Windows, TargetArchitecture.ARM64, "win-arm64");
|
||||||
TryAddHostRuntime(TargetPlatform.Mac, TargetArchitecture.x64, "osx-x64");
|
TryAddHostRuntime(TargetPlatform.Mac, TargetArchitecture.x64, "osx-x64");
|
||||||
TryAddHostRuntime(TargetPlatform.Mac, TargetArchitecture.ARM64, "osx-arm64");
|
TryAddHostRuntime(TargetPlatform.Mac, TargetArchitecture.ARM64, "osx-arm64");
|
||||||
|
TryAddHostRuntime(TargetPlatform.Android, TargetArchitecture.ARM64, "android-arm64", "Runtime.Mono");
|
||||||
|
|
||||||
// Found
|
// Found
|
||||||
IsValid = true;
|
IsValid = true;
|
||||||
@@ -177,6 +191,25 @@ namespace Flax.Build
|
|||||||
Log.Verbose($" - Host Runtime for {e.Key.Key} {e.Key.Value}");
|
Log.Verbose($" - Host Runtime for {e.Key.Key} {e.Key.Value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints the .NET runtimes hosts.
|
||||||
|
/// </summary>
|
||||||
|
public void PrintRuntimes()
|
||||||
|
{
|
||||||
|
foreach (var e in _hostRuntimes)
|
||||||
|
{
|
||||||
|
// Filter with input commandline
|
||||||
|
TargetPlatform[] platforms = Configuration.BuildPlatforms;
|
||||||
|
if (platforms != null && !platforms.Contains(e.Key.Key))
|
||||||
|
continue;
|
||||||
|
TargetArchitecture[] architectures = Configuration.BuildArchitectures;
|
||||||
|
if (architectures != null && !architectures.Contains(e.Key.Value))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Log.Message($"{e.Key.Key}, {e.Key.Value}, {e.Value}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to runtime host contents folder for a given target platform and architecture.
|
/// Gets the path to runtime host contents folder for a given target platform and architecture.
|
||||||
/// In format: <RootPath>/packs/Microsoft.NETCore.App.Host.<os>/<VersionName>/runtimes/<os>-<arch>/native
|
/// In format: <RootPath>/packs/Microsoft.NETCore.App.Host.<os>/<VersionName>/runtimes/<os>-<arch>/native
|
||||||
@@ -198,12 +231,17 @@ namespace Flax.Build
|
|||||||
_hostRuntimes[new KeyValuePair<TargetPlatform, TargetArchitecture>(platform, arch)] = path;
|
_hostRuntimes[new KeyValuePair<TargetPlatform, TargetArchitecture>(platform, arch)] = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryAddHostRuntime(TargetPlatform platform, TargetArchitecture arch, string rid)
|
private bool TryAddHostRuntime(TargetPlatform platform, TargetArchitecture arch, string rid, string runtimeName = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(rid))
|
if (string.IsNullOrEmpty(rid))
|
||||||
return false;
|
return false;
|
||||||
var path = Path.Combine(RootPath, $"packs/Microsoft.NETCore.App.Host.{rid}/{RuntimeVersionName}/runtimes/{rid}/native");
|
var path = Path.Combine(RootPath, $"packs/Microsoft.NETCore.App.Host.{rid}/{RuntimeVersionName}/runtimes/{rid}/native");
|
||||||
var exists = Directory.Exists(path);
|
var exists = Directory.Exists(path);
|
||||||
|
if (!exists && runtimeName != null)
|
||||||
|
{
|
||||||
|
path = Path.Combine(RootPath, $"packs/Microsoft.NETCore.App.{runtimeName}.{rid}/{RuntimeVersionName}/runtimes/{rid}/native");
|
||||||
|
exists = Directory.Exists(path);
|
||||||
|
}
|
||||||
if (exists)
|
if (exists)
|
||||||
_hostRuntimes[new KeyValuePair<TargetPlatform, TargetArchitecture>(platform, arch)] = path;
|
_hostRuntimes[new KeyValuePair<TargetPlatform, TargetArchitecture>(platform, arch)] = path;
|
||||||
return exists;
|
return exists;
|
||||||
|
|||||||
@@ -8,6 +8,19 @@ using Flax.Build.Platforms;
|
|||||||
|
|
||||||
namespace Flax.Build
|
namespace Flax.Build
|
||||||
{
|
{
|
||||||
|
partial class Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Prints all SDKs found on system. Can be used to query Win10 SDK or any other platform-specific toolsets used by build tool.
|
||||||
|
/// </summary>
|
||||||
|
[CommandLine("printSDKs", "Prints all SDKs found on system. Can be used to query Win10 SDK or any other platform-specific toolsets used by build tool.")]
|
||||||
|
public static void PrintSDKs()
|
||||||
|
{
|
||||||
|
Log.Info("Printing SDKs...");
|
||||||
|
Sdk.Print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base class for all SDKs.
|
/// The base class for all SDKs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -45,17 +58,17 @@ namespace Flax.Build
|
|||||||
{
|
{
|
||||||
var sdk = e.Value;
|
var sdk = e.Value;
|
||||||
if (sdk.IsValid)
|
if (sdk.IsValid)
|
||||||
Log.Info(sdk.GetType().Name + ", " + sdk.Version + ", " + sdk.RootPath);
|
Log.Message(sdk.GetType().Name + ", " + sdk.Version + ", " + sdk.RootPath);
|
||||||
else
|
else
|
||||||
Log.Info(sdk.GetType().Name + ", missing");
|
Log.Message(sdk.GetType().Name + ", missing");
|
||||||
}
|
}
|
||||||
foreach (var e in WindowsPlatformBase.GetSDKs())
|
foreach (var e in WindowsPlatformBase.GetSDKs())
|
||||||
{
|
{
|
||||||
Log.Info("Windows SDK " + e.Key + ", " + WindowsPlatformBase.GetSDKVersion(e.Key) + ", " + e.Value);
|
Log.Message("Windows SDK " + e.Key + ", " + WindowsPlatformBase.GetSDKVersion(e.Key) + ", " + e.Value);
|
||||||
}
|
}
|
||||||
foreach (var e in WindowsPlatformBase.GetToolsets())
|
foreach (var e in WindowsPlatformBase.GetToolsets())
|
||||||
{
|
{
|
||||||
Log.Info("Windows Toolset " + e.Key + ", " + e.Value);
|
Log.Message("Windows Toolset " + e.Key + ", " + e.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace Flax.Build
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CommandLine
|
public class CommandLine
|
||||||
{
|
{
|
||||||
|
internal static List<MethodInfo> ConsoleCommands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The command line option data.
|
/// The command line option data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -426,6 +428,14 @@ namespace Flax.Build
|
|||||||
{
|
{
|
||||||
type = property.PropertyType;
|
type = property.PropertyType;
|
||||||
}
|
}
|
||||||
|
else if (member is MethodInfo method)
|
||||||
|
{
|
||||||
|
// Add console command to be invoked by build tool
|
||||||
|
if (ConsoleCommands == null)
|
||||||
|
ConsoleCommands = new List<MethodInfo>();
|
||||||
|
ConsoleCommands.Add(method);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Unknown member type.");
|
throw new Exception("Unknown member type.");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Flax.Build
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The attribute to indicate the name of a command line argument and additional help description info.
|
/// The attribute to indicate the name of a command line argument and additional help description info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method)]
|
||||||
public class CommandLineAttribute : Attribute
|
public class CommandLineAttribute : Attribute
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -63,12 +63,6 @@ namespace Flax.Build
|
|||||||
[CommandLine("rebuild", "Rebuilds the targets.")]
|
[CommandLine("rebuild", "Rebuilds the targets.")]
|
||||||
public static bool Rebuild = false;
|
public static bool Rebuild = false;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Prints all SDKs found on system. Can be used to query Win10 SDK or any other platform-specific toolsets used by build tool.
|
|
||||||
/// </summary>
|
|
||||||
[CommandLine("printSDKs", "Prints all SDKs found on system. Can be used to query Win10 SDK or any other platform-specific toolsets used by build tool.")]
|
|
||||||
public static bool PrintSDKs = false;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints all build system plugins.
|
/// Prints all build system plugins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -117,6 +111,12 @@ namespace Flax.Build
|
|||||||
[CommandLine("log", "Enables logging into console.")]
|
[CommandLine("log", "Enables logging into console.")]
|
||||||
public static bool ConsoleLog = false;
|
public static bool ConsoleLog = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables logging only messages into console (general info logs will be ignored)."
|
||||||
|
/// </summary>
|
||||||
|
[CommandLine("logMessagesOnly", "Enables logging only messages into console (general info logs will be ignored).")]
|
||||||
|
public static bool LogMessagesOnly = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables verbose logging and detailed diagnostics.
|
/// Enables verbose logging and detailed diagnostics.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -138,9 +138,15 @@ namespace Flax.Build
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The log file path relative to the working directory.
|
/// The log file path relative to the working directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[CommandLine("logfile", "<path>", "The log file path relative to the working directory. Set to empty to disable it/")]
|
[CommandLine("logfile", "<path>", "The log file path relative to the working directory. Set to empty to disable it.")]
|
||||||
public static string LogFile = "Cache/Intermediate/Log.txt";
|
public static string LogFile = "Cache/Intermediate/Log.txt";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables logging only console output to the log file (instead whole output).
|
||||||
|
/// </summary>
|
||||||
|
[CommandLine("logFileWithConsole", "Enables logging only console output to the log file (instead whole output).")]
|
||||||
|
public static bool LogFileWithConsole = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum allowed concurrency for a build system (maximum active worker threads count).
|
/// The maximum allowed concurrency for a build system (maximum active worker threads count).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Flax.Build;
|
using Flax.Build;
|
||||||
|
using Flax.Build.Platforms;
|
||||||
using Flax.Deploy;
|
using Flax.Deploy;
|
||||||
using Ionic.Zip;
|
using System.IO.Compression;
|
||||||
|
|
||||||
|
#pragma warning disable 0219
|
||||||
|
|
||||||
namespace Flax.Deps.Dependencies
|
namespace Flax.Deps.Dependencies
|
||||||
{
|
{
|
||||||
@@ -28,6 +31,11 @@ namespace Flax.Deps.Dependencies
|
|||||||
{
|
{
|
||||||
TargetPlatform.PS4,
|
TargetPlatform.PS4,
|
||||||
};
|
};
|
||||||
|
case TargetPlatform.Linux:
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
TargetPlatform.Android,
|
||||||
|
};
|
||||||
default: return new TargetPlatform[0];
|
default: return new TargetPlatform[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,6 +151,20 @@ namespace Flax.Deps.Dependencies
|
|||||||
}
|
}
|
||||||
default: throw new InvalidPlatformException(BuildPlatform);
|
default: throw new InvalidPlatformException(BuildPlatform);
|
||||||
}
|
}
|
||||||
|
if (AndroidNdk.Instance.IsValid)
|
||||||
|
{
|
||||||
|
var path = AndroidNdk.Instance.RootPath;
|
||||||
|
envVars.Add("ANDROID_NDK", path);
|
||||||
|
envVars.Add("ANDROID_NDK_HOME", path);
|
||||||
|
envVars.Add("ANDROID_NDK_ROOT", path);
|
||||||
|
}
|
||||||
|
if (AndroidSdk.Instance.IsValid)
|
||||||
|
{
|
||||||
|
var path = AndroidSdk.Instance.RootPath;
|
||||||
|
envVars.Add("ANDROID_SDK", path);
|
||||||
|
envVars.Add("ANDROID_SDK_HOME", path);
|
||||||
|
envVars.Add("ANDROID_SDK_ROOT", path);
|
||||||
|
}
|
||||||
|
|
||||||
// Print the runtime version
|
// Print the runtime version
|
||||||
string version;
|
string version;
|
||||||
@@ -155,9 +177,10 @@ namespace Flax.Deps.Dependencies
|
|||||||
|
|
||||||
// Build
|
// Build
|
||||||
buildArgsBase = $"-os {os} -a {arch} -f {framework} -c {configuration} -lc {configuration} -rc {configuration} -rf {runtimeFlavor}{buildArgsBase}";
|
buildArgsBase = $"-os {os} -a {arch} -f {framework} -c {configuration} -lc {configuration} -rc {configuration} -rf {runtimeFlavor}{buildArgsBase}";
|
||||||
foreach (var buildStep in new[] { subset, "host.pkg", "packs.product" })
|
//foreach (var buildStep in new[] { subset, "host.pkg", "packs.product" })
|
||||||
|
/*var buildStep = "host.pkg";
|
||||||
{
|
{
|
||||||
var buildArgs = $"{buildArgsBase} {buildStep}";
|
var buildArgs = $"{buildArgsBase} -s {buildStep}";
|
||||||
if (BuildPlatform == TargetPlatform.Windows)
|
if (BuildPlatform == TargetPlatform.Windows)
|
||||||
{
|
{
|
||||||
// For some reason running from Visual Studio fails the build so use command shell
|
// For some reason running from Visual Studio fails the build so use command shell
|
||||||
@@ -169,9 +192,10 @@ namespace Flax.Deps.Dependencies
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Utilities.Run(Path.Combine(root, buildScript), buildArgs, null, root, Utilities.RunOptions.ThrowExceptionOnError, envVars);
|
//Utilities.Run(Path.Combine(root, buildScript), buildArgs, null, root, Utilities.RunOptions.ThrowExceptionOnError, envVars);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
Utilities.Run(Path.Combine(root, buildScript), buildArgsBase, null, root, Utilities.RunOptions.ThrowExceptionOnError, envVars);
|
||||||
|
|
||||||
// Deploy build products
|
// Deploy build products
|
||||||
var dstBinaries = GetThirdPartyFolder(options, targetPlatform, architecture);
|
var dstBinaries = GetThirdPartyFolder(options, targetPlatform, architecture);
|
||||||
@@ -194,18 +218,26 @@ namespace Flax.Deps.Dependencies
|
|||||||
var srcDotnetLibsPkg = Path.Combine(artifacts, "packages", "Release", "Shipping", $"Microsoft.NETCore.App.Runtime.Mono.{hostRuntimeName}.{version}.nupkg");
|
var srcDotnetLibsPkg = Path.Combine(artifacts, "packages", "Release", "Shipping", $"Microsoft.NETCore.App.Runtime.Mono.{hostRuntimeName}.{version}.nupkg");
|
||||||
if (!File.Exists(srcDotnetLibsPkg))
|
if (!File.Exists(srcDotnetLibsPkg))
|
||||||
throw new Exception($"Missing .NET Core App class library package at '{srcDotnetLibsPkg}'");
|
throw new Exception($"Missing .NET Core App class library package at '{srcDotnetLibsPkg}'");
|
||||||
var srcDotnetLibsPkgTemp = srcDotnetLibsPkg + "Temp";
|
var unpackTemp = Path.Combine(Path.GetDirectoryName(srcDotnetLibsPkg), "UnpackTemp");
|
||||||
using (var zip = new ZipFile(srcDotnetLibsPkg))
|
SetupDirectory(unpackTemp, true);
|
||||||
|
using (var zip = ZipFile.Open(srcDotnetLibsPkg, ZipArchiveMode.Read))
|
||||||
{
|
{
|
||||||
zip.ExtractAll(srcDotnetLibsPkgTemp, ExtractExistingFileAction.OverwriteSilently);
|
zip.ExtractToDirectory(unpackTemp);
|
||||||
}
|
}
|
||||||
var privateCorelib = "System.Private.CoreLib.dll";
|
var privateCorelib = "System.Private.CoreLib.dll";
|
||||||
Utilities.FileCopy(Path.Combine(srcDotnetLibsPkgTemp, "runtimes", hostRuntimeName, "native", privateCorelib), Path.Combine(dstClassLibrary, privateCorelib));
|
Utilities.FileCopy(Path.Combine(unpackTemp, "runtimes", hostRuntimeName, "native", privateCorelib), Path.Combine(dstClassLibrary, privateCorelib));
|
||||||
Utilities.DirectoryCopy(Path.Combine(srcDotnetLibsPkgTemp, "runtimes", hostRuntimeName, "lib", "net7.0"), dstClassLibrary, false, true);
|
Utilities.DirectoryCopy(Path.Combine(unpackTemp, "runtimes", hostRuntimeName, "lib", "net7.0"), dstClassLibrary, false, true);
|
||||||
Utilities.DirectoriesDelete(srcDotnetLibsPkgTemp);
|
|
||||||
// TODO: host/fxr/<version>/hostfxr.dll
|
// TODO: host/fxr/<version>/hostfxr.dll
|
||||||
// TODO: shared/Microsoft.NETCore.App/<version>/hostpolicy.dl
|
// TODO: shared/Microsoft.NETCore.App/<version>/hostpolicy.dl
|
||||||
// TODO: shared/Microsoft.NETCore.App/<version>/System.IO.Compression.Native.dll
|
// TODO: shared/Microsoft.NETCore.App/<version>/System.IO.Compression.Native.dll
|
||||||
|
if (runtimeFlavor == "Mono")
|
||||||
|
{
|
||||||
|
Utilities.DirectoryCopy(Path.Combine(unpackTemp, "runtimes", hostRuntimeName, "native"), Path.Combine(dstDotnet, "native"), true, true);
|
||||||
|
Utilities.FileDelete(Path.Combine(dstDotnet, "native", privateCorelib));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new InvalidPlatformException(targetPlatform);
|
||||||
|
Utilities.DirectoriesDelete(unpackTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -233,6 +265,11 @@ namespace Flax.Deps.Dependencies
|
|||||||
Build(options, platform, TargetArchitecture.x64);
|
Build(options, platform, TargetArchitecture.x64);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TargetPlatform.Android:
|
||||||
|
{
|
||||||
|
Build(options, platform, TargetArchitecture.ARM64);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ namespace Flax.Deps
|
|||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.None);
|
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.None);
|
||||||
|
if (submodules)
|
||||||
|
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commit != null)
|
if (commit != null)
|
||||||
@@ -158,6 +160,8 @@ namespace Flax.Deps
|
|||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.None);
|
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.None);
|
||||||
|
if (submodules)
|
||||||
|
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +187,8 @@ namespace Flax.Deps
|
|||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.None);
|
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.None);
|
||||||
|
if (submodules)
|
||||||
|
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commit != null)
|
if (commit != null)
|
||||||
@@ -208,6 +214,8 @@ namespace Flax.Deps
|
|||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.None);
|
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.None);
|
||||||
|
if (submodules)
|
||||||
|
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.None);
|
||||||
|
|
||||||
if (commit != null)
|
if (commit != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ namespace Flax.Build
|
|||||||
System.Diagnostics.Debug.WriteLine(Indent + message);
|
System.Diagnostics.Debug.WriteLine(Indent + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Configuration.LogFileWithConsole)
|
||||||
|
return;
|
||||||
|
|
||||||
if (_logFile != null)
|
if (_logFile != null)
|
||||||
{
|
{
|
||||||
@@ -82,6 +84,9 @@ namespace Flax.Build
|
|||||||
|
|
||||||
lock (_logFile)
|
lock (_logFile)
|
||||||
{
|
{
|
||||||
|
if (Configuration.LogFileWithConsole)
|
||||||
|
_logFileWriter.WriteLine(message);
|
||||||
|
else
|
||||||
_logFileWriter.WriteLine(prefix + Indent + message);
|
_logFileWriter.WriteLine(prefix + Indent + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,6 +106,15 @@ namespace Flax.Build
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">The message.</param>
|
/// <param name="message">The message.</param>
|
||||||
public static void Info(string message)
|
public static void Info(string message)
|
||||||
|
{
|
||||||
|
Write(message, _defaultColor, Configuration.ConsoleLog && !Configuration.LogMessagesOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logs the information.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The message.</param>
|
||||||
|
public static void Message(string message)
|
||||||
{
|
{
|
||||||
Write(message, _defaultColor, Configuration.ConsoleLog);
|
Write(message, _defaultColor, Configuration.ConsoleLog);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Flax.Build
|
|||||||
Globals.Project = ProjectInfo.Load(projectFiles[0]);
|
Globals.Project = ProjectInfo.Load(projectFiles[0]);
|
||||||
else if (projectFiles.Length > 1)
|
else if (projectFiles.Length > 1)
|
||||||
throw new Exception("Too many project files. Don't know which to pick.");
|
throw new Exception("Too many project files. Don't know which to pick.");
|
||||||
else
|
else if (!Configuration.LogMessagesOnly)
|
||||||
Log.Warning("Missing project file.");
|
Log.Warning("Missing project file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,11 +114,11 @@ namespace Flax.Build
|
|||||||
// Collect all targets and modules from the workspace
|
// Collect all targets and modules from the workspace
|
||||||
Builder.GenerateRulesAssembly();
|
Builder.GenerateRulesAssembly();
|
||||||
|
|
||||||
// Print SDKs
|
// Run console commands
|
||||||
if (Configuration.PrintSDKs)
|
if (CommandLine.ConsoleCommands != null)
|
||||||
{
|
{
|
||||||
Log.Info("Printing SDKs...");
|
foreach (var e in CommandLine.ConsoleCommands)
|
||||||
Sdk.Print();
|
e.Invoke(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deps tool
|
// Deps tool
|
||||||
|
|||||||
Reference in New Issue
Block a user