Add GameCooker events for game files deploy and packaging
This commit is contained in:
@@ -106,6 +106,9 @@ using namespace GameCookerImpl;
|
||||
|
||||
Delegate<GameCooker::EventType> GameCooker::OnEvent;
|
||||
Delegate<const String&, float> GameCooker::OnProgress;
|
||||
Action GameCooker::DeployFiles;
|
||||
Action GameCooker::PostProcessFiles;
|
||||
Action GameCooker::PackageFiles;
|
||||
Delegate<HashSet<Guid>&> GameCooker::OnCollectAssets;
|
||||
|
||||
const Char* ToString(const BuildPlatform platform)
|
||||
|
||||
@@ -10,17 +10,15 @@
|
||||
/// </summary>
|
||||
API_CLASS(Static, Namespace="FlaxEditor") class FLAXENGINE_API GameCooker
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GameCooker);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GameCooker);
|
||||
friend CookingData;
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Single build step.
|
||||
/// </summary>
|
||||
class FLAXENGINE_API BuildStep
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="BuildStep"/> class.
|
||||
/// </summary>
|
||||
@@ -52,7 +50,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current build data. Valid only during active build process.
|
||||
/// </summary>
|
||||
@@ -124,6 +121,21 @@ public:
|
||||
/// </summary>
|
||||
static Delegate<const String&, float> OnProgress;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when game files and data is deployed.
|
||||
/// </summary>
|
||||
API_EVENT() static Action DeployFiles;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when game files and data are deployed and can be post-processed.
|
||||
/// </summary>
|
||||
API_EVENT() static Action PostProcessFiles;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when game files and data are ready to be packaged. Called only if game is about to packaged, otherwise this step is skipped.
|
||||
/// </summary>
|
||||
API_EVENT() static Action PackageFiles;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when building collects assets to cook.
|
||||
/// </summary>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "AndroidPlatformTools.h"
|
||||
#include "Editor/Editor.h"
|
||||
#include "Editor/ProjectInfo.h"
|
||||
#include "Editor/Cooker/GameCooker.h"
|
||||
#include "Editor/Utilities/EditorUtilities.h"
|
||||
#include "Engine/Platform/File.h"
|
||||
#include "Engine/Platform/FileSystem.h"
|
||||
#include "Engine/Platform/Android/AndroidPlatformSettings.h"
|
||||
@@ -12,7 +14,6 @@
|
||||
#include "Engine/Graphics/Textures/TextureData.h"
|
||||
#include "Engine/Core/Config/GameSettings.h"
|
||||
#include "Engine/Core/Config/BuildSettings.h"
|
||||
#include "Editor/Utilities/EditorUtilities.h"
|
||||
#include "Engine/Content/Content.h"
|
||||
#include "Engine/Content/JsonAsset.h"
|
||||
|
||||
@@ -276,6 +277,7 @@ bool AndroidPlatformTools::OnPostProcess(CookingData& data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
GameCooker::PackageFiles();
|
||||
|
||||
// Validate environment variables
|
||||
Dictionary<String, String> envVars;
|
||||
|
||||
@@ -215,11 +215,12 @@ bool MacPlatformTools::OnPostProcess(CookingData& data)
|
||||
// TODO: sign binaries
|
||||
|
||||
// TODO: expose event to inject custom post-processing before app packaging (eg. third-party plugins)
|
||||
|
||||
|
||||
// Package application
|
||||
const auto buildSettings = BuildSettings::Get();
|
||||
if (buildSettings->SkipPackaging)
|
||||
return false;
|
||||
GameCooker::PackageFiles();
|
||||
LOG(Info, "Building app package...");
|
||||
const String dmgPath = data.OriginalOutputPath / appName + TEXT(".dmg");
|
||||
const String dmgCommand = String::Format(TEXT("hdiutil create {0}.dmg -volname {0} -fs HFS+ -srcfolder {0}.app"), appName);
|
||||
|
||||
@@ -46,6 +46,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
// Deploy engine data for the target platform
|
||||
if (data.Tools->OnDeployBinaries(data))
|
||||
return true;
|
||||
GameCooker::DeployFiles();
|
||||
|
||||
// Register engine in-build assets
|
||||
data.AddRootEngineAsset(TEXT("Shaders/AtmospherePreCompute"));
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
|
||||
bool PostProcessStep::Perform(CookingData& data)
|
||||
{
|
||||
GameCooker::PostProcessFiles();
|
||||
return data.Tools->OnPostProcess(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user