From a2087297e0e8803dec2d230ebe267fcf75364f82 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 6 Dec 2024 11:37:01 +0100 Subject: [PATCH] Add deploying game debug symbols for Windows builds --- Source/Tools/Flax.Build/Deploy/Deployer.cs | 16 ++++++++++++++++ .../Flax.Build/Deploy/Deployment.Platforms.cs | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Source/Tools/Flax.Build/Deploy/Deployer.cs b/Source/Tools/Flax.Build/Deploy/Deployer.cs index aed145a26..c9809a97d 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployer.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployer.cs @@ -93,6 +93,22 @@ namespace Flax.Deploy BuildPlatform(platform, architectures); } } + + if (Platform.BuildTargetPlatform == TargetPlatform.Windows) + { + Log.Info("Compressing game debug symbols files..."); + var gamePackageZipPath = Path.Combine(Deployer.PackageOutputPath, "GameDebugSymbols.zip"); + Utilities.FileDelete(gamePackageZipPath); + using (var zip = new Ionic.Zip.ZipFile()) + { + zip.AddDirectory(Path.Combine(Deployer.PackageOutputPath, "GameDebugSymbols")); + zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression; + zip.Comment = string.Format("Flax Game {0}.{1}.{2}\nDate: {3}", Deployer.VersionMajor, Deployer.VersionMinor, Deployer.VersionBuild, DateTime.UtcNow); + zip.Save(gamePackageZipPath); + } + Log.Info("Compressed game debug symbols package size: " + Utilities.GetFileSize(gamePackageZipPath)); + } + Utilities.DirectoryDelete(Path.Combine(Deployer.PackageOutputPath, "GameDebugSymbols")); } if (Configuration.DeployEditor) diff --git a/Source/Tools/Flax.Build/Deploy/Deployment.Platforms.cs b/Source/Tools/Flax.Build/Deploy/Deployment.Platforms.cs index 805cfdbe9..ef3b991d7 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployment.Platforms.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployment.Platforms.cs @@ -28,6 +28,18 @@ namespace Flax.Deploy string dst = Path.Combine(Deployer.PackageOutputPath, platformName); Utilities.DirectoryDelete(dst); + // Deploy debug files for crashes debugging + foreach (var configuration in new[] { TargetConfiguration.Debug, TargetConfiguration.Development, TargetConfiguration.Release }) + { + if (platform == TargetPlatform.Windows) + { + var dstDebug = Path.Combine(Deployer.PackageOutputPath, $"GameDebugSymbols/{platform}/{configuration}"); + Directory.CreateDirectory(dstDebug); + var binaries = Path.Combine(src, "Binaries", "Game", "x64", configuration.ToString()); + DeployFiles(binaries, dstDebug, "*.pdb"); + } + } + // Deploy files { DeployFolder(platformsRoot, Deployer.PackageOutputPath, platformName);