added an option to skip beautify

This commit is contained in:
Ell 2021-10-16 19:35:53 +02:00
parent 64a56b25d4
commit ec45ab5a78
2 changed files with 23 additions and 15 deletions

View file

@ -11,34 +11,40 @@ namespace GameBundle {
public string OutputDirectory { get; set; } public string OutputDirectory { get; set; }
[Option('v', "verbose")] [Option('v', "verbose")]
public bool Verbose { get; set; } public bool Verbose { get; set; }
[Option('w', "win", HelpText = "Bundle for windows")] [Option('w', "win", HelpText = "Bundle for windows")]
public bool BuildWindows { get; set; } public bool BuildWindows { get; set; }
[Option('l', "linux", HelpText = "Bundle for linux")] [Option('l', "linux", HelpText = "Bundle for linux")]
public bool BuildLinux { get; set; } public bool BuildLinux { get; set; }
[Option('m', "mac", HelpText = "Bundle for mac")] [Option('m', "mac", HelpText = "Bundle for mac")]
public bool BuildMac { get; set; } public bool BuildMac { get; set; }
[Option('z', "zip", HelpText = "Store the build results in zip files instead of folders")]
public bool Zip { get; set; }
[Option('b', "mac-bundle", HelpText = "Create an app bundle for mac")] [Option('b', "mac-bundle", HelpText = "Create an app bundle for mac")]
public bool MacBundle { get; set; } public bool MacBundle { get; set; }
[Option("mac-bundle-resources", Default = new[] {"Content", "*.icns"}, HelpText = "When creating an app bundle for mac, things that should go into the Resources folder rather than the MacOS folder")] [Option("mac-bundle-resources", Default = new[] {"Content", "*.icns"}, HelpText = "When creating an app bundle for mac, things that should go into the Resources folder rather than the MacOS folder")]
public IEnumerable<string> MacBundleResources { get; set; } public IEnumerable<string> MacBundleResources { get; set; }
[Option("mac-bundle-ignore", Default = new string[0], HelpText = "When creating an app bundle for mac, things that should be left out of the mac bundle and stay in the output folder")] [Option("mac-bundle-ignore", Default = new string[0], HelpText = "When creating an app bundle for mac, things that should be left out of the mac bundle and stay in the output folder")]
public IEnumerable<string> MacBundleIgnore { get; set; } public IEnumerable<string> MacBundleIgnore { get; set; }
[Option('z', "zip", HelpText = "Store the build results in zip files instead of folders")]
public bool Zip { get; set; } [Option("skip-lib", HelpText = "When bundling, skip beautifying the output by moving files to the library folder")]
public bool SkipLib { get; set; }
[Option('e', "exclude", HelpText = "Files that should not be moved to the library folder")] [Option('e', "exclude", HelpText = "Files that should not be moved to the library folder")]
public IEnumerable<string> ExcludedFiles { get; set; } public IEnumerable<string> ExcludedFiles { get; set; }
[Option("lib-name", Default = "Lib", HelpText = "The name of the library folder that is created")]
public string LibFolder { get; set; }
[Option("32-bit", HelpText = "Publish for 32 bit instead of 64 bit. Note that this is only possible on Windows")] [Option("32-bit", HelpText = "Publish for 32 bit instead of 64 bit. Note that this is only possible on Windows")]
public bool Publish32Bit { get; set; } public bool Publish32Bit { get; set; }
[Option('t', "trim", HelpText = "Trim the application when publishing")] [Option('t', "trim", HelpText = "Trim the application when publishing")]
public bool Trim { get; set; } public bool Trim { get; set; }
[Option('c', "config", Default = "Release", HelpText = "The build configuration to use")] [Option('c', "config", Default = "Release", HelpText = "The build configuration to use")]
public string BuildConfig { get; set; } public string BuildConfig { get; set; }
[Option("lib-name", Default = "Lib", HelpText = "The name of the library folder that is created")]
public string LibFolder { get; set; }
[Option('n', "name-builds", HelpText = "Name the build output directories by the project's name")]
public bool NameBuilds { get; set; }
[Option('a', "build-args", HelpText = "Additional arguments that should be passed to the dotnet publish command")] [Option('a', "build-args", HelpText = "Additional arguments that should be passed to the dotnet publish command")]
public string BuildArgs { get; set; } public string BuildArgs { get; set; }
[Option('n', "name-builds", HelpText = "Name the build output directories by the project's name")]
public bool NameBuilds { get; set; }
} }
} }

View file

@ -68,6 +68,7 @@ namespace GameBundle {
return publishResult; return publishResult;
// Run beauty // Run beauty
if (!options.SkipLib) {
var excludes = $"\"{string.Join(";", options.ExcludedFiles)}\""; var excludes = $"\"{string.Join(";", options.ExcludedFiles)}\"";
var log = options.Verbose ? "Detail" : "Error"; var log = options.Verbose ? "Detail" : "Error";
var beautyResult = RunProcess(options, "dotnet", $"ncbeauty --loglevel={log} --force=True \"{path}\" \"{options.LibFolder}\" {excludes}", AppDomain.CurrentDomain.BaseDirectory); var beautyResult = RunProcess(options, "dotnet", $"ncbeauty --loglevel={log} --force=True \"{path}\" \"{options.LibFolder}\" {excludes}", AppDomain.CurrentDomain.BaseDirectory);
@ -78,6 +79,7 @@ namespace GameBundle {
var beautyFile = new FileInfo(Path.Combine(path, "NetCoreBeauty")); var beautyFile = new FileInfo(Path.Combine(path, "NetCoreBeauty"));
if (beautyFile.Exists) if (beautyFile.Exists)
beautyFile.Delete(); beautyFile.Delete();
}
// Run any additional actions like creating the mac bundle // Run any additional actions like creating the mac bundle
additionalAction?.Invoke(); additionalAction?.Invoke();