Refactored the entire .config file supporting classes, and added a .config element...
[dotnetoauth.git] / tools / libcheck.ps1
blobe5417caf7da85f39e6d47fad145ea3f926dfedcc
1 param(
2 $OldVersion,
3 $NewVersion,
4 $Configuration='Debug'
7 function Usage() {
8 $ScriptName = Split-Path -leaf $MyInvocation.ScriptName
9 Write-Host "$ScriptName -OldVersion <tag> -NewVersion <branch>"
10 exit
13 if ($Args -Contains "-?" -or !$OldVersion -or !$NewVersion -or ($OldVersion -eq $NewVersion)) {
14 Usage
17 function SetupVariables() {
18 $ToolsDir = Split-Path $MyInvocation.ScriptName
19 $RootDir = [io.path]::getfullpath((Join-Path $ToolsDir .. -resolve))
20 $BinDir = "$RootDir\bin"
21 $LibCheckTmpDir = Join-Path ([IO.Path]::GetTempPath()) "LibCheck"
24 function Checkout($Version) {
25 git checkout $Version
28 function Build() {
29 msbuild.exe "$RootDir\src\DotNetOpenAuth\DotNetOpenAuth.csproj" /p:Configuration=$Configuration
32 function Generate-Metadata($Version) {
33 Push-Location $LibCheckTmpDir
34 & ".\libcheck.exe" -store "DotNetOpenAuth.dll" $Version -full "$BinDir\$Configuration"
35 Pop-Location
38 function Compare-Metadata() {
39 Push-Location $LibCheckTmpDir
40 & ".\libcheck.exe" -compare $OldVersion $NewVersion
41 Pop-Location
44 function ShadowCopy-Libcheck() {
45 # This function copies LibCheck from the checked out version to a temp
46 # directory so that as we git checkout other versions of DotNetOpenAuth,
47 # we can be sure of running one consistent version of LibCheck.
48 Remove-Item -Recurse $LibCheckTmpDir
49 Copy-Item -Recurse "$ToolsDir\LibCheck" (Split-Path $LibCheckTmpDir)
50 # As a side benefit, this also puts the results of running LibCheck
51 # outside the git repo so it can't get checked in accidentally.
54 . SetupVariables
55 ShadowCopy-Libcheck
56 Checkout -version $OldVersion
57 Build
58 Generate-Metadata -version $OldVersion
59 Checkout -version $NewVersion
60 Build
61 Generate-Metadata -version $NewVersion
62 Compare-Metadata
63 Pop-Location
64 & "$LibCheckTmpDir\$($OldVersion)to$($NewVersion)\APIChanges$($OldVersion)to$($NewVersion).html"