Skip to content

Commit

Permalink
Remember arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus committed Nov 15, 2023
1 parent 730d748 commit d4b1c7b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Source/Bake/Cooking/Composers/DotNetComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private IEnumerable<Recipe> CreateRecipe(
configuration,
Platform.Any,
path,
properties,
new DirectoryArtifact(
Path.Combine(visualStudioProject.Directory, path)));

Expand Down Expand Up @@ -296,6 +297,7 @@ private IEnumerable<Recipe> CreateRecipe(
configuration,
targetPlatform,
path,
properties,
new ExecutableArtifact(
visualStudioProject.CsProj.ToolCommandName,
Path.Combine(
Expand Down
3 changes: 2 additions & 1 deletion Source/Bake/Cooking/Cooks/DotNet/DotNetPublishCook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ protected override async Task<bool> CookAsync(
recipe.Build,
recipe.Configuration,
recipe.Platform,
recipe.Output);
recipe.Output,
recipe.Properties);

using var toolResult = await _dotNet.PublishAsync(
argument,
Expand Down
5 changes: 5 additions & 0 deletions Source/Bake/Services/Tools/DotNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ public async Task<IToolResult> PublishAsync(
});
}

foreach (var (property, value) in argument.Properties)
{
arguments.Add($"-p:{property}={value.ToMsBuildEscaped()}");
}

AddIf(!argument.Build, arguments, "--no-build");
AddIf(argument.PublishSingleFile, arguments, "-p:PublishSingleFile=true");
AddIf(argument.SelfContained, arguments, "--self-contained", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// SOFTWARE.

using Bake.ValueObjects;
using System.Collections.Generic;

namespace Bake.Services.Tools.DotNetArguments
{
Expand All @@ -32,6 +33,7 @@ public class DotNetPublishArgument : DotNetArgument
public string Configuration { get; }
public Platform Platform { get; }
public string Output { get; }
public Dictionary<string, string> Properties { get; }

public DotNetPublishArgument(
string filePath,
Expand All @@ -40,7 +42,8 @@ public DotNetPublishArgument(
bool build,
string configuration,
Platform platform,
string output)
string output,
Dictionary<string, string> properties)
: base(filePath)
{
PublishSingleFile = publishSingleFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// SOFTWARE.

using System;
using System.Collections.Generic;
using Bake.ValueObjects.Artifacts;
using YamlDotNet.Serialization;

Expand Down Expand Up @@ -50,6 +51,9 @@ public class DotNetPublishRecipe : Recipe
[YamlMember]
public string Output { get; [Obsolete] set; }

[YamlMember]
public Dictionary<string, string> Properties { get; [Obsolete] set; }

[Obsolete]
public DotNetPublishRecipe() { }

Expand All @@ -61,6 +65,7 @@ public DotNetPublishRecipe(
string configuration,
Platform platform,
string output,
Dictionary<string, string> properties,
params Artifact[] artifacts)
: base(artifacts)
{
Expand All @@ -72,6 +77,7 @@ public DotNetPublishRecipe(
Configuration = configuration;
Platform = platform;
Output = output;
Properties = properties;
#pragma warning restore CS0612 // Type or member is obsolete
}
}
Expand Down

0 comments on commit d4b1c7b

Please sign in to comment.