8
8
9
9
Param (
10
10
[Parameter (Mandatory = $true )]
11
- [string ]$commitSha
11
+ [string ]$commitSha ,
12
+ [scriptblock ]$postBuild
12
13
)
13
14
14
15
$ErrorActionPreference = " Stop"
@@ -51,10 +52,19 @@ function Clean-OutputFolder($folder) {
51
52
}
52
53
}
53
54
55
+ # From http://www.dougfinke.com/blog/index.php/2010/12/01/note-to-self-how-to-programmatically-get-the-msbuild-path-in-powershell/
56
+
57
+ Function Get-MSBuild {
58
+ $lib = [System.Runtime.InteropServices.RuntimeEnvironment ]
59
+ $rtd = $lib ::GetRuntimeDirectory()
60
+ Join-Path $rtd msbuild.exe
61
+ }
62
+
54
63
# ################
55
64
56
65
$root = Split-Path - Parent - Path $MyInvocation.MyCommand.Definition
57
66
$projectPath = Join-Path $root " ..\LibGit2Sharp"
67
+ $slnPath = Join-Path $projectPath " ..\LibGit2Sharp.sln"
58
68
59
69
Remove-Item (Join-Path $projectPath " *.nupkg" )
60
70
@@ -68,11 +78,15 @@ Push-Location $projectPath
68
78
69
79
try {
70
80
Set-Content - Encoding ASCII $ (Join-Path $projectPath " libgit2sharp_hash.txt" ) $commitSha
71
- Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Restore " $ ( Join-Path $projectPath " ..\LibGit2Sharp.sln" ) " }
81
+ Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Restore " $slnPath " }
82
+ Run- Command { & (Get-MSBuild ) " $slnPath " " /verbosity:minimal" " /p:Configuration=Release" }
83
+
84
+ If ($postBuild ) {
85
+ Write-Host - ForegroundColor " Green" " Run post build script..."
86
+ Run- Command { & ($postBuild ) }
87
+ }
72
88
73
- # Cf. https://stackoverflow.com/questions/21728450/nuget-exclude-files-from-symbols-package-in-nuspec
74
- Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Pack - Build - Symbols " $ ( Join-Path $projectPath " LibGit2Sharp.csproj" ) " - Prop Configuration= Release - Exclude " **/NativeBinaries/**/*.*" }
75
- Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Pack " $ ( Join-Path $projectPath " LibGit2Sharp.csproj" ) " - Prop Configuration= Release }
89
+ Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Pack - Prop Configuration= Release }
76
90
}
77
91
finally {
78
92
Pop-Location
0 commit comments