-Updated build to use .NET CLI

-.NET Standard 1.0 included in package
This commit is contained in:
James Newton-King
2016-05-14 13:43:43 +12:00
parent e31200aead
commit e8f4a3b651
17 changed files with 496 additions and 121 deletions
+44 -12
View File
@@ -1,15 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Newtonsoft.Json</id>
<version></version>
<title>Json.NET</title>
<description>Json.NET is a popular high-performance JSON framework for .NET</description>
<authors>James Newton-King</authors>
<language>en-US</language>
<projectUrl>http://www.newtonsoft.com/json</projectUrl>
<iconUrl>http://www.newtonsoft.com/content/images/nugeticon.png</iconUrl>
<licenseUrl>https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md</licenseUrl>
<tags>json</tags>
</metadata>
<metadata>
<id>Newtonsoft.Json</id>
<version></version>
<title>Json.NET</title>
<description>Json.NET is a popular high-performance JSON framework for .NET</description>
<authors>James Newton-King</authors>
<language>en-US</language>
<projectUrl>http://www.newtonsoft.com/json</projectUrl>
<iconUrl>http://www.newtonsoft.com/content/images/nugeticon.png</iconUrl>
<licenseUrl>https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md</licenseUrl>
<tags>json</tags>
<dependencies>
<group targetFramework=".NETFramework4.5" />
<group targetFramework=".NETFramework4.0" />
<group targetFramework=".NETFramework3.5" />
<group targetFramework=".NETFramework2.0" />
<group targetFramework=".NETPortable4.5-Profile259" />
<group targetFramework=".NETPortable4.0-Profile328" />
<group targetFramework=".NETStandard1.0">
<dependency id="Microsoft.CSharp" version="4.0.1-rc2-24027" />
<dependency id="System.Collections" version="4.0.11-rc2-24027" />
<dependency id="System.Diagnostics.Debug" version="4.0.11-rc2-24027" />
<dependency id="System.Dynamic.Runtime" version="4.0.11-rc2-24027" />
<dependency id="System.Globalization" version="4.0.11-rc2-24027" />
<dependency id="System.IO" version="4.1.0-rc2-24027" />
<dependency id="System.Linq" version="4.1.0-rc2-24027" />
<dependency id="System.Linq.Expressions" version="4.0.11-rc2-24027" />
<dependency id="System.ObjectModel" version="4.0.12-rc2-24027" />
<dependency id="System.Reflection" version="4.1.0-rc2-24027" />
<dependency id="System.Reflection.Extensions" version="4.0.1-rc2-24027" />
<dependency id="System.Resources.ResourceManager" version="4.0.1-rc2-24027" />
<dependency id="System.Runtime" version="4.1.0-rc2-24027" />
<dependency id="System.Runtime.Extensions" version="4.1.0-rc2-24027" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.1.1-rc2-24027" />
<dependency id="System.Text.Encoding" version="4.0.11-rc2-24027" />
<dependency id="System.Text.Encoding.Extensions" version="4.0.11-rc2-24027" />
<dependency id="System.Text.RegularExpressions" version="4.0.12-rc2-24027" />
<dependency id="System.Threading" version="4.0.11-rc2-24027" />
<dependency id="System.Threading.Tasks" version="4.0.11-rc2-24027" />
<dependency id="System.Xml.ReaderWriter" version="4.0.11-rc2-24027" />
<dependency id="System.Xml.XDocument" version="4.0.11-rc2-24027" />
</group>
</dependencies>
</metadata>
</package>
+30 -26
View File
@@ -1,8 +1,8 @@
properties {
$zipFileName = "Json80r3.zip"
$zipFileName = "Json80r4.zip"
$majorVersion = "8.0"
$majorWithReleaseVersion = "8.0.3"
$nugetPrelease = $null
$majorWithReleaseVersion = "8.0.4"
$nugetPrelease = "beta4"
$version = GetVersion $majorWithReleaseVersion
$packageId = "Newtonsoft.Json"
$signAssemblies = $false
@@ -11,7 +11,7 @@
$buildNuGet = $true
$treatWarningsAsErrors = $false
$workingName = if ($workingName) {$workingName} else {"Working"}
$dnvmVersion = "1.0.0-rc1-update1"
$netCliVersion = "1.0.0-preview1-002702"
$baseDir = resolve-path ..
$buildDir = "$baseDir\Build"
@@ -22,9 +22,9 @@
$workingDir = "$baseDir\$workingName"
$workingSourceDir = "$workingDir\Src"
$builds = @(
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "DnxBuild"; TestsFunction = "DnxTests"; Constants="dotnet"; FinalDir=$null; NuGetDir = $null; Framework=$null},
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; Constants="dotnet"; FinalDir="netstandard1.0"; NuGetDir = "netstandard1.0"; Framework=$null},
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants=""; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8+wpa81+dnxcore50"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE"; FinalDir="Portable"; NuGetDir = "portable-net45+wp80+win8+wpa81"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Portable40"; TestsName = "Newtonsoft.Json.Tests.Portable40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="PORTABLE40"; FinalDir="Portable40"; NuGetDir = "portable-net40+sl5+wp80+win8+wpa81"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Net40"; TestsName = "Newtonsoft.Json.Tests.Net40"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET40"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET35"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"},
@@ -90,11 +90,7 @@ task Package -depends Build {
if ($buildNuGet)
{
$nugetVersion = $majorWithReleaseVersion
if ($nugetPrelease -ne $null)
{
$nugetVersion = $nugetVersion + "-" + $nugetPrelease
}
$nugetVersion = GetNuGetVersion
New-Item -Path $workingDir\NuGet -ItemType Directory
@@ -136,6 +132,7 @@ task Package -depends Build {
Write-Host
exec { .\Tools\NuGet\NuGet.exe pack $nuspecPath -Symbols }
exec { dotnet pack $workingSourceDir\Newtonsoft.Json\project.json -c Release }
move -Path .\*.nupkg -Destination $workingDir\NuGet
}
@@ -204,36 +201,30 @@ function MSBuildBuild($build)
exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:CopyNuGetImplementations=true" "/p:Platform=Any CPU" "/p:PlatformTarget=AnyCPU" /p:OutputPath=bin\Release\$finalDir\ /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$signAssemblies" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:VisualStudioVersion=14.0" /p:DefineConstants=`"$constants`" "$workingSourceDir\$name.sln" | Out-Default } "Error building $name"
}
function DnxBuild($build)
function NetCliBuild($build)
{
$name = $build.Name
$projectPath = "$workingSourceDir\Newtonsoft.Json\project.json"
exec { dnvm install $dnvmVersion -r clr | Out-Default }
exec { dnvm use $dnvmVersion -r clr | Out-Default }
exec { .\Tools\Dotnet\install.ps1 -Version $netCliVersion | Out-Default }
Write-Host -ForegroundColor Green "Restoring packages for $name"
Write-Host
exec { dnu restore $projectPath | Out-Default }
exec { dotnet restore $projectPath | Out-Default }
Write-Host -ForegroundColor Green "Building $projectPath"
exec { dnu build $projectPath --configuration Release | Out-Default }
exec { dotnet build $projectPath -f netstandard1.0 -c Release -o bin\Release\netstandard1.0 | Out-Default }
}
function DnxTests($build)
function NetCliTests($build)
{
$name = $build.TestsName
#Write-Host -ForegroundColor Green "Ensuring latest CoreCLR is installed for $name"
#Write-Host
#exec { & $toolsDir\Kvm\kvm.ps1 upgrade -r CoreCLR -NoNative | Out-Default }
exec { dnvm install $dnvmVersion -r coreclr | Out-Default }
exec { dnvm use $dnvmVersion -r coreclr | Out-Default }
exec { .\Tools\Dotnet\install.ps1 -Version $netCliVersion | Out-Default }
Write-Host -ForegroundColor Green "Restoring packages for $name"
Write-Host
exec { dnu restore "$workingSourceDir\Newtonsoft.Json.Tests\project.json" | Out-Default }
exec { dotnet restore "$workingSourceDir\Newtonsoft.Json.Tests\project.json" | Out-Default }
Write-Host -ForegroundColor Green "Ensuring test project builds for $name"
Write-Host
@@ -241,7 +232,7 @@ function DnxTests($build)
try
{
Set-Location "$workingSourceDir\Newtonsoft.Json.Tests"
exec { dnx --configuration Release test | Out-Default }
exec { dotnet test "$workingSourceDir\Newtonsoft.Json.Tests\project.json" -f netcoreapp1.0 -c Release -parallel none | Out-Default }
}
finally
{
@@ -266,6 +257,17 @@ function NUnitTests($build)
exec { .\Tools\NUnit\nunit-console.exe "$workingDir\Deployed\Bin\$finalDir\Newtonsoft.Json.Tests.dll" /framework=$framework /xml:$workingDir\$name.xml | Out-Default } "Error running $name tests"
}
function GetNuGetVersion()
{
$nugetVersion = $majorWithReleaseVersion
if ($nugetPrelease -ne $null)
{
$nugetVersion = $nugetVersion + "-" + $nugetPrelease
}
return $nugetVersion
}
function GetConstants($constants, $includeSigned)
{
$signed = switch($includeSigned) { $true { ";SIGNED" } default { "" } }
@@ -345,9 +347,11 @@ function Update-Project {
$file = switch($sign) { $true { $signKeyPath } default { $null } }
$json = (Get-Content $projectPath) -join "`n" | ConvertFrom-Json
$options = @{"warningsAsErrors" = $true; "keyFile" = $file; "define" = ((GetConstants "dotnet" $sign) -split ";") }
$options = @{"warningsAsErrors" = $true; "xmlDoc" = $true; "keyFile" = $file; "define" = ((GetConstants "dotnet" $sign) -split ";") }
Add-Member -InputObject $json -MemberType NoteProperty -Name "compilationOptions" -Value $options -Force
$json.version = GetNuGetVersion
ConvertTo-Json $json -Depth 10 | Set-Content $projectPath
}