|
| 1 | +param ( |
| 2 | + [switch]$Debug, |
| 3 | + [string]$VisualStudioVersion = "12.0", |
| 4 | + [switch]$SkipKeyCheck, |
| 5 | + [switch]$NoDocs |
| 6 | +) |
| 7 | + |
| 8 | +# build the solution |
| 9 | +$SolutionPath = "..\src\openstack.net.sln" |
| 10 | + |
| 11 | +# make sure the script was run from the expected path |
| 12 | +if (!(Test-Path $SolutionPath)) { |
| 13 | + $host.ui.WriteErrorLine('The script was run from an invalid working directory.') |
| 14 | + exit 1 |
| 15 | +} |
| 16 | + |
| 17 | +. .\version.ps1 |
| 18 | + |
| 19 | +If ($Debug) { |
| 20 | + $BuildConfig = 'Debug' |
| 21 | +} Else { |
| 22 | + $BuildConfig = 'Release' |
| 23 | +} |
| 24 | + |
| 25 | +If ($NoDocs -and -not $Debug) { |
| 26 | + $SolutionBuildConfig = $BuildConfig + 'NoDocs' |
| 27 | +} Else { |
| 28 | + $SolutionBuildConfig = $BuildConfig |
| 29 | +} |
| 30 | + |
| 31 | +# build the main project |
| 32 | +$msbuild = "$env:windir\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" |
| 33 | + |
| 34 | +&$msbuild '/nologo' '/m' '/nr:false' '/t:rebuild' "/p:Configuration=$SolutionBuildConfig" "/p:Platform=Mixed Platforms" "/p:VisualStudioVersion=$VisualStudioVersion" $SolutionPath |
| 35 | +if ($LASTEXITCODE -ne 0) { |
| 36 | + $host.ui.WriteErrorLine('Build failed, aborting!') |
| 37 | + exit $p.ExitCode |
| 38 | +} |
| 39 | + |
| 40 | +# By default, do not create a NuGet package unless the expected strong name key files were used |
| 41 | +if (-not $SkipKeyCheck) { |
| 42 | + . .\keys.ps1 |
| 43 | + |
| 44 | + foreach ($pair in $Keys.GetEnumerator()) { |
| 45 | + $assembly = Resolve-FullPath -Path "..\src\corelib\bin\$($pair.Key)\$BuildConfig\openstacknet.dll" |
| 46 | + # Run the actual check in a separate process or the current process will keep the assembly file locked |
| 47 | + powershell -Command ".\check-key.ps1 -Assembly '$assembly' -ExpectedKey '$($pair.Value)' -Build '$($pair.Key)'" |
| 48 | + if ($LASTEXITCODE -ne 0) { |
| 49 | + Exit $p.ExitCode |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +if (-not (Test-Path 'nuget')) { |
| 55 | + mkdir "nuget" |
| 56 | +} |
| 57 | + |
| 58 | +..\src\.nuget\NuGet.exe 'pack' '..\src\corelib\corelib.nuspec' '-OutputDirectory' 'nuget' '-Prop' "Configuration=$BuildConfig" '-Version' "$Version" '-Symbols' |
0 commit comments