Add support for packaging editor with bundled platform data
This commit is contained in:
@@ -66,12 +66,6 @@ namespace Flax.Deploy
|
||||
{
|
||||
Initialize();
|
||||
|
||||
if (Configuration.DeployEditor)
|
||||
{
|
||||
BuildEditor();
|
||||
Deployment.Editor.Package();
|
||||
}
|
||||
|
||||
if (Configuration.DeployPlatforms)
|
||||
{
|
||||
if (Configuration.BuildPlatforms == null || Configuration.BuildPlatforms.Length == 0)
|
||||
@@ -94,6 +88,12 @@ namespace Flax.Deploy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Configuration.DeployEditor)
|
||||
{
|
||||
BuildEditor();
|
||||
Deployment.Editor.Package();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -183,6 +183,10 @@ namespace Flax.Deploy
|
||||
{
|
||||
if (Platform.IsPlatformSupported(platform, architecture))
|
||||
{
|
||||
Log.Info(string.Empty);
|
||||
Log.Info($"Build {platform} {architecture} platform");
|
||||
Log.Info(string.Empty);
|
||||
|
||||
foreach (var configuration in Configurations)
|
||||
{
|
||||
FlaxBuild.Build(Globals.EngineRoot, "FlaxGame", platform, architecture, configuration);
|
||||
|
||||
@@ -127,6 +127,33 @@ namespace Flax.Deploy
|
||||
// Deploy project
|
||||
DeployFile(RootPath, OutputPath, "Flax.flaxproj");
|
||||
|
||||
// When deploying Editor with Platforms at once then bundle them inside it
|
||||
if (Configuration.DeployPlatforms && Platforms.PackagedPlatforms != null)
|
||||
{
|
||||
foreach (var platform in Platforms.PackagedPlatforms)
|
||||
{
|
||||
Log.Info(string.Empty);
|
||||
Log.Info($"Bunding {platform} platform with Editor");
|
||||
Log.Info(string.Empty);
|
||||
|
||||
string platformName = platform.ToString();
|
||||
string platformFiles = Path.Combine(Deployer.PackageOutputPath, platformName);
|
||||
string platformData = Path.Combine(OutputPath, "Source", "Platforms", platformName);
|
||||
if (Directory.Exists(platformFiles))
|
||||
{
|
||||
// Copy deployed files
|
||||
Utilities.DirectoryCopy(platformFiles, platformData);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extract deployed files
|
||||
var packageZipPath = Path.Combine(Deployer.PackageOutputPath, platformName + ".zip");
|
||||
Log.Verbose(packageZipPath + " -> " + platformData);
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(packageZipPath, platformData, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Package Editor into macOS app
|
||||
if (Platform.BuildTargetPlatform == TargetPlatform.Mac)
|
||||
{
|
||||
@@ -167,6 +194,7 @@ namespace Flax.Deploy
|
||||
|
||||
// Build a disk image
|
||||
var dmgPath = Path.Combine(Deployer.PackageOutputPath, "FlaxEditor.dmg");
|
||||
Log.Info(string.Empty);
|
||||
Log.Info("Building disk image...");
|
||||
if (File.Exists(dmgPath))
|
||||
File.Delete(dmgPath);
|
||||
@@ -178,7 +206,6 @@ namespace Flax.Deploy
|
||||
// Compress
|
||||
if (Configuration.DontCompress)
|
||||
return;
|
||||
|
||||
Log.Info(string.Empty);
|
||||
Log.Info("Compressing editor files...");
|
||||
string editorPackageZipPath;
|
||||
|
||||
@@ -10,8 +10,13 @@ namespace Flax.Deploy
|
||||
{
|
||||
public class Platforms
|
||||
{
|
||||
internal static List<TargetPlatform> PackagedPlatforms;
|
||||
|
||||
public static void Package(TargetPlatform platform)
|
||||
{
|
||||
if (PackagedPlatforms == null)
|
||||
PackagedPlatforms = new List<TargetPlatform>();
|
||||
PackagedPlatforms.Add(platform);
|
||||
var platformsRoot = Path.Combine(Globals.EngineRoot, "Source", "Platforms");
|
||||
|
||||
Log.Info(string.Empty);
|
||||
|
||||
Reference in New Issue
Block a user