Add back includePdb option

This commit is contained in:
Caelan Sayler
2024-02-14 22:13:26 +00:00
parent e726bb7251
commit bcdcbb4cda
8 changed files with 35 additions and 8 deletions

View File

@@ -29,4 +29,6 @@ public class LinuxPackOptions : IPackOptions
public string Channel { get; set; }
public bool PackIsAppDir { get; set; }
public bool IncludePdb { get; set; }
}

View File

@@ -29,4 +29,6 @@ public class OsxPackOptions : OsxBundleOptions, IPackOptions
public string NotaryProfile { get; set; }
public string Channel { get; set; }
public bool IncludePdb { get; set; }
}

View File

@@ -15,4 +15,6 @@ public class WindowsPackOptions : WindowsReleasifyOptions, INugetPackCommand, IP
public string PackTitle { get; set; }
public string ReleaseNotes { get; set; }
public bool IncludePdb { get; set; }
}

View File

@@ -5,4 +5,5 @@ public interface IPackOptions : INugetPackCommand, IPlatformOptions
string Channel { get; }
DeltaMode DeltaMode { get; }
string EntryExecutableName { get; }
bool IncludePdb { get; }
}

View File

@@ -32,7 +32,8 @@ public abstract class PackageBuilder<T> : ICommand<T>
protected string RuntimeDependencies { get; private set; }
private readonly Regex REGEX_EXCLUDES = new Regex(@".*[\\\/]createdump.*|.*\.vshost\..*|.*\.nupkg$|.*\.pdb$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private readonly Regex REGEX_EXCLUDES = new Regex(@".*[\\\/]createdump.*|.*\.vshost\..*|.*\.nupkg$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private readonly Regex REGEX_EXCLUDES_NO_PDB = new Regex(@".*[\\\/]createdump.*|.*\.vshost\..*|.*\.nupkg$|.*\.pdb$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public PackageBuilder(RuntimeOs supportedOs, ILogger logger, IFancyConsole console)
{
@@ -279,6 +280,7 @@ public abstract class PackageBuilder<T> : ICommand<T>
protected virtual void CopyFiles(DirectoryInfo source, DirectoryInfo target, Action<int> progress, bool excludeAnnoyances = false)
{
var excludes = Options.IncludePdb ? REGEX_EXCLUDES : REGEX_EXCLUDES_NO_PDB;
var numFiles = source.EnumerateFiles("*", SearchOption.AllDirectories).Count();
int currentFile = 0;
@@ -288,7 +290,7 @@ public abstract class PackageBuilder<T> : ICommand<T>
var path = Path.Combine(target.FullName, fileInfo.Name);
currentFile++;
progress((int) ((double) currentFile / numFiles * 100));
if (excludeAnnoyances && REGEX_EXCLUDES.IsMatch(path)) {
if (excludeAnnoyances && excludes.IsMatch(path)) {
Log.Debug("Skipping because matched exclude pattern: " + path);
continue;
}

View File

@@ -24,6 +24,8 @@ public class LinuxPackCommand : PlatformCommand
public DeltaMode DeltaMode { get; set; } = DeltaMode.BestSpeed;
public bool IncludePdb { get; set; }
public LinuxPackCommand()
: this("pack", "Create's a Linux .AppImage bundle from a folder containing application files.")
{ }
@@ -75,13 +77,17 @@ public class LinuxPackCommand : PlatformCommand
.SetDefault(DeltaMode.BestSpeed)
.SetDescription("Set the delta generation mode.");
AddOption<bool>((v) => IncludePdb = v, "--includePdb")
.SetDescription("Include PDB files in the release instead of removing.")
.SetHidden();
var appDir = AddOption<DirectoryInfo>((v) => {
var t = v.ToFullNameOrNull();
if (t != null) {
PackDirectory = t;
PackIsAppDir = true;
}
}, "--appDir")
var t = v.ToFullNameOrNull();
if (t != null) {
PackDirectory = t;
PackIsAppDir = true;
}
}, "--appDir")
.SetDescription("Directory containing application in .AppDir format")
.SetArgumentHelpName("DIR")
.MustNotBeEmpty();

View File

@@ -26,6 +26,8 @@ public class OsxPackCommand : OsxBundleCommand
public string NotaryProfile { get; private set; }
public bool IncludePdb { get; set; }
public OsxPackCommand()
: base("pack", "Converts application files into a release and installer.")
{
@@ -78,5 +80,9 @@ public class OsxPackCommand : OsxBundleCommand
AddOption<string>((v) => NotaryProfile = v, "--notaryProfile")
.SetDescription("Name of profile containing Apple credentials stored with notarytool.")
.SetArgumentHelpName("NAME");
AddOption<bool>((v) => IncludePdb = v, "--includePdb")
.SetDescription("Include PDB files in the release instead of removing.")
.SetHidden();
}
}

View File

@@ -15,6 +15,8 @@ public class WindowsPackCommand : WindowsReleasifyCommand
public string ReleaseNotes { get; private set; }
public bool IncludePdb { get; set; }
public WindowsPackCommand()
: base("pack", "Creates a release from a folder containing application files.")
{
@@ -49,5 +51,9 @@ public class WindowsPackCommand : WindowsReleasifyCommand
.SetDescription("File with markdown-formatted notes for this version.")
.SetArgumentHelpName("PATH")
.MustExist();
AddOption<bool>((v) => IncludePdb = v, "--includePdb")
.SetDescription("Include PDB files in the release instead of removing.")
.SetHidden();
}
}