From 722861b929b723b2ea55be2293f16444e44c702d Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 13 Mar 2021 12:47:55 +0100 Subject: [PATCH] Add script to package editor for linux --- PackageEditor.sh | 12 ++++++ PackagePlatforms.sh | 2 +- Source/Tools/Flax.Build/Deploy/Deployer.cs | 7 ++-- .../Flax.Build/Deploy/Deployment.Editor.cs | 42 +++++++++++++++---- 4 files changed, 51 insertions(+), 12 deletions(-) create mode 100755 PackageEditor.sh diff --git a/PackageEditor.sh b/PackageEditor.sh new file mode 100755 index 000000000..865013285 --- /dev/null +++ b/PackageEditor.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Copyright (c) 2012-2020 Wojciech Figat. All rights reserved. + +set -e + +echo Building and packaging Flax Editor... + +# Change the path to the script root +cd "`dirname "$0"`" + +# Run Flax.Build (also pass the arguments) +bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployEditor --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackagePlatforms.sh b/PackagePlatforms.sh index 83cf9f4a5..0e1ae76f8 100755 --- a/PackagePlatforms.sh +++ b/PackagePlatforms.sh @@ -8,5 +8,5 @@ echo Building and packaging platforms data... # Change the path to the script root cd "`dirname "$0"`" -# Run Flax.Build to generate project files (also pass the arguments) +# Run Flax.Build (also pass the arguments) bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployPlatforms --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/Source/Tools/Flax.Build/Deploy/Deployer.cs b/Source/Tools/Flax.Build/Deploy/Deployer.cs index 472a94c22..9b6ac7657 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployer.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployer.cs @@ -103,9 +103,10 @@ namespace Flax.Deploy private static void BuildEditor() { - FlaxBuild.Build(Globals.EngineRoot, "FlaxEditor", TargetPlatform.Windows, TargetArchitecture.x64, TargetConfiguration.Debug); - FlaxBuild.Build(Globals.EngineRoot, "FlaxEditor", TargetPlatform.Windows, TargetArchitecture.x64, TargetConfiguration.Development); - FlaxBuild.Build(Globals.EngineRoot, "FlaxEditor", TargetPlatform.Windows, TargetArchitecture.x64, TargetConfiguration.Release); + var targetPlatform = Platform.BuildPlatform.Target; + FlaxBuild.Build(Globals.EngineRoot, "FlaxEditor", targetPlatform, TargetArchitecture.x64, TargetConfiguration.Debug); + FlaxBuild.Build(Globals.EngineRoot, "FlaxEditor", targetPlatform, TargetArchitecture.x64, TargetConfiguration.Development); + FlaxBuild.Build(Globals.EngineRoot, "FlaxEditor", targetPlatform, TargetArchitecture.x64, TargetConfiguration.Release); } private static bool CannotBuildPlatform(TargetPlatform platform) diff --git a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs index b545f844d..8164214cc 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs @@ -50,6 +50,10 @@ namespace Flax.Deploy { DeployFolder(RootPath, OutputPath, "Source/Platforms/Editor/Windows/Mono"); } + else if (Platform.BuildPlatform.Target == TargetPlatform.Linux) + { + DeployFolder(RootPath, OutputPath, "Source/Platforms/Editor/Linux/Mono"); + } else { throw new NotImplementedException(); @@ -120,18 +124,21 @@ namespace Flax.Deploy } Log.Info("Compressed editor package size: " + Utilities.GetFileSize(editorPackageZipPath)); - Log.Info("Compressing editor debug symbols files..."); - editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "EditorDebugSymbols.zip"); - using (ZipFile zip = new ZipFile()) + if (Platform.BuildPlatform.Target == TargetPlatform.Windows) { - zip.AddDirectory(Path.Combine(Deployer.PackageOutputPath, "EditorDebugSymbols")); + Log.Info("Compressing editor debug symbols files..."); + editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "EditorDebugSymbols.zip"); + using (ZipFile zip = new ZipFile()) + { + zip.AddDirectory(Path.Combine(Deployer.PackageOutputPath, "EditorDebugSymbols")); - zip.CompressionLevel = CompressionLevel.BestCompression; - zip.Comment = string.Format("Flax Editor {0}.{1}.{2}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, DateTime.UtcNow); + zip.CompressionLevel = CompressionLevel.BestCompression; + zip.Comment = string.Format("Flax Editor {0}.{1}.{2}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, DateTime.UtcNow); - zip.Save(editorPackageZipPath); + zip.Save(editorPackageZipPath); + } + Log.Info("Compressed editor debug symbols package size: " + Utilities.GetFileSize(editorPackageZipPath)); } - Log.Info("Compressed editor debug symbols package size: " + Utilities.GetFileSize(editorPackageZipPath)); // Cleanup Utilities.DirectoryDelete(OutputPath); @@ -171,6 +178,25 @@ namespace Flax.Deploy File.Delete(Path.Combine(dstDebug, "FlaxEngine.CSharp.pdb")); File.Delete(Path.Combine(dstDebug, "Newtonsoft.Json.pdb")); } + else if (Platform.BuildPlatform.Target == TargetPlatform.Linux) + { + var binariesSubDir = "Binaries/Editor/Linux/" + configuration; + var src = Path.Combine(RootPath, binariesSubDir); + var dst = Path.Combine(OutputPath, binariesSubDir); + Directory.CreateDirectory(dst); + + // Deploy binaries + DeployFile(src, dst, "FlaxEditor"); + DeployFile(src, dst, "FlaxEditor.Build.json"); + DeployFile(src, dst, "FlaxEngine.CSharp.pdb"); + DeployFile(src, dst, "FlaxEngine.CSharp.xml"); + DeployFile(src, dst, "Newtonsoft.Json.pdb"); + DeployFiles(src, dst, "*.dll"); + DeployFiles(src, dst, "*.so"); + DeployFile(src, dst, "libmonosgen-2.0.so.1"); + DeployFile(src, dst, "libmonosgen-2.0.so.1.0.0"); + DeployFile(src, dst, "Logo.png"); + } else { throw new NotImplementedException();