mirror of
https://github.com/Ellpeck/GameBundle.git
synced 2024-11-26 02:18:35 +01:00
allow specifying a project display name
This commit is contained in:
parent
08413ae9d7
commit
78c02a5530
3 changed files with 12 additions and 9 deletions
|
@ -11,21 +11,18 @@ namespace GameBundle {
|
|||
public string OutputDirectory { get; set; }
|
||||
[Option('v', "verbose")]
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
[Option('w', "win", HelpText = "Bundle for windows")]
|
||||
public bool BuildWindows { get; set; }
|
||||
[Option('l', "linux", HelpText = "Bundle for linux")]
|
||||
public bool BuildLinux { get; set; }
|
||||
[Option('m', "mac", HelpText = "Bundle for mac")]
|
||||
public bool BuildMac { get; set; }
|
||||
|
||||
[Option('b', "mac-bundle", HelpText = "Create an app bundle for mac")]
|
||||
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")]
|
||||
public IEnumerable<string> MacBundleResources { get; set; }
|
||||
[Option('z', "zip", HelpText = "Store the build results in zip files instead of folders")]
|
||||
public bool Zip { get; set; }
|
||||
|
||||
[Option('e', "exclude", HelpText = "Files that should not be moved to the library folder")]
|
||||
public IEnumerable<string> ExcludedFiles { get; set; }
|
||||
[Option("32-bit", HelpText = "Publish for 32 bit instead of 64 bit. Note that this is only possible on Windows")]
|
||||
|
@ -38,6 +35,8 @@ namespace GameBundle {
|
|||
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('d', "display-name", HelpText = "The name that should be used for --name-builds and the app bundle instead of the project's name")]
|
||||
public string DisplayName { get; set; }
|
||||
[Option('a', "build-args", HelpText = "Additional arguments that should be passed to the dotnet publish command")]
|
||||
public string BuildArgs { get; set; }
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace GameBundle {
|
|||
var dir = GetBuildDir(options, proj, "mac");
|
||||
var res = Publish(options, proj, dir, "osx-x64", () => {
|
||||
if (options.MacBundle)
|
||||
CreateMacBundle(options, new DirectoryInfo(dir), proj.FullName);
|
||||
CreateMacBundle(options, new DirectoryInfo(dir), proj);
|
||||
});
|
||||
if (res != 0)
|
||||
return res;
|
||||
|
@ -63,7 +63,7 @@ namespace GameBundle {
|
|||
}
|
||||
|
||||
private static int Publish(Options options, FileInfo proj, string path, string rid, Action additionalAction = null) {
|
||||
var publishResult = RunProcess(options, "dotnet", $"publish {proj.FullName} -o {path} -r {rid} -c {options.BuildConfig} /p:PublishTrimmed={options.Trim} {options.BuildArgs}");
|
||||
var publishResult = RunProcess(options, "dotnet", $"publish \"{proj.FullName}\" -o \"{path}\" -r {rid} -c {options.BuildConfig} /p:PublishTrimmed={options.Trim} {options.BuildArgs}");
|
||||
if (publishResult != 0)
|
||||
return publishResult;
|
||||
|
||||
|
@ -116,8 +116,8 @@ namespace GameBundle {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static void CreateMacBundle(Options options, DirectoryInfo dir, string proj) {
|
||||
var app = dir.CreateSubdirectory($"{Path.GetFileNameWithoutExtension(proj)}.app");
|
||||
private static void CreateMacBundle(Options options, DirectoryInfo dir, FileInfo proj) {
|
||||
var app = dir.CreateSubdirectory($"{GetDisplayName(options, proj)}.app");
|
||||
var contents = app.CreateSubdirectory("Contents");
|
||||
var resources = contents.CreateSubdirectory("Resources");
|
||||
var macOs = contents.CreateSubdirectory("MacOS");
|
||||
|
@ -146,9 +146,13 @@ namespace GameBundle {
|
|||
private static string GetBuildDir(Options options, FileInfo proj, string osName) {
|
||||
var dir = Path.GetFullPath(options.OutputDirectory);
|
||||
if (options.NameBuilds)
|
||||
return $"{dir}/{Path.GetFileNameWithoutExtension(proj.Name)}-{osName}";
|
||||
return $"{dir}/{GetDisplayName(options, proj)}-{osName}";
|
||||
return $"{dir}/{osName}";
|
||||
}
|
||||
|
||||
private static string GetDisplayName(Options options, FileInfo proj) {
|
||||
return string.IsNullOrEmpty(options.DisplayName) ? Path.GetFileNameWithoutExtension(proj.Name) : options.DisplayName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
"../GameBundle/bin/Debug/netcoreapp3.1/GameBundle.exe" -wlm -bzn -s Test.csproj -o bin/Bundled -v
|
||||
"../GameBundle/bin/Debug/netcoreapp3.1/GameBundle.exe" -wlm -bzn -s Test.csproj -o bin/Bundled -v -d "Test Project"
|
Loading…
Reference in a new issue