Change ifdefs to be by feature, not by platform (#1146)
* First pass * Second pass * Third pass * Temporarily change build script to build only portable * Add portable features for release build * Add feature constants to build script * Add more feature constants to build script * Fix build issues * Fix build issues * Get rid of constants in build.ps1 * HAVE_NUMERICS -> HAVE_BIG_INTEGER * Remove HAVE_NULLABLE * Remove HAVE_NUMERICS from csprojs * Add missing ifdef * Add feature defines to pj * Re-enable netstd builds * Fix defines in pj * Trying to get better build outputs * Trying to get the build error * Use newer cli * Address review feedback; make netstd build work * Introduce HAVE_DB_NULL_TYPE * Adapt to upstream changes; address remaining review feedback * Adapt to upstream changes; address remaining review feedback * Rename some constants for constistency * Address review feedback * -Fixed build with signed assembly * Fix merge erorr * Address review feedback * Introduce HAVE_NON_SERIALIZED_ATTRIBUTE * HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE
This commit is contained in:
committed by
James Newton-King
parent
eb96cb9f62
commit
b8e60c773b
+19
-25
@@ -24,14 +24,14 @@
|
||||
$workingSourceDir = "$workingDir\Src"
|
||||
$nugetPath = "$buildDir\nuget.exe"
|
||||
$builds = @(
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; Constants="NETSTANDARD1_0"; FinalDir="netstandard1.0"; NuGetDir = "netstandard1.0"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; Constants="NETSTANDARD1_1"; FinalDir="netstandard1.1"; NuGetDir = "netstandard1.1"; 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"; 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"},
|
||||
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; Constants="NET20"; FinalDir="Net20"; NuGetDir = "net20"; Framework="net-2.0"}
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; FinalDir="netstandard1.0"; NuGetDir = "netstandard1.0"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json.Dotnet"; TestsName = "Newtonsoft.Json.Tests.Dotnet"; BuildFunction = "NetCliBuild"; TestsFunction = "NetCliTests"; FinalDir="netstandard1.1"; NuGetDir = "netstandard1.1"; Framework=$null},
|
||||
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net45"; NuGetDir = "net45"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Portable"; TestsName = "Newtonsoft.Json.Tests.Portable"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; 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"; 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"; FinalDir="Net40"; NuGetDir = "net40"; Framework="net-4.0"},
|
||||
@{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net35"; NuGetDir = "net35"; Framework="net-2.0"},
|
||||
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; BuildFunction = "MSBuildBuild"; TestsFunction = "NUnitTests"; FinalDir="Net20"; NuGetDir = "net20"; Framework="net-2.0"}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -198,11 +198,11 @@ function MSBuildBuild($build)
|
||||
exec { & $nugetPath update -self }
|
||||
exec { & $nugetPath restore "$workingSourceDir\$name.sln" -verbosity detailed -configfile $workingSourceDir\nuget.config | Out-Default } "Error restoring $name"
|
||||
|
||||
$constants = GetConstants $build.Constants $signAssemblies
|
||||
$additionalConstants = switch($signAssemblies) { $true { "SIGNED" } default { "" } }
|
||||
|
||||
Write-Host
|
||||
Write-Host "Building $workingSourceDir\$name.sln" -ForegroundColor Green
|
||||
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"
|
||||
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:AdditionalConstants=$additionalConstants" "$workingSourceDir\$name.sln" | Out-Default } "Error building $name"
|
||||
}
|
||||
|
||||
function EnsureNuGetExists()
|
||||
@@ -283,13 +283,6 @@ function GetNuGetVersion()
|
||||
return $nugetVersion
|
||||
}
|
||||
|
||||
function GetConstants($constants, $includeSigned)
|
||||
{
|
||||
$signed = switch($includeSigned) { $true { ";SIGNED" } default { "" } }
|
||||
|
||||
return "CODE_ANALYSIS;TRACE;$constants$signed"
|
||||
}
|
||||
|
||||
function GetVersion($majorVersion)
|
||||
{
|
||||
$now = [DateTime]::Now
|
||||
@@ -359,15 +352,16 @@ function Update-Project {
|
||||
[string] $sign
|
||||
)
|
||||
|
||||
$file = switch($sign) { $true { $signKeyPath } default { $null } }
|
||||
$file = switch($sign) { $true { $signKeyPath } default { $null } }
|
||||
$signed = switch($sign) { $true { ";SIGNED" } default { "" } }
|
||||
$constants = "CODE_ANALYSIS;TRACE$signed"
|
||||
$json = (Get-Content $projectPath) -join "`n" | ConvertFrom-Json
|
||||
$options = @{"warningsAsErrors" = $true; "xmlDoc" = $true; "keyFile" = $file; "define" = ($constants -split ";") }
|
||||
Add-Member -InputObject $json -MemberType NoteProperty -Name "buildOptions" -Value $options -Force
|
||||
|
||||
$json = (Get-Content $projectPath) -join "`n" | ConvertFrom-Json
|
||||
$options = @{"warningsAsErrors" = $true; "xmlDoc" = $true; "keyFile" = $file; "define" = ((GetConstants "dotnet" $sign) -split ";") }
|
||||
Add-Member -InputObject $json -MemberType NoteProperty -Name "buildOptions" -Value $options -Force
|
||||
|
||||
$json.version = GetNuGetVersion
|
||||
|
||||
ConvertTo-Json $json -Depth 10 | Set-Content $projectPath
|
||||
$json.version = GetNuGetVersion
|
||||
|
||||
ConvertTo-Json $json -Depth 10 | Set-Content $projectPath
|
||||
}
|
||||
|
||||
function Execute-Command($command) {
|
||||
|
||||
Reference in New Issue
Block a user