diff --git a/GameBundle/GameBundle.csproj b/GameBundle/GameBundle.csproj index efe86b2..2054a07 100644 --- a/GameBundle/GameBundle.csproj +++ b/GameBundle/GameBundle.csproj @@ -10,6 +10,7 @@ https://github.com/Ellpeck/GameBundle https://github.com/Ellpeck/GameBundle https://github.com/Ellpeck/GameBundle/blob/master/LICENSE + https://raw.githubusercontent.com/Ellpeck/GameBundle/master/Logo.png true gamebundle 0.0.1 diff --git a/GameBundle/Options.cs b/GameBundle/Options.cs index 8889ed7..33475b4 100644 --- a/GameBundle/Options.cs +++ b/GameBundle/Options.cs @@ -8,22 +8,24 @@ namespace GameBundle { public string SourceFile { get; set; } [Option('o', "output", Default = "bin/Bundled", HelpText = "The location of the directory that the bundles should be stored in")] public string OutputDirectory { get; set; } - [Option('v', "verbose", Default = false)] + [Option('v', "verbose")] public bool Verbose { get; set; } - [Option('w', "win", Default = true, HelpText = "Bundle for windows")] - public bool BundleWindows { get; set; } - [Option('l', "linux", Default = true, HelpText = "Bundle for linux")] - public bool BundleLinux { get; set; } - [Option('m', "mac", Default = true, HelpText = "Bundle for mac")] - public bool BundleMac { get; set; } + [Option('w', "no-win", HelpText = "Skip bundling for windows")] + public bool NoWindows { get; set; } + [Option('l', "no-linux", HelpText = "Skip bundling for linux")] + public bool NoLinux { get; set; } + [Option('m', "no-mac", HelpText = "Skip bundling for mac")] + public bool NoMac { get; set; } [Option('e', "exclude", Default = new[] {"openal", "oal", "sdl2", "SDL2"}, HelpText = "Files like unmanaged libraries that should not be moved to the /Lib folder")] public string[] ExcludedFiles { get; set; } - [Option("32bit", Default = false, 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; } - [Option("trim", Default = true, HelpText = "Trim the application when publishing")] - public bool Trim { get; set; } + [Option('t', "no-trim", HelpText = "Skip trimming the application when publishing")] + public bool NoTrim { get; set; } + [Option('c', "config", Default = "Release", HelpText = "The build configuration to use")] + public string BuildConfig { get; set; } } } \ No newline at end of file diff --git a/GameBundle/Program.cs b/GameBundle/Program.cs index 4ce13fb..c3bbd15 100644 --- a/GameBundle/Program.cs +++ b/GameBundle/Program.cs @@ -26,15 +26,15 @@ namespace GameBundle { if (!bundleDir.Exists) bundleDir.Create(); - if (options.BundleWindows) { + if (!options.NoWindows) { Console.WriteLine("Bundling for windows"); Publish(options, proj, $"{bundleDir}/win", options.Publish32Bit ? "win-x86" : "win-x64"); } - if (options.BundleLinux) { + if (!options.NoLinux) { Console.WriteLine("Bundling for linux"); Publish(options, proj, $"{bundleDir}/linux", "linux-x64"); } - if (options.BundleMac) { + if (!options.NoMac) { Console.WriteLine("Bundling for mac"); Publish(options, proj, $"{bundleDir}/mac", "osx-x64"); } @@ -44,7 +44,7 @@ namespace GameBundle { } private static void Publish(Options options, FileInfo proj, string path, string rid) { - RunProcess(options, "dotnet", $"publish {proj.FullName} -o {path} -r {rid} /p:PublishTrimmed={options.Trim}"); + RunProcess(options, "dotnet", $"publish {proj.FullName} -o {path} -r {rid} -c {options.BuildConfig} /p:PublishTrimmed={!options.NoTrim}"); // Run beauty var excludes = string.Empty; diff --git a/Logo.png b/Logo.png new file mode 100644 index 0000000..a2b08cd Binary files /dev/null and b/Logo.png differ diff --git a/README.md b/README.md index 251eb6b..6dcfd2e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ -# GameBundle -A tool to package MonoGame and other .NET Core applications into several distributable formats + + +**GameBundle** is a tool to package MonoGame and other .NET Core applications into several distributable formats. + +# Installing +GameBundle is a `dotnet` tool, meaning you can install it very easily like so: +``` +dotnet tool install --global GameBundle +``` +# Using +By default, GameBundle builds the `.csproj` file that it finds in the directory that it is run from. The bundled outputs go into `bin/Bundled` by default. + +To build and bundle your app for Linux, Windows and Mac, all you have to do is run the following command from the directory that contains your project file: +``` +gamebundle +``` + +GameBundle will then build a self-contained release of your application for each system using `dotnet publish` and clean up the output directory using [NetCoreBeauty](https://github.com/nulastudio/NetCoreBeauty) by moving most of the libraries into a `Lib` subdirectory. + +# Configuring +GameBundle takes several optional arguments to modify the way it works. To see a list of all possible arguments, simply run +``` +gamebundle --help +``` \ No newline at end of file