forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.ps1
335 lines (254 loc) · 10.2 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
properties {
$base_dir = resolve-path .
$lib_dir = "$base_dir\SharedLibs"
$build_dir = "$base_dir\build"
$buildartifacts_dir = "$build_dir\"
$sln_file = "$base_dir\zzz_RavenDB_Release.sln"
$version = "1.0.0"
$tools_dir = "$base_dir\Tools"
$release_dir = "$base_dir\Release"
$uploader = "..\Uploader\S3Uploader.exe"
$web_dlls = @( "Raven.Abstractions.???", "Raven.Web.???", "log4net.???", "Newtonsoft.Json.???", "Lucene.Net.???", "Spatial.Net.???", "SpellChecker.Net.???", "ICSharpCode.NRefactory.???", `
"Rhino.Licensing.???", "Esent.Interop.???", "Raven.Database.???", "Raven.Http.???", "Raven.Storage.Esent.???", "Raven.Storage.Managed.???", "Raven.Munin.???" );
$server_files = @( "Raven.Server.exe", "log4net.???", "Newtonsoft.Json.???", "Lucene.Net.???", "Spatial.Net.???", "SpellChecker.Net.???", "ICSharpCode.NRefactory.???", "Rhino.Licensing.???", `
"Esent.Interop.???", "Raven.Abstractions.???", "Raven.Database.???", "Raven.Http.???", "Raven.Storage.Esent.???", "Raven.Storage.Managed.???", "Raven.Munin.???" );
$client_dlls_3_5 = @( "Newtonsoft.Json.???", "Raven.Abstractions-3.5.???", "Raven.Client.Lightweight-3.5.???", "MissingBitsFromClientProfile.???" );
$client_dlls = @( "Newtonsoft.Json.???", "Raven.Abstractions.???", "Raven.Client.Lightweight.???", "MissingBitsFromClientProfile.???", "AsyncCtpLibrary.???" );
$all_client_dlls = @( "Raven.Client.Lightweight.???", "Raven.Client.Embedded.???", "Raven.Abstractions.???", "Raven.Http.???", "Raven.Database.???", "Raven.Http.???", `
"Esent.Interop.???", "ICSharpCode.NRefactory.???", "Lucene.Net.???", "Spatial.Net.???", "SpellChecker.Net.???", "log4net.???", "Newtonsoft.Json.???", `
"Raven.Storage.Esent.???", "Raven.Storage.Managed.???", "Raven.Munin.???", "AsyncCtpLibrary.???" );
$test_prjs = @("Raven.Munin.Tests.dll", "Raven.Tests.dll", "Raven.Scenarios.dll", "Raven.Client.VisualBasic.Tests.dll", "Raven.Bundles.Tests.dll" );
}
include .\psake_ext.ps1
task default -depends OpenSource,Release
task Verify40 {
if( (ls "$env:windir\Microsoft.NET\Framework\v4.0*") -eq $null ) {
throw "Building Raven requires .NET 4.0, which doesn't appear to be installed on this machine"
}
}
task Clean {
remove-item -force -recurse $buildartifacts_dir -ErrorAction SilentlyContinue
remove-item -force -recurse $release_dir -ErrorAction SilentlyContinue
}
task Init -depends Verify40, Clean {
if($env:buildlabel -eq $null) {
$env:buildlabel = "13"
}
$projectFiles = ls -path $base_dir -include *.csproj -recurse |
Where { $_ -notmatch [regex]::Escape($lib_dir) } |
Where { $_ -notmatch [regex]::Escape($tools_dir) }
foreach($projectFile in $projectFiles) {
$projectDir = [System.IO.Path]::GetDirectoryName($projectFile)
$projectName = [System.IO.Path]::GetFileName($projectDir)
$asmInfo = [System.IO.Path]::Combine($projectDir, [System.IO.Path]::Combine("Properties", "AssemblyInfo.cs"))
Generate-Assembly-Info `
-file $asmInfo `
-title "$projectName $version.0" `
-description "A linq enabled document database for .NET" `
-company "Hibernating Rhinos" `
-product "RavenDB $version.0" `
-version "$version.0" `
-fileversion "1.0.0.$env:buildlabel" `
-copyright "Copyright © Hibernating Rhinos and Ayende Rahien 2004 - 2010" `
-clsCompliant "true"
}
new-item $release_dir -itemType directory -ErrorAction SilentlyContinue
new-item $buildartifacts_dir -itemType directory -ErrorAction SilentlyContinue
copy $tools_dir\xUnit\*.* $build_dir
# exec { .\Utilities\Binaries\Raven.Silverlighter.exe .\Raven.Client.Silverlight\Raven.Client.Silverlight.csproj .\Raven.Abstractions\Raven.Abstractions.csproj .\Raven.Client.Lightweight\Raven.Client.Lightweight.csproj}
if($global:commercial) {
exec { .\Utilities\Binaries\Raven.ProjectRewriter.exe commercial }
cp "..\RavenDB_Commercial.snk" "Raven.Database\RavenDB.snk"
}
else {
exec { .\Utilities\Binaries\Raven.ProjectRewriter.exe }
cp "Raven.Database\Raven.Database.csproj" "Raven.Database\Raven.Database.g.csproj"
}
}
task Compile -depends Init {
$v4_net_version = (ls "$env:windir\Microsoft.NET\Framework\v4.0*").Name
exec { &"C:\Windows\Microsoft.NET\Framework\$v4_net_version\MSBuild.exe" "$sln_file" /p:OutDir="$buildartifacts_dir\" }
Write-Host "Merging..."
$old = pwd
cd $build_dir
exec { ..\Utilities\Binaries\Raven.Merger.exe }
cd $old
Write-Host "Finished merging"
exec { & "C:\Windows\Microsoft.NET\Framework\$v4_net_version\MSBuild.exe" "$base_dir\Bundles\Raven.Bundles.sln" /p:OutDir="$buildartifacts_dir\" }
exec { & "C:\Windows\Microsoft.NET\Framework\$v4_net_version\MSBuild.exe" "$base_dir\Samples\Raven.Samples.sln" /p:OutDir="$buildartifacts_dir\" }
}
task Test -depends Compile{
$old = pwd
cd $build_dir
Write-Host $test_prjs
foreach($test_prj in $test_prjs) {
Write-Host "Testing $build_dir\$test_prj"
exec { &"$build_dir\xunit.console.clr4.exe" "$build_dir\$test_prj" }
}
cd $old
}
task ReleaseNoTests -depends OpenSource,DoRelease {
}
task Commercial {
$global:commercial = $true
$global:uploadCategory = "RavenDB-Commercial"
}
task Unstable {
$global:commercial = $false
$global:uploadCategory = "RavenDB-Unstable"
}
task OpenSource {
$global:commercial = $false
$global:uploadCategory = "RavenDB"
}
task Release -depends Test,DoRelease {
}
task CopySamples {
$samples = @("MvcMusicStore", "Raven.Sample.ShardClient", "Raven.Sample.Failover", "Raven.Sample.Replication", `
"Raven.Sample.EventSourcing", "Raven.Bundles.Sample.EventSourcing.ShoppingCartAggregator", `
"Raven.Samples.IndexReplication", "Raven.Samples.Includes", "Raven.Sample.SimpleClient", `
"Raven.Sample.ComplexSharding", "Raven.Sample.MultiTenancy", "Raven.Sample.Suggestions", `
"Raven.Sample.LiveProjections")
$exclude = @("bin", "obj", "Data", "Plugins")
foreach ($sample in $samples) {
echo $sample
Delete-Sample-Data-For-Release "$base_dir\Samples\$sample"
cp "$base_dir\Samples\$sample" "$build_dir\Output\Samples" -recurse -force
Delete-Sample-Data-For-Release "$build_dir\Output\Samples\$sample"
}
cp "$base_dir\Samples\Raven.Samples.sln" "$build_dir\Output\Samples" -force
exec { .\Utilities\Binaries\Raven.Samples.PrepareForRelease.exe "$build_dir\Output\Samples\Raven.Samples.sln" "$build_dir\Output" }
}
task CreateOutpuDirectories -depends CleanOutputDirectory {
mkdir $build_dir\Output
mkdir $build_dir\Output\lib
mkdir $build_dir\Output\Web
mkdir $build_dir\Output\Web\bin
mkdir $build_dir\Output\Server
mkdir $build_dir\Output\EmbeddedClient
mkdir $build_dir\Output\Client-3.5
mkdir $build_dir\Output\Client
mkdir $build_dir\Output\Bundles
mkdir $build_dir\Output\Samples
}
task CleanOutputDirectory {
remove-item $build_dir\Output -Recurse -Force -ErrorAction SilentlyContinue
}
task CopyEmbeddedClient {
foreach($client_dll in $all_client_dlls) {
cp "$build_dir\$client_dll" $build_dir\Output\EmbeddedClient
}
}
task CopySmuggler {
cp $build_dir\RavenSmuggler.??? $build_dir\Output
}
task CopyClient {
foreach($client_dll in $client_dlls) {
cp "$build_dir\$client_dll" $build_dir\Output\Client
}
}
task CopyClient35 {
foreach($client_dll in $client_dlls_3_5) {
cp "$build_dir\$client_dll" $build_dir\Output\Client-3.5
}
}
task CopyWeb {
foreach($web_dll in $web_dlls) {
cp "$build_dir\$web_dll" $build_dir\Output\Web\bin
}
cp $base_dir\DefaultConfigs\web.config $build_dir\Output\Web\web.config
}
task CopyBundles {
cp $build_dir\Raven.Bundles.*.??? $build_dir\Output\Bundles
cp $build_dir\Raven.Client.*.??? $build_dir\Output\Bundles
del $build_dir\Output\Bundles\Raven.Bundles.Tests.???
}
task CopyServer {
foreach($server_file in $server_files) {
cp "$build_dir\$server_file" $build_dir\Output\Server
}
cp $base_dir\DefaultConfigs\RavenDb.exe.config $build_dir\Output\Server\Raven.Server.exe.config
}
task CreateDocs {
$v4_net_version = (ls "$env:windir\Microsoft.NET\Framework\v4.0*").Name
if($env:buildlabel -eq 13)
{
return
}
# we expliclty allows this to fail
& "C:\Windows\Microsoft.NET\Framework\$v4_net_version\MSBuild.exe" "$base_dir\Raven.Docs.shfbproj" /p:OutDir="$buildartifacts_dir\"
}
task CopyDocFiles -depends CreateDocs {
cp $base_dir\license.txt $build_dir\Output\license.txt
cp $base_dir\readme.txt $build_dir\Output\readme.txt
cp $base_dir\Help\Documentation.chm $build_dir\Output\Documentation.chm -ErrorAction SilentlyContinue
cp $base_dir\acknowledgements.txt $build_dir\Output\acknowledgements.txt
}
task ZipOutput {
if($env:buildlabel -eq 13)
{
return
}
$old = pwd
cd $build_dir\Output
$file = "$release_dir\$global:uploadCategory-Build-$env:buildlabel.zip"
exec {
& $tools_dir\zip.exe -9 -A -r `
$file `
EmbeddedClient\*.* `
Client\*.* `
Samples\*.* `
Samples\*.* `
Client-3.5\*.* `
Web\*.* `
Bundles\*.* `
Web\bin\*.* `
Server\*.* `
*.*
}
cd $old
}
task ResetBuildArtifcats {
git checkout "Raven.Database\RavenDB.snk"
}
task DoRelease -depends Compile, `
CleanOutputDirectory,`
CreateOutpuDirectories, `
CopyEmbeddedClient, `
CopySmuggler, `
CopyClient, `
CopyClient35, `
CopyWeb, `
CopyBundles, `
CopyServer, `
CopyDocFiles, `
CopySamples, `
ZipOutput, `
ResetBuildArtifcats {
Write-Host "Done building RavenDB"
}
task Upload -depends DoRelease {
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
}
$file = "$release_dir\$global:uploadCategory-Build-$env:buildlabel.zip"
write-host "Executing: $uploader '$global:uploadCategory' $file '$log'"
&$uploader "$uploadCategory" $file "$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"
}
}
task UploadCommercial -depends Commercial, DoRelease, Upload {
}
task UploadOpenSource -depends OpenSource, DoRelease, Upload {
}
task UploadUnstable -depends Unstable, DoRelease, Upload {
}