Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-2839: Add support for PublishReadyToRunShowWarnings property in DotNetCorePublish #2840

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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