Skip to content

Commit

Permalink
(GH-2839) Add support for PublishReadyToRunShowWarnings property in D…
Browse files Browse the repository at this point in the history
…otNetCorePublish

```csharp
DotNetCorePublish("./src/MyApp/MyApp.csproj", new DotNetCorePublishSettings
{
    // ...
    PublishReadyToRun = true,
    PublishReadyToRunShowWarnings = true, // <<<
});
```
  • Loading branch information
augustoproiete committed Sep 7, 2020
1 parent e3d84fd commit ab8a551
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,20 @@ public void Should_Add_PublishReadyToRun()
// Then
Assert.Equal("publish -p:PublishReadyToRun=true", result.Args);
}

[Fact]
public void Should_Add_PublishReadyToRunShowWarnings()
{
// Given
var fixture = new DotNetCorePublisherFixture();
fixture.Settings.PublishReadyToRunShowWarnings = true;

// When
var result = fixture.Run();

// Then
Assert.Equal("publish -p:PublishReadyToRunShowWarnings=true", result.Args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ public sealed class DotNetCorePublishSettings : DotNetCoreSettings
/// </remarks>
public bool? PublishReadyToRun { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to show warnings emitted by ReadyToRun (R2R) compilation.
/// </summary>
/// <remarks>
/// Requires .NET Core 3.x or newer. Tiered compilation is enabled by default in .NET Core 3.
/// </remarks>
public bool? PublishReadyToRunShowWarnings { get; set; }

/// <summary>
/// Gets or sets the specified NuGet package sources to use during the restore.
/// </summary>
Expand Down
13 changes: 13 additions & 0 deletions src/Cake.Common/Tools/DotNetCore/Publish/DotNetCorePublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,19 @@ private ProcessArgumentBuilder GetArguments(string path, DotNetCorePublishSettin
}
}

// Publish ReadyToRunShowWarnings
if (settings.PublishReadyToRunShowWarnings.HasValue)
{
if (settings.PublishReadyToRunShowWarnings.Value)
{
builder.Append("-p:PublishReadyToRunShowWarnings=true");
}
else
{
builder.Append("-p:PublishReadyToRunShowWarnings=false");
}
}

// Sources
if (settings.Sources != null)
{
Expand Down

0 comments on commit ab8a551

Please sign in to comment.