@@ -456,18 +456,18 @@ PlatformTools* GameCooker::GetTools(BuildPlatform platform)
|
||||
return result;
|
||||
}
|
||||
|
||||
void GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration, const StringView& outputPath, BuildOptions options, const Array<String>& customDefines, const StringView& preset, const StringView& presetTarget)
|
||||
bool GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration, const StringView& outputPath, BuildOptions options, const Array<String>& customDefines, const StringView& preset, const StringView& presetTarget)
|
||||
{
|
||||
if (IsRunning())
|
||||
{
|
||||
LOG(Warning, "Cannot start a build. Already running.");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
PlatformTools* tools = GetTools(platform);
|
||||
if (tools == nullptr)
|
||||
{
|
||||
LOG(Error, "Build platform {0} is not supported.", ::ToString(platform));
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Setup
|
||||
@@ -493,7 +493,7 @@ void GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration,
|
||||
if (FileSystem::CreateDirectory(data.CacheDirectory))
|
||||
{
|
||||
LOG(Error, "Cannot setup game building cache directory.");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,13 +510,15 @@ void GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration,
|
||||
{
|
||||
GameCookerImpl::IsRunning = false;
|
||||
LOG(Error, "Failed to start a build thread.");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadCond.NotifyOne();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GameCooker::Cancel(bool waitForEnd)
|
||||
|
||||
@@ -82,7 +82,8 @@ public:
|
||||
/// <param name="customDefines">The list of custom defines passed to the build tool when compiling project scripts. Can be used in build scripts for configuration (Configuration.CustomDefines).</param>
|
||||
/// <param name="preset">The name of build preset used for cooking (can be used by editor and game plugins).</param>
|
||||
/// <param name="presetTarget">The name of build preset target used for cooking (can be used by editor and game plugins).</param>
|
||||
API_FUNCTION() static void Build(BuildPlatform platform, BuildConfiguration configuration, const StringView& outputPath, BuildOptions options, const Array<String>& customDefines, const StringView& preset = StringView::Empty, const StringView& presetTarget = StringView::Empty);
|
||||
/// <returns>True if failed to start the build, otherwise false.</returns>
|
||||
API_FUNCTION() static bool Build(BuildPlatform platform, BuildConfiguration configuration, const StringView& outputPath, BuildOptions options, const Array<String>& customDefines, const StringView& preset = StringView::Empty, const StringView& presetTarget = StringView::Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a cancel event to the game building service.
|
||||
|
||||
@@ -1395,7 +1395,7 @@ namespace FlaxEditor
|
||||
internal void BuildCommand(string arg)
|
||||
{
|
||||
if (TryBuildCommand(arg))
|
||||
Engine.RequestExit();
|
||||
Engine.RequestExit(1);
|
||||
}
|
||||
|
||||
private bool TryBuildCommand(string arg)
|
||||
|
||||
@@ -1006,7 +1006,12 @@ namespace FlaxEditor.Windows
|
||||
_preBuildAction = target.PreBuildAction;
|
||||
_postBuildAction = target.PostBuildAction;
|
||||
|
||||
GameCooker.Build(target.Platform, target.Mode, target.Output, item.Options, target.CustomDefines, item.PresetName, target.Name);
|
||||
bool failed = GameCooker.Build(target.Platform, target.Mode, target.Output, item.Options, target.CustomDefines, item.PresetName, target.Name);
|
||||
if (failed && _exitOnBuildEnd)
|
||||
{
|
||||
_exitOnBuildEnd = false;
|
||||
Engine.RequestExit(1);
|
||||
}
|
||||
}
|
||||
else if (_exitOnBuildEnd)
|
||||
{
|
||||
|
||||
@@ -241,6 +241,8 @@ void Engine::Exit(int32 exitCode)
|
||||
|
||||
void Engine::RequestExit(int32 exitCode)
|
||||
{
|
||||
if (Globals::IsRequestingExit)
|
||||
return;
|
||||
#if USE_EDITOR
|
||||
// Send to editor (will leave play mode if need to)
|
||||
if (Editor::Managed->OnAppExit())
|
||||
|
||||
Reference in New Issue
Block a user