Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Commit

Permalink
Update the build and push scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Jul 25, 2017
1 parent 2647be4 commit 59a9955
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
27 changes: 22 additions & 5 deletions build/build.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions build/keys.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

}
Expand Down
2 changes: 1 addition & 1 deletion build/push.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit 59a9955

Please sign in to comment.