Add support for separate data and code output directories in Game Cooker
This commit is contained in:
@@ -119,7 +119,7 @@ bool CompileScriptsStep::DeployBinaries(CookingData& data, const String& path, c
|
||||
}
|
||||
for (auto& file : files)
|
||||
{
|
||||
const String dst = data.OutputPath / StringUtils::GetFileName(file);
|
||||
const String dst = data.CodeOutputPath / StringUtils::GetFileName(file);
|
||||
if (dst != file && FileSystem::CopyFile(dst, file))
|
||||
{
|
||||
data.Error(TEXT("Failed to copy file from {0} to {1}."), file, dst);
|
||||
@@ -294,7 +294,7 @@ bool CompileScriptsStep::Perform(CookingData& data)
|
||||
}
|
||||
writer.EndObject();
|
||||
|
||||
const String outputBuildInfo = data.OutputPath / TEXT("Game.Build.json");
|
||||
const String outputBuildInfo = data.CodeOutputPath / TEXT("Game.Build.json");
|
||||
if (File::WriteAllBytes(outputBuildInfo, (byte*)buffer.GetString(), (int32)buffer.GetSize()))
|
||||
{
|
||||
LOG(Error, "Failed to save binary modules info file {0}.", outputBuildInfo);
|
||||
|
||||
@@ -869,7 +869,7 @@ public:
|
||||
// Create package
|
||||
// Note: FlaxStorage::Create overrides chunks locations in file so don't use files anymore (only readonly)
|
||||
const String localPath = String::Format(TEXT("Content/Data_{0}.{1}"), _packageIndex, PACKAGE_FILES_EXTENSION);
|
||||
const String path = data.OutputPath / localPath;
|
||||
const String path = data.DataOutputPath / localPath;
|
||||
if (FlaxStorage::Create(path, assetsData, false, &CustomData))
|
||||
{
|
||||
data.Error(TEXT("Failed to create assets package."));
|
||||
@@ -1035,7 +1035,7 @@ bool CookAssetsStep::Perform(CookingData& data)
|
||||
gameFlags |= GameHeaderFlags::ShowSplashScreen;
|
||||
|
||||
// Open file
|
||||
auto stream = FileWriteStream::Open(data.OutputPath / TEXT("Content/head"));
|
||||
auto stream = FileWriteStream::Open(data.DataOutputPath / TEXT("Content/head"));
|
||||
if (stream == nullptr)
|
||||
{
|
||||
data.Error(TEXT("Failed to create game data file."));
|
||||
@@ -1129,7 +1129,7 @@ bool CookAssetsStep::Perform(CookingData& data)
|
||||
BUILD_STEP_CANCEL_CHECK;
|
||||
|
||||
// Save assets cache
|
||||
if (AssetsCache::Save(data.OutputPath / TEXT("Content/AssetsCache.dat"), AssetsRegistry, AssetPathsMapping, AssetsCacheFlags::RelativePaths))
|
||||
if (AssetsCache::Save(data.DataOutputPath / TEXT("Content/AssetsCache.dat"), AssetsRegistry, AssetPathsMapping, AssetsCacheFlags::RelativePaths))
|
||||
{
|
||||
data.Error(TEXT("Failed to create assets registry."));
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
const auto gameSettings = GameSettings::Get();
|
||||
|
||||
// Setup output folders and copy required data
|
||||
const auto contentDir = data.OutputPath / TEXT("Content");
|
||||
const auto contentDir = data.DataOutputPath / TEXT("Content");
|
||||
if (FileSystem::DirectoryExists(contentDir))
|
||||
{
|
||||
// Remove old content files
|
||||
@@ -26,7 +26,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
}
|
||||
FileSystem::CreateDirectory(contentDir);
|
||||
const auto srcMono = depsRoot / TEXT("Mono");
|
||||
const auto dstMono = data.OutputPath / TEXT("Mono");
|
||||
const auto dstMono = data.DataOutputPath / TEXT("Mono");
|
||||
if (!FileSystem::DirectoryExists(dstMono))
|
||||
{
|
||||
if (!FileSystem::DirectoryExists(srcMono))
|
||||
|
||||
@@ -24,7 +24,7 @@ bool PrecompileAssembliesStep::Perform(CookingData& data)
|
||||
data.Tools->OnConfigureAOT(data, config);
|
||||
|
||||
// Prepare output directory
|
||||
config.AotCachePath = data.OutputPath / TEXT("Mono/lib/mono/aot-cache");
|
||||
config.AotCachePath = data.DataOutputPath / TEXT("Mono/lib/mono/aot-cache");
|
||||
switch (data.Tools->GetArchitecture())
|
||||
{
|
||||
case ArchitectureType::x86:
|
||||
@@ -52,9 +52,9 @@ bool PrecompileAssembliesStep::Perform(CookingData& data)
|
||||
FileSystem::DirectoryGetFiles(config.Assemblies, dir, TEXT("*.dll"), DirectorySearchOption::TopDirectoryOnly);
|
||||
for (auto& binaryModule : data.BinaryModules)
|
||||
if (binaryModule.ManagedPath.HasChars())
|
||||
config.Assemblies.Add(data.OutputPath / binaryModule.ManagedPath);
|
||||
config.Assemblies.Add(data.CodeOutputPath / binaryModule.ManagedPath);
|
||||
// TODO: move AOT to Flax.Build and perform it on all C# assemblies used in target build
|
||||
config.Assemblies.Add(data.OutputPath / TEXT("Newtonsoft.Json.dll"));
|
||||
config.Assemblies.Add(data.CodeOutputPath / TEXT("Newtonsoft.Json.dll"));
|
||||
|
||||
// Perform AOT for the assemblies
|
||||
for (int32 i = 0; i < config.Assemblies.Count(); i++)
|
||||
|
||||
@@ -11,9 +11,17 @@ bool ValidateStep::Perform(CookingData& data)
|
||||
data.StepProgress(TEXT("Performing validation"), 0);
|
||||
|
||||
// Ensure output and cache directories exist
|
||||
if (!FileSystem::DirectoryExists(data.OutputPath))
|
||||
if (!FileSystem::DirectoryExists(data.CodeOutputPath))
|
||||
{
|
||||
if (FileSystem::CreateDirectory(data.OutputPath))
|
||||
if (FileSystem::CreateDirectory(data.CodeOutputPath))
|
||||
{
|
||||
data.Error(TEXT("Failed to create build output directory."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!FileSystem::DirectoryExists(data.DataOutputPath))
|
||||
{
|
||||
if (FileSystem::CreateDirectory(data.DataOutputPath))
|
||||
{
|
||||
data.Error(TEXT("Failed to create build output directory."));
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user