Merge pull request #73939 from raulsntos/dotnet/export-symbols

C#: Add option to disable exporting debug symbols
This commit is contained in:
Rémi Verschelde 2023-06-09 12:14:15 +02:00
commit 5047892939
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 27 additions and 10 deletions

View file

@ -279,12 +279,19 @@ namespace GodotTools.Build
[DisallowNull] string configuration,
[DisallowNull] string platform,
[DisallowNull] string runtimeIdentifier,
[DisallowNull] string publishOutputDir
[DisallowNull] string publishOutputDir,
bool includeDebugSymbols = true
)
{
var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, GodotSharpDirs.ProjectCsProjPath, configuration,
runtimeIdentifier, publishOutputDir, restore: true, rebuild: false, onlyClean: false);
if (!includeDebugSymbols)
{
buildInfo.CustomProperties.Add("DebugType=None");
buildInfo.CustomProperties.Add("DebugSymbols=false");
}
buildInfo.CustomProperties.Add($"GodotTargetPlatform={platform}");
if (Internal.GodotIsRealTDouble())
@ -308,9 +315,10 @@ namespace GodotTools.Build
[DisallowNull] string configuration,
[DisallowNull] string platform,
[DisallowNull] string runtimeIdentifier,
string publishOutputDir
string publishOutputDir,
bool includeDebugSymbols = true
) => PublishProjectBlocking(CreatePublishBuildInfo(configuration,
platform, runtimeIdentifier, publishOutputDir));
platform, runtimeIdentifier, publishOutputDir, includeDebugSymbols));
public static bool EditorBuildCallback()
{

View file

@ -1,7 +1,6 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using GodotTools.Build;
@ -35,6 +34,17 @@ namespace GodotTools.Export
}
},
{ "default_value", false }
},
new Godot.Collections.Dictionary()
{
{
"option", new Godot.Collections.Dictionary()
{
{ "name", "dotnet/include_debug_symbols" },
{ "type", (int)Variant.Type.Bool }
}
},
{ "default_value", true }
}
};
}
@ -110,11 +120,10 @@ namespace GodotTools.Export
throw new NotImplementedException("Target platform not yet implemented.");
}
string outputDir = new FileInfo(path).Directory?.FullName ??
throw new FileNotFoundException("Output base directory not found.");
string buildConfig = isDebug ? "ExportDebug" : "ExportRelease";
bool includeDebugSymbols = (bool)GetOption("dotnet/include_debug_symbols");
var archs = new List<string>();
if (features.Contains("x86_64"))
{
@ -151,7 +160,7 @@ namespace GodotTools.Export
// Create temporary publish output directory
string publishOutputTempDir = Path.Combine(Path.GetTempPath(), "godot-publish-dotnet",
$"{Process.GetCurrentProcess().Id}-{buildConfig}-{runtimeIdentifier}");
$"{System.Environment.ProcessId}-{buildConfig}-{runtimeIdentifier}");
_tempFolders.Add(publishOutputTempDir);
@ -161,7 +170,7 @@ namespace GodotTools.Export
// Execute dotnet publish
if (!BuildManager.PublishProjectBlocking(buildConfig, platform,
runtimeIdentifier, publishOutputTempDir))
runtimeIdentifier, publishOutputTempDir, includeDebugSymbols))
{
throw new InvalidOperationException("Failed to build project.");
}
@ -215,7 +224,7 @@ namespace GodotTools.Export
{
base._ExportEnd();
string aotTempDir = Path.Combine(Path.GetTempPath(), $"godot-aot-{Process.GetCurrentProcess().Id}");
string aotTempDir = Path.Combine(Path.GetTempPath(), $"godot-aot-{System.Environment.ProcessId}");
if (Directory.Exists(aotTempDir))
Directory.Delete(aotTempDir, recursive: true);