diff --git a/.gitignore b/.gitignore index 06cc662f3..fe4635d70 100644 --- a/.gitignore +++ b/.gitignore @@ -48,9 +48,6 @@ _ReSharper*/ *.resharper [Tt]est[Rr]esult* -#Project files -[Bb]uild/ - #Subversion files .svn/ diff --git a/build/KeyReporting.targets b/build/KeyReporting.targets new file mode 100644 index 000000000..9a7ac5429 --- /dev/null +++ b/build/KeyReporting.targets @@ -0,0 +1,18 @@ + + + + + + + + This project references a strong name key that is missing on this computer. Run 'sn -k {0}' to generate the file. + + + + + diff --git a/build/build.ps1 b/build/build.ps1 new file mode 100644 index 000000000..461bd8033 --- /dev/null +++ b/build/build.ps1 @@ -0,0 +1,58 @@ +param ( + [switch]$Debug, + [string]$VisualStudioVersion = "12.0", + [switch]$SkipKeyCheck, + [switch]$NoDocs +) + +# build the solution +$SolutionPath = "..\src\openstack.net.sln" + +# make sure the script was run from the expected path +if (!(Test-Path $SolutionPath)) { + $host.ui.WriteErrorLine('The script was run from an invalid working directory.') + exit 1 +} + +. .\version.ps1 + +If ($Debug) { + $BuildConfig = 'Debug' +} Else { + $BuildConfig = 'Release' +} + +If ($NoDocs -and -not $Debug) { + $SolutionBuildConfig = $BuildConfig + 'NoDocs' +} Else { + $SolutionBuildConfig = $BuildConfig +} + +# build the main project +$msbuild = "$env:windir\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" + +&$msbuild '/nologo' '/m' '/nr:false' '/t:rebuild' "/p:Configuration=$SolutionBuildConfig" "/p:Platform=Mixed Platforms" "/p:VisualStudioVersion=$VisualStudioVersion" $SolutionPath +if ($LASTEXITCODE -ne 0) { + $host.ui.WriteErrorLine('Build failed, aborting!') + exit $p.ExitCode +} + +# By default, do not create a NuGet package unless the expected strong name key files were used +if (-not $SkipKeyCheck) { + . .\keys.ps1 + + foreach ($pair in $Keys.GetEnumerator()) { + $assembly = Resolve-FullPath -Path "..\src\corelib\bin\$($pair.Key)\$BuildConfig\openstacknet.dll" + # Run the actual check in a separate process or the current process will keep the assembly file locked + powershell -Command ".\check-key.ps1 -Assembly '$assembly' -ExpectedKey '$($pair.Value)' -Build '$($pair.Key)'" + if ($LASTEXITCODE -ne 0) { + Exit $p.ExitCode + } + } +} + +if (-not (Test-Path 'nuget')) { + mkdir "nuget" +} + +..\src\.nuget\NuGet.exe 'pack' '..\src\corelib\corelib.nuspec' '-OutputDirectory' 'nuget' '-Prop' "Configuration=$BuildConfig" '-Version' "$Version" '-Symbols' diff --git a/build/check-key.ps1 b/build/check-key.ps1 new file mode 100644 index 000000000..b92a9cdcc --- /dev/null +++ b/build/check-key.ps1 @@ -0,0 +1,31 @@ +param( + [string]$Assembly, + [string]$ExpectedKey, + [string]$Build = $null +) + +function Get-PublicKeyToken() { + param([string]$assembly = $null) + if ($assembly) { + $bytes = $null + $bytes = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($assembly).GetName().GetPublicKeyToken() + if ($bytes) { + $key = "" + for ($i=0; $i -lt $bytes.Length; $i++) { + $key += "{0:x2}" -f $bytes[$i] + } + + $key + } + } +} + +if (-not $Build) { + $Build = $Assembly +} + +$actual = Get-PublicKeyToken -assembly $Assembly +if ($actual -ne $ExpectedKey) { + $host.ui.WriteErrorLine("Invalid publicKeyToken for '$Build'; expected '$ExpectedKey' but found '$actual'") + exit 1 +} diff --git a/build/keys.ps1 b/build/keys.ps1 new file mode 100644 index 000000000..d3db42fed --- /dev/null +++ b/build/keys.ps1 @@ -0,0 +1,10 @@ +# Note: these values may only change during minor release +$Keys = @{ + 'v3.5' = '8965cea5c205d3a3' + 'v4.0' = '8965cea5c205d3a3' +} + +function Resolve-FullPath() { + param([string]$Path) + [System.IO.Path]::GetFullPath((Join-Path (pwd) $Path)) +} diff --git a/build/push.ps1 b/build/push.ps1 new file mode 100644 index 000000000..d4d2eaa4d --- /dev/null +++ b/build/push.ps1 @@ -0,0 +1,8 @@ +. .\version.ps1 + +If ($Version.EndsWith('-dev')) { + $host.ui.WriteErrorLine("Cannot push development version '$Version' to NuGet.") + Exit 1 +} + +..\src\.nuget\NuGet.exe 'push' ".\nuget\openstack.net.$Version.nupkg" diff --git a/build/version.ps1 b/build/version.ps1 new file mode 100644 index 000000000..fee685cfa --- /dev/null +++ b/build/version.ps1 @@ -0,0 +1 @@ +$Version = "1.3.3.0-dev" diff --git a/src/Documentation/Documentation.v3.5.shfbproj b/src/Documentation/Documentation.v3.5.shfbproj index 030dcf9a9..4e1e9e743 100644 --- a/src/Documentation/Documentation.v3.5.shfbproj +++ b/src/Documentation/Documentation.v3.5.shfbproj @@ -32,7 +32,7 @@ Standard Blank True - VS2013Alt + VS2013 False MemberName openstack.net API Reference Documentation @@ -92,9 +92,6 @@ - - - @@ -130,13 +127,6 @@ - - - corelib.v3.5 - {e49d9dc3-79d5-4c5e-8c38-fd5060b4e318} - True - - diff --git a/src/Documentation/Documentation.v4.0.shfbproj b/src/Documentation/Documentation.v4.0.shfbproj index f92dda1cb..c6d824221 100644 --- a/src/Documentation/Documentation.v4.0.shfbproj +++ b/src/Documentation/Documentation.v4.0.shfbproj @@ -32,7 +32,7 @@ Standard Blank True - VS2013Alt + VS2013 False MemberName openstack.net API Reference Documentation @@ -97,9 +97,6 @@ - - - @@ -138,13 +135,6 @@ - - - corelib.v4.0 - {7dba11eb-dba7-4d3a-8d42-b5312e74b9c0} - True - - diff --git a/src/corelib/corelib.v3.5.csproj b/src/corelib/corelib.v3.5.csproj index 8c791abc4..c3f6d1af2 100644 --- a/src/corelib/corelib.v3.5.csproj +++ b/src/corelib/corelib.v3.5.csproj @@ -649,6 +649,7 @@ +