зеркало из https://github.com/microsoft/jschema.git
Fix #68, fix #69: Use packageLicenseExpression in all packages, and fix some package properties (#70)
This change fixes a problem with certain jschema packages which prevented them from being published, because they violated Microsoft package publishing policy (PPP, if you like ;-)). Opportunistically, it fixes a couple of other package property problems (PPP2, if you like). Our build.props file sets the `<PackageLicenseExpression>` property to `Apache-2.0`. The creation of the JsonPointer and JsonSchema NuGet packages is done by `dotnet pack`, and is driven by the MSBuild project file. So those packages respected the package license expression, and picked up the correct license. But the NuGet packages for the two command line tools (ToDotNet and Validator) are created by directly invoking NuGet.exe on custom .nuspec files. This is necessary because those packages require files that are not part of the projects that build the tools. That means that those packages don't know anything about the MSBuild project properties, so they didn't pick up the package license expression. To fix that, we add a `<license type="expression">` tag to the package metadata in the .nuspec files. That leads to two more issues: 1. Version 4.3 of NuGet.exe, which we were using, doesn't recognize that tag. Therefore we upgrade to the latest NuGet.exe, Version 4.9.2. 2. We could hard-code `Apache-2.0` into the .nuspec files, but we would rather get it from the MSBuild properties, to ensure that it stays in sync with the packages that are created by `dotnet pack`. Therefore we add some code to BuildAndTest.ps1 to read the `PackageLicenseExpression` MSBuild property, and pass it on the NuGet.exe command line. That takes care of #69. While doing this, I noticed a couple of problems with the metadata of the other packages, the ones created by `dotnet pack`. This is #68. 1. They did not have a `Title` property. I fixed that by setting `<Title>` to `$(AssemblyTitle>)` in build.props. 2. They did not have the correct `Owners` property. There was in fact a bug in the setting of the `<Owners>` MSBuild property: the `Condition` was wrong. But fixing it does not fix the problem. After some research, it seems that `dotnet pack` does not respect `Owners` and always sets it to `Authors`, so there's nothing more I can do. Finally, I fixed a couple of casing errors in the .nuspec files.
This commit is contained in:
Родитель
2ef3d51f89
Коммит
20e157dc30
Двоичные данные
.nuget/NuGet.exe
Двоичные данные
.nuget/NuGet.exe
Двоичный файл не отображается.
|
@ -51,6 +51,16 @@ function Exit-WithFailureMessage($message) {
|
|||
exit 1
|
||||
}
|
||||
|
||||
function Get-PackageLicenseExpression() {
|
||||
$buildPropsPath = "$PSScriptRoot\src\build.props"
|
||||
$namespace = @{ msbuild = "http://schemas.microsoft.com/developer/msbuild/2003" }
|
||||
$xPath = "/msbuild:Project/msbuild:PropertyGroup[@Label='Package']/msbuild:PackageLicenseExpression"
|
||||
$xml = Select-Xml -Path $buildPropsPath -Namespace $namespace -XPath $xPath
|
||||
$packageLicenseExpression = $xml.Node.InnerText
|
||||
|
||||
$packageLicenseExpression
|
||||
}
|
||||
|
||||
function Invoke-Build {
|
||||
if (Test-Path $buildDirectory) {
|
||||
Remove-Item -Force -Recurse $buildDirectory
|
||||
|
@ -103,13 +113,13 @@ function New-NuGetPackageFromProjectFile($project, $version) {
|
|||
}
|
||||
}
|
||||
|
||||
function New-NuGetPackageFromNuspecFile($project, $version, $suffix = "") {
|
||||
function New-NuGetPackageFromNuspecFile($project, $version, $packageLicenseExpression, $suffix = "") {
|
||||
$nuspecFile = "$PSScriptRoot\src\$project\$project.nuspec"
|
||||
|
||||
$arguments=
|
||||
"pack", $nuspecFile,
|
||||
"-Symbols",
|
||||
"-Properties", "platform=$Platform;configuration=$Configuration;version=$version",
|
||||
"-Properties", "platform=$Platform;configuration=$Configuration;version=$version;packageLicenseExpression=$packageLicenseExpression",
|
||||
"-Verbosity", "Quiet",
|
||||
"-BasePath", ".\",
|
||||
"-OutputDirectory", $PackageOutputDirectory
|
||||
|
@ -164,6 +174,6 @@ if (-not $NoPackage) {
|
|||
$nuspecProjects = "Json.Schema.ToDotNet.Cli", "Json.Schema.Validation.Cli"
|
||||
foreach ($project in $nuspecProjects) {
|
||||
Publish-Application $project netcoreapp2.0
|
||||
New-NuGetPackageFromNuSpecFile $project $version
|
||||
New-NuGetPackageFromNuSpecFile $project $version $(Get-PackageLicenseExpression)
|
||||
}
|
||||
}
|
|
@ -4,13 +4,13 @@
|
|||
<id>Microsoft.Json.Schema.ToDotNet</id>
|
||||
<version>$version$</version>
|
||||
<title>Microsoft JSON Schema to .NET Object Model Generator</title>
|
||||
<authors>microsoft</authors>
|
||||
<owners>microsoft,tse-securitytools</owners>
|
||||
<authors>Microsoft,tse-securitytools</authors>
|
||||
<owners>Microsoft,tse-securitytools</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>A command line tool that generates a .NET object model from a JSON schema.</description>
|
||||
<releaseNotes>Version $version$ of the JSON .NET object model generator</releaseNotes>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
<licenseUrl>https://github.com/Microsoft/jschema/blob/master/LICENSE</licenseUrl>
|
||||
<license type="expression">$packageLicenseExpression$</license>
|
||||
<projectUrl>https://github.com/microsoft/jschema</projectUrl>
|
||||
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2009431</iconUrl>
|
||||
<tags>Microsoft JSON Schema .NET ToDotNet Object Model Generator Jschema</tags>
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
<id>Microsoft.Json.Schema.Validation</id>
|
||||
<version>$version$</version>
|
||||
<title>Microsoft JSON Schema Validation</title>
|
||||
<authors>microsoft</authors>
|
||||
<owners>microsoft,tse-securitytools</owners>
|
||||
<authors>Microsoft,tse-securitytools</authors>
|
||||
<owners>Microsoft,tse-securitytools</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>A command line tool that validates files against a JSON schema.</description>
|
||||
<releaseNotes>Version $version$ of the JSON validation tool.</releaseNotes>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
<licenseUrl>https://github.com/Microsoft/jschema/blob/master/LICENSE</licenseUrl>
|
||||
<license type="expression">$packageLicenseExpression$</license>
|
||||
<projectUrl>https://github.com/microsoft/jschema</projectUrl>
|
||||
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2009431</iconUrl>
|
||||
<tags>Microsoft Json Schema .NET Validation Validator JSchema</tags>
|
||||
<tags>Microsoft JSON Schema .NET Validation Validator JSchema</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="bld\bin\$platform$_$configuration$\Json.Schema.Validation\net461\Microsoft.Json.Schema.Validation.dll"
|
||||
|
|
|
@ -33,8 +33,9 @@
|
|||
|
||||
<PropertyGroup Label="Package">
|
||||
<PackageId Condition=" '$(PackageId)' == '' ">$(AssemblyName)</PackageId>
|
||||
<Authors Condition=" '$(Authors)' == '' ">$(Company)</Authors>
|
||||
<Owners Condition=" '$(Authors)' == '' ">$(Company),tse-securitytools</Owners>
|
||||
<Title Condition=" '$(Title)' == '' ">$(AssemblyTitle)</Title>
|
||||
<Authors Condition=" '$(Authors)' == '' ">$(Company),tse-securitytools</Authors>
|
||||
<Owners Condition=" '$(Owners)' == '' ">$(Authors)</Owners>
|
||||
<PackageRequireLicenseAcceptance Condition=" '$(PackageRequireLicenseAcceptance)' == '' ">false</PackageRequireLicenseAcceptance>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/Microsoft/jschema</PackageProjectUrl>
|
||||
|
|
Загрузка…
Ссылка в новой задаче