allow passing additional arguments to the publish command

This commit is contained in:
Ell 2021-01-28 05:58:53 +01:00
parent 8b27505359
commit 08413ae9d7
4 changed files with 9 additions and 5 deletions

View file

@ -13,7 +13,7 @@
<PackageIconUrl>https://raw.githubusercontent.com/Ellpeck/GameBundle/master/Logo.png</PackageIconUrl>
<PackAsTool>true</PackAsTool>
<ToolCommandName>gamebundle</ToolCommandName>
<VersionPrefix>1.3.0</VersionPrefix>
<VersionPrefix>1.3.1</VersionPrefix>
</PropertyGroup>
<ItemGroup>

View file

@ -38,6 +38,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('a', "build-args", HelpText = "Additional arguments that should be passed to the dotnet publish command")]
public string BuildArgs { get; set; }
}
}

View file

@ -11,7 +11,10 @@ namespace GameBundle {
internal static class Program {
private static int Main(string[] args) {
return Parser.Default.ParseArguments<Options>(args).MapResult(Run, _ => -1);
return new Parser(c => {
c.HelpWriter = Console.Error;
c.EnableDashDash = true;
}).ParseArguments<Options>(args).MapResult(Run, _ => -1);
}
private static int Run(Options options) {
@ -60,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}");
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;

View file

@ -11,8 +11,7 @@
<PackageReference Include="Contentless" Version="2.0.*" />
<PackageReference Include="MLEM.Startup" Version="3.2.*" />
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.*" />
<!--http://teamcity.monogame.net/guestAuth/app/nuget/v1/FeedService.svc/-->
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1231-develop" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
</ItemGroup>
<ItemGroup>