forked from MassTransit/MassTransit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile.rb
743 lines (626 loc) · 33.3 KB
/
rakefile.rb
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
COPYRIGHT = "Copyright 2007-2013 Chris Patterson, Dru Sellers, Travis Smith, et. al. - All rights reserved."
require File.dirname(__FILE__) + "/build_support/BuildUtils.rb"
require File.dirname(__FILE__) + "/build_support/util.rb"
include FileTest
require 'albacore'
require File.dirname(__FILE__) + "/build_support/ilmergeconfig.rb"
require File.dirname(__FILE__) + "/build_support/ilmerge.rb"
require File.dirname(__FILE__) + "/build_support/versioning.rb"
PRODUCT = 'MassTransit'
CLR_TOOLS_VERSION = 'v4.0.30319'
BUILD_CONFIG = ENV['BUILD_CONFIG'] || "Release"
BUILD_CONFIG_KEY = ENV['BUILD_CONFIG_KEY'] || 'NET40'
BUILD_PLATFORM = ''
TARGET_FRAMEWORK_VERSION = (BUILD_CONFIG_KEY == "NET40" ? "v4.0" : "v3.5")
MSB_USE = (BUILD_CONFIG_KEY == "NET40" ? :net4 : :net35)
OUTPUT_PATH = (BUILD_CONFIG_KEY == "NET40" ? 'net-4.0' : 'net-3.5')
props = {
:src => File.expand_path("src"),
:lib => File.expand_path("lib"),
:build_support => File.expand_path("build_support"),
:stage => File.expand_path("build_output"),
:output => File.join( File.expand_path("build_output"), OUTPUT_PATH ),
:artifacts => File.expand_path("build_artifacts"),
:projects => ["MassTransit", "MassTransit.RuntimeServices"],
:keyfile => File.expand_path("MassTransit.snk")
}
desc "**Default**, cleans, compiles and runs tests"
task :default => [:clean, :restore, :compile35, :ilmerge, :tests]
desc "Default + tests"
task :all => [:default]
desc "**DOOES NOT CLEAR OUTPUT FOLDER**, compiles and runs tests"
task :unclean => [:compile, :ilmerge, :compile_samples, :copy_samples, :copy_services, :tests]
desc "Update the common version information for the build. You can call this task without building."
assemblyinfo :global_version => [:versioning] do |asm|
# Assembly file config
asm.product_name = PRODUCT
asm.description = "MassTransit is a distributed application framework for .NET http://masstransit-project.com"
asm.version = ASSEMBLY_VERSION
asm.file_version = FORMAL_VERSION
asm.custom_attributes :AssemblyInformationalVersion => "#{BUILD_VERSION}",
:ComVisibleAttribute => false,
:CLSCompliantAttribute => true
asm.copyright = COPYRIGHT
asm.output_file = 'src/SolutionVersion.cs'
asm.namespaces "System", "System.Reflection", "System.Runtime.InteropServices", "System.Security"
end
desc "Prepares the working directory for a new build"
task :clean do
FileUtils.rm_rf props[:artifacts]
FileUtils.rm_rf props[:stage]
# work around latency issue where folder still exists for a short while after it is removed
waitfor { !exists?(props[:stage]) }
waitfor { !exists?(props[:artifacts]) }
Dir.mkdir props[:stage]
Dir.mkdir props[:artifacts]
end
task :compile_samples => [:build_starbucks, :build_distributor] do ; end
desc "Compiles MT into build_output"
task :compile => [:versioning, :global_version, :build, :copy_signed] do ; end
desc "Compiles MT into build_output"
task :compile35 => [:versioning, :global_version, :build35, :copy_signed] do ; end
task :copy_signed do
puts 'Copying unmerged dependencies to output folder'
copyOutputFiles File.join(props[:src], "MassTransit/bin/#{BUILD_CONFIG}"), "log4net.{dll,pdb,xml}", props[:output]
copyOutputFiles File.join(props[:src], "MassTransit/bin/#{BUILD_CONFIG}"), "Magnum.{dll,pdb,xml}", props[:output]
copyOutputFiles File.join(props[:src], "Persistence/MassTransit.NHibernateIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.NHibernateIntegration.{dll,pdb,xml}", File.join(props[:output], "Persistence/NHibernate")
outtst = File.join(props[:output], "Testing")
copyOutputFiles File.join(props[:src], "MassTransit.TestFramework/bin/#{BUILD_CONFIG}"), "MassTransit.TestFramework.{dll,pdb,xml}", outtst
outl = File.join(props[:output], "Logging")
copyOutputFiles File.join(props[:src], "Loggers/MassTransit.Log4NetIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.Log4NetIntegration.{dll,pdb,xml}", outl
copyOutputFiles File.join(props[:src], "Loggers/MassTransit.NLogIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.NLogIntegration.{dll,pdb,xml}", outl
copyOutputFiles File.join(props[:src], "MassTransit.Reactive/bin/#{BUILD_CONFIG}"), "MassTransit.*.{dll,pdb,xml}", File.join(props[:output], "Reactive")
outc = File.join(props[:output], "Containers")
copyOutputFiles File.join(props[:src], "Containers/MassTransit.StructureMapIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.StructureMapIntegration.{dll,pdb,xml}", outc
copyOutputFiles File.join(props[:src], "Containers/MassTransit.UnityIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.UnityIntegration.{dll,pdb,xml}", outc
copyOutputFiles File.join(props[:src], "Containers/MassTransit.WindsorIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.WindsorIntegration.{dll,pdb,xml}", outc
copyOutputFiles File.join(props[:src], "Containers/MassTransit.NinjectIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.NinjectIntegration.{dll,pdb,xml}", outc
copyOutputFiles File.join(props[:src], "Containers/MassTransit.AutofacIntegration/bin/#{BUILD_CONFIG}"), "MassTransit.AutofacIntegration.{dll,pdb,xml}", outc
outt = File.join(props[:output], "Transports")
copyOutputFiles File.join(props[:src], "Transports/MassTransit.Transports.MSMQ/bin/#{BUILD_CONFIG}"), "MassTransit.Transports.MSMQ.{dll,pdb,xml}", File.join(outt, "MSMQ")
copyOutputFiles File.join(props[:src], "Transports/MassTransit.Transports.RabbitMq/bin/#{BUILD_CONFIG}"), "MassTransit.Transports.RabbitMq.{dll,pdb,xml}", File.join(outt, "RabbitMQ")
end
task :ilmerge => [:ilmerge_masstransit] do
end
ilmerge :ilmerge_masstransit do |ilm|
out = File.join(props[:output], 'MassTransit.dll')
ilm.output = out
ilm.internalize = File.join(props[:build_support], 'internalize.txt')
ilm.working_directory = File.join(props[:src], "MassTransit/bin/#{BUILD_CONFIG}")
ilm.target = :library
ilm.use MSB_USE
ilm.log = File.join( props[:src], "MassTransit","bin","#{BUILD_CONFIG}", 'ilmerge.log' )
ilm.allow_dupes = true
ilm.references = [ 'MassTransit.dll', 'Stact.dll']
ilm.keyfile = props[:keyfile]
end
desc "Copying Services"
task :copy_services => [:build_unsigned] do
puts "Copying services"
targ = File.join(props[:stage], 'Services', 'RuntimeServices')
src = File.join(props[:src], "MassTransit.RuntimeServices/bin/#{BUILD_CONFIG}")
copyOutputFiles src, "MassTransit.*.{dll,exe,config,log4net.xml,sdf}", targ
copyOutputFiles src, "MassTransit.dll", targ
copyOutputFiles src, "MassTransit.Log4NetIntegration.dll", targ
copyOutputFiles src, "log4net.dll", targ
copyOutputFiles src, "Magnum.dll", targ
copyOutputFiles src, "Stact.dll", targ
copyOutputFiles src, "Newtonsoft.Json.dll", targ
copyOutputFiles src, "NHibernate*.dll", targ
copyOutputFiles src, "Iesi.Collections.dll", targ
copyOutputFiles src, "StructureMap.dll", targ
copyOutputFiles src, "Topshelf.dll", targ
copyOutputFiles src, "Topshelf.Log4NetIntegration.dll", targ
copyOutputFiles File.join(props[:lib], 'SqlCe'), '*', targ
copyOutputFiles File.join(props[:lib], 'SqlCe', 'x86'), '*', File.join(targ, 'x86')
copyOutputFiles File.join(props[:lib], 'SqlCe', 'x86', 'Microsoft.VC90.CRT'), '*', File.join(targ, 'x86', 'Microsoft.VC90.CRT')
copyOutputFiles File.join(props[:lib], 'SqlCe', 'amd64'), '*', File.join(targ, 'amd64')
copyOutputFiles File.join(props[:lib], 'SqlCe', 'amd64', 'Microsoft.VC90.CRT'), '*', File.join(targ, 'amd64', 'Microsoft.VC90.CRT')
targ = File.join(props[:stage], 'Services', 'SystemView')
src = File.join(props[:src], "MassTransit.SystemView/bin/#{BUILD_CONFIG}")
copyOutputFiles src, "MassTransit.*.{dll,exe,config}", targ
copyOutputFiles props[:output], 'MassTransit.dll', targ
copyOutputFiles src, "log4net.dll", targ
copyOutputFiles src, "Magnum.dll", targ
copyOutputFiles src, "StructureMap.dll", targ
targ = File.join(props[:stage], 'Services', 'BusDriver')
src = File.join(props[:src], "Tools/BusDriver/bin/#{BUILD_CONFIG}")
copyOutputFiles src, "BusDriver.{exe}", targ
copyOutputFiles src, "MassTransit.*.{dll,exe,config}", targ
copyOutputFiles props[:output], 'MassTransit.dll', targ
copyOutputFiles src, "RabbitMQ.Client.{dll}", targ
copyOutputFiles src, "log4net.dll", targ
copyOutputFiles src, "Magnum.dll", targ
end
task :copy_samples => [:compile_samples] do
targ = File.join(props[:stage], 'Samples', 'Starbucks')
src = File.join(props[:src], "Samples", "Starbucks")
copyOutputFiles props[:output], "MassTransit.dll", targ
copyOutputFiles src, "Starbucks.Barista/bin/#{BUILD_CONFIG}/MassTransit.Log4NetIntegration.dll", targ
copyOutputFiles File.join(src, "Starbucks.Customer/bin/#{BUILD_CONFIG}"), "{log4net,Magnum,MassTransit.StructureMapIntegration,MassTransit.Transports.Msmq,StructureMap}.dll", targ
copyOutputFiles File.join(src, "Starbucks.Barista/bin/#{BUILD_CONFIG}"), "{MassTransit.WindsorIntegration,Castle.Windsor,Castle.Core,Topshelf}.dll", targ
copyOutputFiles File.join(src, "Starbucks.Cashier/bin/#{BUILD_CONFIG}"), "{MassTransit.NinjectIntegration,Ninject}.dll", targ
copyOutputFiles File.join(src, "Starbucks.Cashier/bin/#{BUILD_CONFIG}"), "Starbucks.Cashier.exe", targ
copyOutputFiles File.join(src, "Starbucks.Cashier/bin/#{BUILD_CONFIG}"), "cashier.log4net.xml", targ
copyOutputFiles File.join(src, "Starbucks.Barista/bin/#{BUILD_CONFIG}"), "Starbucks.Barista.exe", targ
copyOutputFiles File.join(src, "Starbucks.Barista/bin/#{BUILD_CONFIG}"), "barista.log4net.xml", targ
copyOutputFiles File.join(src, "Starbucks.Customer/bin/#{BUILD_CONFIG}"), "Starbucks.Customer.exe", targ
copyOutputFiles File.join(src, "Starbucks.Customer/bin/#{BUILD_CONFIG}"), "customer.log4net.xml", targ
copyOutputFiles File.join(src, "Starbucks.Customer/bin/#{BUILD_CONFIG}"), "Starbucks.Messages.dll", targ
targ = File.join(props[:stage], 'Samples', 'Distributor')
src = File.join(props[:src], "Samples", "Distributor")
copyOutputFiles props[:output], "MassTransit.dll", targ
copyOutputFiles src, "Grid.Distributor.Activator/bin/#{BUILD_CONFIG}/MassTransit.Log4NetIntegration.dll", targ
copyOutputFiles File.join(src, "Grid.Distributor.Activator/bin/#{BUILD_CONFIG}"), "{log4net,Magnum,MassTransit.StructureMapIntegration,MassTransit.Transports.Msmq,StructureMap,Topshelf}.dll", targ
copyOutputFiles File.join(src, "Grid.Distributor.Activator/bin/#{BUILD_CONFIG}"), "Grid.Distributor.Activator.exe", targ
copyOutputFiles File.join(src, "Grid.Distributor.Activator/bin/#{BUILD_CONFIG}"), "Grid.Distributor.Shared.dll", targ
copyOutputFiles File.join(src, "Grid.Distributor.Activator/bin/#{BUILD_CONFIG}"), "*.config", targ
copyOutputFiles File.join(src, "Grid.Distributor.Worker/bin/#{BUILD_CONFIG}"), "Grid.Distributor.Worker.exe", targ
copyOutputFiles File.join(src, "Grid.Distributor.Worker/bin/#{BUILD_CONFIG}"), "*.config", targ
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/MassTransit/MassTransit.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/MassTransit.Tests/MassTransit.Tests.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Containers/MassTransit.AutofacIntegration/MassTransit.AutofacIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Containers/MassTransit.NinjectIntegration/MassTransit.NinjectIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Containers/MassTransit.UnityIntegration/MassTransit.UnityIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Containers/MassTransit.StructureMapIntegration/MassTransit.StructureMapIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Loggers/MassTransit.Log4NetIntegration/MassTransit.Log4NetIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Loggers/MassTransit.NLogIntegration/MassTransit.NLogIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Persistence/MassTransit.NHibernateIntegration/MassTransit.NHibernateIntegration.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Persistence/MassTransit.NHibernateIntegration.Tests/MassTransit.NHibernateIntegration.Tests.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Transports/MassTransit.Transports.RabbitMq/MassTransit.Transports.RabbitMq.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Transports/MassTransit.Transports.RabbitMq.Tests/MassTransit.Transports.RabbitMq.Tests.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Transports/MassTransit.Transports.Msmq/MassTransit.Transports.Msmq.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/Transports/MassTransit.Transports.Msmq.Tests/MassTransit.Transports.Msmq.Tests.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/MassTransit.Reactive/MassTransit.Reactive.csproj'
end
desc "restores missing packages"
msbuild :restore do |msb|
msb.use :net4
msb.targets :RestorePackages
msb.solution = 'src/MassTransit.Reactive.Tests/MassTransit.Reactive.Tests.csproj'
end
desc "Only compiles the application."
msbuild :build do |msb|
msb.properties :Configuration => BUILD_CONFIG,
:BuildConfigKey => BUILD_CONFIG_KEY,
:TargetFrameworkVersion => TARGET_FRAMEWORK_VERSION,
:Platform => 'Any CPU'
msb.properties[:TargetFrameworkVersion] = TARGET_FRAMEWORK_VERSION unless BUILD_CONFIG_KEY == 'NET35'
msb.use :net4 #MSB_USE
msb.targets :Clean, :Build
msb.properties[:SignAssembly] = 'true'
msb.properties[:AssemblyOriginatorKeyFile] = props[:keyfile]
msb.solution = 'src/MassTransit.sln'
end
desc "Only compiles the application."
msbuild :build35 do |msb|
msb.properties :Configuration => BUILD_CONFIG + "35",
:BuildConfigKey => BUILD_CONFIG_KEY,
:TargetFrameworkVersion => TARGET_FRAMEWORK_VERSION,
:Platform => 'Any CPU'
msb.properties[:TargetFrameworkVersion] = TARGET_FRAMEWORK_VERSION unless BUILD_CONFIG_KEY == 'NET35'
msb.use :net4 #MSB_USE
msb.targets :Clean, :Build
msb.properties[:SignAssembly] = 'true'
msb.properties[:AssemblyOriginatorKeyFile] = props[:keyfile]
msb.solution = 'src/MassTransit.sln'
end
desc "Only compiles the application."
msbuild :build_unsigned do |msb|
msb.properties :Configuration => BUILD_CONFIG + "Unsigned",
:BuildConfigKey => BUILD_CONFIG_KEY,
:TargetFrameworkVersion => TARGET_FRAMEWORK_VERSION,
:Platform => 'Any CPU'
msb.properties[:TargetFrameworkVersion] = TARGET_FRAMEWORK_VERSION unless BUILD_CONFIG_KEY == 'NET35'
msb.use :net4 #MSB_USE
msb.targets :Clean, :Build
msb.solution = 'src/MassTransit.sln'
end
msbuild :build_starbucks do |msb|
msb.properties :Configuration => BUILD_CONFIG,
:BuildConfigKey => BUILD_CONFIG_KEY,
:TargetFrameworkVersion => TARGET_FRAMEWORK_VERSION,
:Platform => 'Any CPU'
msb.properties[:TargetFrameworkVersion] = TARGET_FRAMEWORK_VERSION unless BUILD_CONFIG_KEY == 'NET35'
msb.use :net4 #MSB_USE
msb.targets :Build
msb.solution = 'src/Samples/Starbucks/Starbucks.sln'
end
msbuild :build_distributor do |msb|
msb.properties :Configuration => BUILD_CONFIG,
:BuildConfigKey => BUILD_CONFIG_KEY,
:TargetFrameworkVersion => TARGET_FRAMEWORK_VERSION,
:Platform => 'Any CPU'
msb.properties[:TargetFrameworkVersion] = TARGET_FRAMEWORK_VERSION unless BUILD_CONFIG_KEY == 'NET35'
msb.use :net4 #MSB_USE
msb.targets :Build
msb.solution = 'src/Samples/Distributor/Grid.Distributor.sln'
end
def copyOutputFiles(fromDir, filePattern, outDir)
FileUtils.mkdir_p outDir unless exists?(outDir)
Dir.glob(File.join(fromDir, filePattern)){|file|
copy(file, outDir) if File.file?(file)
}
end
task :tests => [:unit_tests]
desc "Runs unit tests"
nunit :unit_tests do |nunit|
nunit.command = File.join('src', 'packages','NUnit.Runners.2.6.3', 'tools', 'nunit-console.exe')
nunit.options = "/framework=#{CLR_TOOLS_VERSION}", '/nothread', '/nologo', '/labels', "\"/xml=#{File.join(props[:artifacts], 'nunit-test-results-')}#{OUTPUT_PATH}.xml\""
nunit.assemblies = FileList["tests/MassTransit.Tests.dll", "tests/MassTransit.Containers.Tests.dll"]
end
desc "Runs transport tests (integration)"
task :transport_tests => [:msmq_tests, :rabbitmq_tests]
task :msmq_tests do
Dir.mkdir props[:artifacts] unless exists?(props[:artifacts])
runner = NUnitRunner.new(File.join('lib', 'nunit', 'net-2.0', "nunit-console#{(BUILD_PLATFORM.empty? ? '' : "-#{BUILD_PLATFORM}")}.exe"),
'tests',
TARGET_FRAMEWORK_VERSION,
['/nothread', '/nologo', '/labels', "\"/xml=#{File.join(props[:artifacts], 'msmq-test-results.xml')}\""])
runner.run ['MassTransit.Transports.Msmq.Tests'].map{ |assem| "#{assem}.dll" }
end
task :rabbitmq_tests do
Dir.mkdir props[:artifacts] unless exists?(props[:artifacts])
runner = NUnitRunner.new(File.join('lib', 'nunit', 'net-2.0', "nunit-console#{(BUILD_PLATFORM.empty? ? '' : "-#{BUILD_PLATFORM}")}.exe"),
'tests',
TARGET_FRAMEWORK_VERSION,
['/nothread', '/nologo', '/labels', "\"/xml=#{File.join(props[:artifacts], 'rabbitmq-test-results.xml')}\""])
runner.run ['MassTransit.Transports.RabbitMQ.Tests'].map{ |assem| "#{assem}.dll" }
end
task :ci => [:default, :package, :moma]
desc "ZIPs up the build results"
zip :package => [:versioning] do |zip|
zip.directories_to_zip props[:stage]
zip.output_file = "MassTransit-#{NUGET_VERSION}.zip"
zip.output_path = props[:artifacts]
end
desc "Runs the MoMA mono analyzer on the project files. Start the executable manually without --nogui to update the profiles once in a while though, or you'll always get the same report from the analyzer."
task :moma => [:compile] do
puts "Analyzing project fitness for mono:"
dlls = project_outputs(props).join(' ')
sh "lib/MoMA/MoMA.exe --nogui --out #{File.join(props[:artifacts], 'MoMA-report.html')} #{dlls}"
end
# NUSPEC
# ===================================================
def add_files stage, what_dlls, nuspec
[['net35', 'net-3.5'], ['net40', 'net-4.0']].each{|fw|
takeFrom = File.join(stage, fw[1], what_dlls)
Dir.glob(takeFrom).each do |f|
nuspec.file(f.gsub("/", "\\"), "lib\\#{fw[0]}")
end
}
end
def add_files_net40 stage, what_dlls, nuspec
takeFrom = File.join(stage, 'net-4.0', what_dlls)
Dir.glob(takeFrom).each do |f|
nuspec.file(f.gsub("/", "\\"), "lib\\net40")
end
end
task :all_nuspecs => [:mt_nuspec, :mtl4n_nuspec, :mtnlog_nuspec, :mtsm_nuspec, :mtaf_nuspec, :mtni_nuspec, :mtun_nuspec, :mtcw_nuspec, :mtnhib_nuspec, :mtrmq_nuspec, :mttf_nuspec, :mtrx_nuspec]
directory 'nuspecs'
nuspec :mt_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'MassTransit is a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
# nuspec.title = Projects[:tx][:title]
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "Magnum", "2.1.1"
nuspec.dependency "Newtonsoft.Json", "5.0.8"
nuspec.output_file = 'nuspecs/MassTransit.nuspec'
add_files props[:stage], 'MassTransit.{dll,pdb,xml}', nuspec
end
nuspec :mt_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.MSMQ'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'MSMQ support for MassTransit (a distributed application framework for .NET, including support for MSMQ and RabbitMQ).'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Magnum", "2.1.1"
nuspec.dependency "Newtonsoft.Json", "5.0.8"
nuspec.output_file = 'nuspecs/MassTransit.MSMQ.nuspec'
add_files props[:stage], "#{File.join('Transports', 'MSMQ', 'MassTransit.Transports.Msmq.{dll,pdb,xml}')}", nuspec
end
nuspec :mtl4n_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.Log4Net'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for Log4Net to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "log4net", "2.0.3"
nuspec.output_file = 'nuspecs/MassTransit.Log4Net.nuspec'
add_files props[:stage], File.join('Logging', 'MassTransit.Log4NetIntegration.{dll,pdb,xml}'), nuspec
end
nuspec :mtnlog_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.NLog'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Henrik Feldt'
nuspec.owners = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for NLog to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "NLog", "2.1.0"
nuspec.output_file = 'nuspecs/MassTransit.NLog.nuspec'
add_files props[:stage], File.join('Logging', 'MassTransit.NLogIntegration.{dll,pdb,xml}'), nuspec
end
nuspec :mtcw_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.CastleWindsor'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for Castle Windsor to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Castle.Windsor", "3.2.1"
nuspec.output_file = 'nuspecs/MassTransit.CastleWindsor.nuspec'
add_files props[:stage], "#{File.join('Containers', 'MassTransit.WindsorIntegration.{dll,pdb,xml}')}", nuspec
end
nuspec :mtrmq_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.RabbitMQ'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for RabbitMQ to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "RabbitMQ.Client", "3.2.1"
nuspec.output_file = 'nuspecs/MassTransit.RabbitMQ.nuspec'
add_files props[:stage], "#{File.join('Transports', 'RabbitMQ', 'MassTransit.Transports.RabbitMq.{dll,pdb,xml}')}", nuspec
end
nuspec :mtaf_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.Autofac'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for Autofac to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Autofac", "2.6.3"
nuspec.output_file = 'nuspecs/MassTransit.Autofac.nuspec'
add_files props[:stage], "#{File.join('Containers', 'MassTransit.AutofacIntegration.{dll,pdb,xml}')}", nuspec
end
nuspec :mtnhib_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.NHibernate'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'An integration library for NHibernate support in MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "NHibernate", "3.3.3"
nuspec.output_file = 'nuspecs/MassTransit.NHibernate.nuspec'
add_files props[:stage], "#{File.join('Persistence', 'NHibernate', 'MassTransit.NHibernateIntegration.{dll,pdb,xml}')}", nuspec
end
nuspec :mtni_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.Ninject'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for Ninject to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Ninject", "3.0.1.10"
nuspec.output_file = 'nuspecs/MassTransit.Ninject.nuspec'
add_files props[:stage], "#{File.join('Containers', 'MassTransit.NinjectIntegration.{dll,pdb,xml}')}", nuspec
end
nuspec :mtsm_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.StructureMap'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for StructureMap to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "StructureMap", "2.6.4.1"
nuspec.output_file = 'nuspecs/MassTransit.StructureMap.nuspec'
add_files props[:stage], "#{File.join('Containers', 'MassTransit.StructureMapIntegration.{dll,pdb,xml}')}", nuspec
end
nuspec :mtun_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.Unity'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This integration library adds support for Unity to MassTransit, a distributed application framework for .NET, including support for MSMQ and RabbitMQ.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Unity", "2.1.505.2"
nuspec.output_file = 'nuspecs/MassTransit.Unity.nuspec'
add_files props[:stage], "#{File.join('Containers', 'MassTransit.UnityIntegration.{dll,pdb,xml}')}", nuspec
end
nuspec :mttf_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.TestFramework'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This library contains testing helpers for use with MassTransit.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Magnum.TestFramework", "2.1.1"
nuspec.dependency "NUnit", "2.6.3"
nuspec.dependency "RhinoMocks", "3.6.1"
nuspec.output_file = 'nuspecs/MassTransit.TestFramework.nuspec'
add_files props[:stage], "#{File.join('Testing', 'MassTransit.TestFramework.{dll,pdb,xml}')}", nuspec
add_files props[:stage], "#{File.join('Testing', 'Magnum.TestFramework.{dll,pdb,xml}')}", nuspec
end
nuspec :mtrx_nuspec => ['nuspecs'] do |nuspec|
nuspec.id = 'MassTransit.Reactive'
nuspec.version = NUGET_VERSION
nuspec.authors = 'Chris Patterson, Dru Sellers, Travis Smith'
nuspec.description = 'This library contains extension methods for using Reactive Extensions with MassTransit.'
nuspec.projectUrl = 'http://masstransit-project.com'
nuspec.language = "en-US"
nuspec.licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
nuspec.requireLicenseAcceptance = "false"
nuspec.dependency "MassTransit", NUGET_VERSION
nuspec.dependency "Rx-Core", "2.1.30214.0"
nuspec.dependency "Rx-Interfaces", "2.1.30214.0"
nuspec.dependency "Rx-Linq", "2.1.30214.0"
nuspec.output_file = 'nuspecs/MassTransit.Reactive.nuspec'
add_files_net40 props[:stage], "#{File.join('Reactive', 'MassTransit.Reactive.{dll,pdb,xml}')}", nuspec
end
# NUGET
# ===================================================
directory 'build_artifacts'
desc "Builds the nuget package"
task :nuget => [:versioning, 'build_artifacts', :all_nuspecs] do
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.Log4Net.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.NLog.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.StructureMap.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.Autofac.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.Ninject.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.Unity.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.CastleWindsor.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.NHibernate.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.MSMQ.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.RabbitMQ.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.TestFramework.nuspec -o build_artifacts"
sh "src/.nuget/nuget.exe pack -BasePath build_output nuspecs/MassTransit.Reactive.nuspec -o build_artifacts"
end
def project_outputs(props)
props[:projects].map{ |p| "src/#{p}/bin/#{BUILD_CONFIG}/#{p}.dll" }.
concat( props[:projects].map{ |p| "src/#{p}/bin/#{BUILD_CONFIG}/#{p}.exe" } ).
find_all{ |path| exists?(path) }
end
desc "publishes (pushes) the nuget package 'NLog.Targets.RabbitMQ'"
nugetpush :nr_nuget_push do |nuget|
nuget.command = "#{COMMANDS[:nuget]}"
nuget.package = "#{File.join(FOLDERS[:nuget], PROJECTS[:nr][:nuget_key] + "." + NUGET_VERSION + '.nupkg')}"
# nuget.apikey = "...."
nuget.source = URIS[:local]
nuget.create_only = false
end
task :verify do
changed_files = `git diff --cached --name-only`.split("\n") + `git diff --name-only`.split("\n")
if !(changed_files == [".semver", "Rakefile.rb"] or
changed_files == ["Rakefile.rb"] or
changed_files == [".semver"] or
changed_files.empty?)
raise "Repository contains uncommitted changes; either commit or stash."
end
end
task :gittag do
v = SemVer.find
if `git tag`.split("\n").include?("#{v.to_s}")
raise "Version #{v.to_s} has already been released! You cannot release it twice."
end
puts 'committing'
`git commit -am "Released version #{v.to_s}"`
puts 'tagging'
`git tag #{v.to_s}`
puts 'pushing'
`git push`
`git push --tags`
puts "MAINTAINERS: now merge into master and then back into develop!!!"
end
desc "publish nugets! (doesn't build)"
task :publish => [:nr_nuget_push]
desc "MAINTAINERS: builds, git tags and pushes nugets"
task :release => [:verify, :default, :gittag, :publish] do
puts 'done'
end