Skip to content

NuGet package licenses #2003

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

Merged
merged 3 commits into from
Mar 14, 2019
Merged

NuGet package licenses #2003

merged 3 commits into from
Mar 14, 2019

Conversation

tmat
Copy link
Member

@tmat tmat commented Feb 8, 2019

This change must be merged after Preview 3, since it depends on changes to repos consuming Acade that were made to their master branches.

Updates the dotnet cli used for build to 2.1.503, which brings in new NuGet license features.
Removes the need for suppressing NU5125.

Since they are no longer passing PackageLicenseUrl this is a breaking change for projects that depend on Arcade targets when generating packages from .nuspec files.

NuGet supports PackageLicenseExpression or PackageLicenseFile (see docs). The former is essentially a well-known identifier for a license, such as MIT or Apache-2.0 for our repos. The later means including the license file in the package. The expression is preferable, since one doesn't need to check that the license file is exactly what it's supposed to be.

How do we make sure that the license file in the repo root matches the license specified by PackageLicenseExpression in Directory.Build.props file? This PR implements a simple content check for the licenses we need - it includes the expected license text files in Arcade SDK and then we compare the content and it must match modulo line breaks, whitespace. We require the license file in the root to be named license(.txt|.md|), ignoring case.

Each repository must specify either PackageLicenseExpression or PackageLicenseExpressionInternal. The former when an OSS license is used the later when closed source license is used.

The PR updates helpers for building packages from .nuspec. Instead of passing each msbuild property thru as a nuspec property and then listing all the metadata elements manually in the nuspec like so Arcade now defines a single property CommonMetadataElements that includes all the common nuspec metadata and can be used in the nuspec simply like so:

  <metadata>
    $CommonMetadataElements$
  </metadata>

Fixes #1955.
Fixes #1373.
Fixes #16.

@tmat tmat changed the title WIP: License NuGet package license Feb 8, 2019
@tmat tmat changed the title NuGet package license NuGet package licenses Feb 8, 2019
@tmat
Copy link
Member Author

tmat commented Feb 8, 2019

@tmat tmat force-pushed the License branch 6 times, most recently from 6a65471 to 82414a0 Compare February 9, 2019 19:55
@markwilkie
Copy link
Member

@tmat - is it known which repos this will "break"?

@tmat
Copy link
Member Author

tmat commented Feb 11, 2019

@markwilkie All repos. They will need to specify PackageLicenseExpression.

@tmat tmat closed this Feb 11, 2019
@tmat tmat reopened this Feb 11, 2019
@markwilkie
Copy link
Member

ok - given the impact, I'll need to be sure and communicate this well before it's merged.

@tmat
Copy link
Member Author

tmat commented Feb 13, 2019

@markwilkie

given the impact, I'll need to be sure and communicate this well before it's merged.

Indeed. We need the DL for communicating breaking changes. This would be a good opportunity to set it up (I don't mind waiting a bit longer with merging this PR).

@tmat
Copy link
Member Author

tmat commented Feb 19, 2019

@markwilkie I figured out how to make this change in a non-breaking way.

@tmat tmat changed the title NuGet package licenses WIP: NuGet package licenses Feb 22, 2019
@tmat tmat force-pushed the License branch 2 times, most recently from 8c5df69 to 60a047a Compare March 8, 2019 02:49
@tmat tmat changed the title WIP: NuGet package licenses NuGet package licenses Mar 8, 2019
@markwilkie
Copy link
Member

Now that P3 is behind us, is this ready to go in @tmat ?

@tmat
Copy link
Member Author

tmat commented Mar 14, 2019

Yes. I'll merge.

tmat added 3 commits March 14, 2019 12:44
Add predefined licenses and copyrights
Replace PackageLicenseUrl with PackageLicenseExpression(Internal)
@tmat tmat merged commit 4a43fdd into dotnet:master Mar 14, 2019
@tmat tmat deleted the License branch March 14, 2019 20:57
rainersigwald added a commit to dotnet/msbuild that referenced this pull request Mar 20, 2019
dotnet-maestro bot added a commit to dotnet/msbuild that referenced this pull request Mar 20, 2019
* Update dependencies from https://github.com/dotnet/arcade build 20190317.10

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19167.10

* License change demanded by Arcade

See dotnet/arcade#2003.

* [Arcade] Update .NET SDK, NuGet version

This is required by new enforcement of LicenseExpression, which isn't
supported by versions of NuGet before 4.9, included with MSBuilds before
15.9.

* Convert Localization package to license expression
@chcosta chcosta mentioned this pull request Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants