forked from hibernating-rhinos/rhino-mocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
138 lines (119 loc) · 4.27 KB
/
default.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
properties {
$base_dir = resolve-path .
$lib_dir = "$base_dir\SharedLibs"
$build_dir = "$base_dir\build"
$sln_file = "$base_dir\Rhino.Mocks.sln"
$version = "3.6.0.0"
$humanReadableversion = "3.6"
$tools_dir = "$base_dir\Tools"
$release_dir = "$base_dir\Release"
$uploadCategory = "Rhino-Mocks"
$uploader = "..\Uploader\S3Uploader.exe"
}
include .\psake_ext.ps1
task default -depends Release
task Clean {
remove-item -force -recurse $build_dir -ErrorAction SilentlyContinue
remove-item -force -recurse $release_dir -ErrorAction SilentlyContinue
}
task Init -depends Clean {
Generate-Assembly-Info `
-file "$base_dir\Rhino.Mocks\Properties\AssemblyInfo.cs" `
-title "Rhino Mocks $version" `
-description "Mocking Framework for .NET" `
-company "Hibernating Rhinos" `
-product "Rhino Mocks $version" `
-version $version `
-copyright "Hibernating Rhinos & Ayende Rahien 2004 - 2009" `
-internalsVisibleTo "Rhino.Mocks.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001009d1cf4b75b7218b141ac64c15450141b1e5f41f6a302ac717ab9761fa6ae2c3ee0c354c22d0a60ac59de41fa285d572e7cf33c320aa7ff877e2b7da1792fcc6aa4eb0b4d8294a2f74cb14d03fb9b091f751d6dc49e626d74601692c99eab7718ed76a40c36d39af842be378b677e6e4eae973f643d7065241ad86ecc156d81ab"
Generate-Assembly-Info `
-file "$base_dir\Rhino.Mocks.Tests\Properties\AssemblyInfo.cs" `
-title "Rhino Mocks Tests $version" `
-description "Mocking Framework for .NET" `
-company "Hibernating Rhinos" `
-product "Rhino Mocks Tests $version" `
-version $version `
-clsCompliant "false" `
-copyright "Hibernating Rhinos & Ayende Rahien 2004 - 2009"
Generate-Assembly-Info `
-file "$base_dir\Rhino.Mocks.Tests.Model\Properties\AssemblyInfo.cs" `
-title "Rhino Mocks Tests Model $version" `
-description "Mocking Framework for .NET" `
-company "Hibernating Rhinos" `
-product "Rhino Mocks Tests Model $version" `
-version $version `
-clsCompliant "false" `
-copyright "Hibernating Rhinos & Ayende Rahien 2004 - 2009"
Generate-Assembly-Info `
-file "$base_dir\Rhino.Mocks.GettingStarted\Properties\AssemblyInfo.cs" `
-title "Rhino Mocks Tests $version" `
-description "Mocking Framework for .NET" `
-company "Hibernating Rhinos" `
-product "Rhino Mocks Tests $version" `
-version $version `
-clsCompliant "false" `
-copyright "Hibernating Rhinos & Ayende Rahien 2004 - 2009"
new-item $release_dir -itemType directory
new-item $build_dir -itemType directory
cp $tools_dir\xUnit\*.* $build_dir
}
task Compile -depends Init {
& msbuild "$sln_file" "/p:OutDir=$build_dir\\" /p:Configuration=Release
if ($lastExitCode -ne 0) {
throw "Error: Failed to execute msbuild"
}
}
task Test -depends Compile {
$old = pwd
cd $build_dir
&.\Xunit.console.exe "$build_dir\Rhino.Mocks.Tests.dll"
if ($lastExitCode -ne 0) {
throw "Error: Failed to execute tests"
}
cd $old
}
task Merge {
$old = pwd
cd $build_dir
Remove-Item Rhino.Mocks.Partial.dll -ErrorAction SilentlyContinue
Rename-Item $build_dir\Rhino.Mocks.dll Rhino.Mocks.Partial.dll
& $tools_dir\ILMerge.exe Rhino.Mocks.Partial.dll `
Castle.DynamicProxy2.dll `
Castle.Core.dll `
/out:Rhino.Mocks.dll `
/t:library `
"/keyfile:$base_dir\ayende-open-source.snk" `
"/internalize:$base_dir\ilmerge.exclude"
if ($lastExitCode -ne 0) {
throw "Error: Failed to merge assemblies!"
}
cd $old
}
task Release -depends Test, Merge {
& $tools_dir\zip.exe -9 -A -j `
$release_dir\Rhino.Mocks-$humanReadableversion-Build-$env:ccnetnumericlabel.zip `
$build_dir\Rhino.Mocks.dll `
$build_dir\Rhino.Mocks.xml `
license.txt `
acknowledgements.txt
if ($lastExitCode -ne 0) {
throw "Error: Failed to execute ZIP command"
}
}
task Upload -depends Release {
Write-Host "Starting upload"
if (Test-Path $uploader) {
$log = $env:push_msg
if($log -eq $null -or $log.Length -eq 0) {
$log = git log -n 1 --oneline
}
&$uploader "$uploadCategory" "$release_dir\Rhino.Mocks-$humanReadableversion-Build-$env:ccnetnumericlabel.zip" "$log"
if ($lastExitCode -ne 0) {
write-host "Failed to upload to S3: $lastExitCode"
throw "Error: Failed to publish build"
}
}
else {
Write-Host "could not find upload script $uploadScript, skipping upload"
}
}