Skip to content

Commit

Permalink
Merge branch 'augustoproiete-forks-expose-new-net5-dotnet-publish-set…
Browse files Browse the repository at this point in the history
…tings' into develop
  • Loading branch information
devlead committed Feb 13, 2021
2 parents ec61403 + 2ded057 commit 0b50108
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,34 @@ public void Should_Add_PublishReadyToRunShowWarnings()
// Then
Assert.Equal("publish -p:PublishReadyToRunShowWarnings=true", result.Args);
}

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

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

// Then
Assert.Equal("publish -p:IncludeNativeLibrariesForSelfExtract=true", result.Args);
}

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

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

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

/// <summary>
/// Gets or sets a value indicating whether to bundle native libraries when publishing a platform-specific single-file executable.
/// </summary>
/// <remarks>
/// Requires .NET 5 or newer.
/// </remarks>
public bool? IncludeNativeLibrariesForSelfExtract { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to bundle all content when publishing a platform-specific single-file executable.
/// This will extract all files before running the executable and preserves the original .NET Core single-file deployment behavior.
/// </summary>
/// <remarks>
/// Requires .NET 5 or newer.
/// </remarks>
public bool? IncludeAllContentForSelfExtract { get; set; }

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

// Include Native Libraries For Self-Extract
if (settings.IncludeNativeLibrariesForSelfExtract.HasValue)
{
if (settings.IncludeNativeLibrariesForSelfExtract.Value)
{
builder.Append("-p:IncludeNativeLibrariesForSelfExtract=true");
}
else
{
builder.Append("-p:IncludeNativeLibrariesForSelfExtract=false");
}
}

// Include All Content For Self-Extract
if (settings.IncludeAllContentForSelfExtract.HasValue)
{
if (settings.IncludeAllContentForSelfExtract.Value)
{
builder.Append("-p:IncludeAllContentForSelfExtract=true");
}
else
{
builder.Append("-p:IncludeAllContentForSelfExtract=false");
}
}

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

0 comments on commit 0b50108

Please sign in to comment.