From 59a9955c1f8836b06e1cce500a0a894cc317f812 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 25 Jul 2017 07:50:45 -0500 Subject: [PATCH] Update the build and push scripts --- build/build.ps1 | 27 ++++++++++++++++++++++----- build/keys.ps1 | 6 ++++-- build/push.ps1 | 2 +- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/build/build.ps1 b/build/build.ps1 index ce97d4c..e1eda7b 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -1,9 +1,10 @@ param ( [switch]$Debug, - [string]$VisualStudioVersion = '14.0', + [string]$VisualStudioVersion = '15.0', [switch]$SkipKeyCheck, - [string]$Verbosity = 'normal', - [string]$Logger + [string]$Verbosity = 'minimal', + [string]$Logger, + [switch]$Incremental ) # build the solution @@ -45,7 +46,12 @@ If (-not (Test-Path $nuget)) { } # build the main project -$msbuild = "${env:ProgramFiles(x86)}\MSBuild\$VisualStudioVersion\Bin\MSBuild.exe" +$visualStudio = (Get-ItemProperty 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7')."$VisualStudioVersion" +$msbuild = "$visualStudio\MSBuild\$VisualStudioVersion\Bin\MSBuild.exe" +If (-not (Test-Path $msbuild)) { + $host.UI.WriteErrorLine("Couldn't find MSBuild.exe") + exit 1 +} # Attempt to restore packages up to 3 times, to improve resiliency to connection timeouts and access denied errors. $maxAttempts = 3 @@ -63,12 +69,23 @@ If ($Logger) { $LoggerArgument = "/logger:$Logger" } -&$msbuild '/nologo' '/m' '/nr:false' '/t:rebuild' $LoggerArgument "/verbosity:$Verbosity" "/p:Configuration=$BuildConfig" "/p:VisualStudioVersion=$VisualStudioVersion" "/p:KeyConfiguration=$KeyConfiguration" $SolutionPath +If ($Incremental) { + $Target = 'build' +} Else { + $Target = 'rebuild' +} + +&$msbuild '/nologo' '/m' '/nr:false' "/t:$Target" $LoggerArgument "/verbosity:$Verbosity" "/p:Configuration=$BuildConfig" "/p:VisualStudioVersion=$VisualStudioVersion" "/p:KeyConfiguration=$KeyConfiguration" $SolutionPath If (-not $?) { $host.ui.WriteErrorLine('Build failed, aborting!') exit $LASTEXITCODE } +if ($Incremental) { + # Skip NuGet validation and copying packages to the output directory + exit 0 +} + # By default, do not create a NuGet package unless the expected strong name key files were used if (-not $SkipKeyCheck) { . .\keys.ps1 diff --git a/build/keys.ps1 b/build/keys.ps1 index 4b8a8ae..e0f6973 100644 --- a/build/keys.ps1 +++ b/build/keys.ps1 @@ -4,14 +4,16 @@ If ($Version.Contains('-')) { # Use the development keys $Keys = @{ - 'portable-net45' = '71b21a4aa82ae3b3' + 'netstandard1.1' = '71b21a4aa82ae3b3' + 'net452' = '71b21a4aa82ae3b3' } } Else { # Use the final release keys $Keys = @{ - 'portable-net45' = '2d9feb668c6a0e40' + 'netstandard1.1' = '2d9feb668c6a0e40' + 'net452' = '2d9feb668c6a0e40' } } diff --git a/build/push.ps1 b/build/push.ps1 index 426b17f..cc0e211 100644 --- a/build/push.ps1 +++ b/build/push.ps1 @@ -5,4 +5,4 @@ If ($Version.EndsWith('-dev')) { Exit 1 } -..\.nuget\NuGet.exe 'push' ".\nuget\AsyncUsageAnalyzers.$Version.nupkg" +..\.nuget\NuGet.exe 'push' ".\nuget\AsyncUsageAnalyzers.$Version.nupkg" -Source 'https://www.nuget.org/api/v2/package'