-
Notifications
You must be signed in to change notification settings - Fork 48
/
Ninject.include
760 lines (665 loc) · 35.9 KB
/
Ninject.include
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
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
<?xml version="1.0" encoding="utf-8"?>
<project name="NinjectIncludes">
<property name="teamcity" value="false" overwrite="false"/>
<property name="path.base" value="${project::get-base-directory()}"/>
<property name="path.build" value="${path.base}/build" dynamic="true"/>
<property name="path.lib" value="${path.base}/lib" dynamic="true"/>
<property name="path.dist" value="${path.base}/dist" dynamic="true"/>
<property name="path.docs" value="${path.base}/docs" dynamic="true"/>
<property name="path.src" value="${path.base}/src" dynamic="true"/>
<property name="path.build.assemblyinfo" value="${path.src}/${build.asminfo}" dynamic="true"/>
<property name="path.tools" value="${path.base}/tools" dynamic="true"/>
<property name="path.tools.xunit.sl" value="${path.tools}/xunit.sl/" dynamic="true"/>
<property name="path.tools.xunit" value="${path.tools}/xunit.net" dynamic="true"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.exe" dynamic="true"/>
<property name="path.tools.moq" value="${path.tools}/moq" dynamic="true"/>
<property name="path.tools.ncover" value="${path.tools}/ncover" dynamic="true"/>
<property name="path.tools.git" value="${path.tools}/git" dynamic="true"/>
<property name="path.tools.statlight" value="${path.tools}/statlight/statlight.exe" dynamic="true"/>
<property name="path.tools.nuget" value="${path.tools}/nuget/nuget.exe" dynamic="true"/>
<property name="path.tools.fluentassertions" value="${path.tools}/fluentassertions" dynamic="true"/>
<property name="product.keyfile" value="Ninject.snk" overwrite="false"/>
<property name="product.docfile" value="${product.name}.xml" overwrite="false"/>
<property name="product.assembly" value="${product.name}.dll" overwrite="false"/>
<property name="product.assembly.test" value="${product.name}.Test.dll" overwrite="false"/>
<property name="product.assembly.silverlighttest" value="${product.name}.SilverlightTests.xap" overwrite="false"/>
<property name="product.assembly.silverlighttestdll" value="${product.name}.SilverlightTests.dll" overwrite="false"/>
<property name="product.additionalVersionTag" value="" overwrite="false"/>
<property name="nuget.apiKey" value="" overwrite="false"/>
<property name="product.clsCompliant" value="true" overwrite="false"/>
<property name="product.packagePostfix" value="" overwrite="false"/>
<property name="version.major" value="${version::get-major(version::parse(version))}" dynamic="true"/>
<property name="version.minor" value="${version::get-minor(version::parse(version))}" dynamic="true"/>
<property name="version.build" value="${version::get-build(version::parse(version))}" dynamic="true"/>
<property name="version.revision" value="${version::get-revision(version::parse(version))}" dynamic="true"/>
<property name="build.version" value="${version.major}.${version.minor}.${version.build}.${version.revision}" dynamic="true"/>
<property name="build.assemblyversion" value="${version.major}.${version.minor}.0.0" dynamic="true"/>
<property name="build.config" value="debug" overwrite="false"/>
<property name="build.platform" value="net-3.5" overwrite="true"/>
<property name="build.target" value="net-3.5" overwrite="false"/>
<property name="build.asminfo" value="SharedAssemblyInfo.cs"/>
<property name="package" value="false" readonly="false" overwrite="false"/>
<property name="skip.tests" value="false" readonly="false" overwrite="false"/>
<property name="skip.silverlightTests" value="false" readonly="false" overwrite="false"/>
<property name="Is64BitOperatingSystem" value="false" />
<property name="Is64BitProcess" value="false" />
<property name="IsWow64Process" value="false" />
<target name="DetectOperatingSystemArchitecture" depends="DetectIfWow64Process,DetectIf64BitProcess">
<description>
This will detect whether the current Operating System is running as a 32-bit or 64-bit Operating System regardless of whether this is a 32-bit or 64-bit process.
</description>
<property name="Is64BitOperatingSystem" value="${IsWow64Process or Is64BitProcess}" />
<if test="${Is64BitOperatingSystem}">
<echo message="The operating system you are running is 64-bit." />
</if>
<if test="${not Is64BitOperatingSystem}">
<echo message="The operating system you are running is 32-bit." />
</if>
</target>
<script language="C#" prefix="PInvoke">
<references>
<include name="System.dll" />
</references>
<imports>
<import namespace="System.Diagnostics" />
<import namespace="System.Runtime.InteropServices" />
</imports>
<code>
<![CDATA[
[DllImport("kernel32.dll")]
public static extern bool IsWow64Process(System.IntPtr hProcess, out bool lpSystemInfo);
[Function("IsWow64Process")]
public bool IsWow64Process()
{
bool retVal = false;
IsWow64Process(Process.GetCurrentProcess().Handle, out retVal);
return retVal;
}
]]>
</code>
</script>
<target name="DetectIfWow64Process">
<description>
Detects whether we are currently in a WoW64 process or not.
</description>
<property name="IsWow64Process" value="${PInvoke::IsWow64Process()}" />
<echo message="Setting the [IsWow64Process] property to ${IsWow64Process}." />
</target>
<target name="DetectIf64BitProcess">
<description>
Detects whether we are currently in a 32-bit or 64-bit process (not necessarily what the OS is running). Note that as of the time of this writing, this will ALWAYS return false because NAnt is compiled to run in 32-bit mode only.
</description>
<!-- This can return x86, x64, AMD64, or IA64 as of the time of this writing. This works for a 32-bit process in a 64-bit OS because the OS makes the 64-bitness transparent to the process in this environment variable. -->
<property name="Is64BitProcess" value="${environment::get-variable('PROCESSOR_ARCHITECTURE')!='x86'}" />
<echo message="Setting the [Is64BitProcess] property to ${Is64BitProcess}." />
</target>
<target name="rebuild" depends="clean, build"/>
<target name="clean">
<delete dir="${path.build}" if="${directory::exists(path.build)}"/>
<delete dir="${path.dist}" if="${directory::exists(path.dist)}"/>
</target>
<target name="build" depends="InitializeBuildSystem all"/>
<target name="InitializeBuildSystem" depends="DetectOperatingSystemArchitecture"/>
<target name="create-assembly-info" depends="init get-git-revision">
<echo message="##teamcity[buildNumber '${build.version}']" />
<echo message="Assembly Version: '${build.assemblyversion}'" />
<echo message="Build Platform: '${build.platform}'" />
<asminfo output="${path.build.assemblyinfo}" language="CSharp">
<imports>
<import namespace="System"/>
<import namespace="System.Reflection"/>
<import namespace="System.Runtime.InteropServices"/>
</imports>
<attributes>
<attribute type="AssemblyProductAttribute" value="${product.name}: ${product.description}"/>
<attribute type="AssemblyCompanyAttribute" value="${product.company}"/>
<attribute type="AssemblyCopyrightAttribute" value="Copyright © ${product.duration} ${product.company} and contributors"/>
<attribute type="AssemblyVersionAttribute" value="${build.assemblyversion}"/>
<attribute type="AssemblyFileVersionAttribute" value="${build.version}" unless="${build.platform == 'netcf-3.5'}"/>
<attribute type="ComVisibleAttribute" value="false"/>
<attribute type="CLSCompliantAttribute" value="true" if="${product.clsCompliant}"/>
</attributes>
</asminfo>
</target>
<target name="init">
<mkdir dir="${path.build}" if="${not(directory::exists(path.build))}"/>
<mkdir dir="${path.dist}" if="${not(directory::exists(path.dist))}"/>
<call target="config-build-${build.config}"/>
<call target="config-platform-${build.target}"/>
<property name="current.path.ninject.lib" value="${path.lib}/Ninject/${build.platform}"/>
<property name="current.path.context.lib" value="${path.lib}/Ninject.Extensions.ContextPreservation/${build.platform}"/>
<property name="current.path.namedscope.lib" value="${path.lib}/Ninject.Extensions.NamedScope/${build.platform}"/>
<property name="current.path.build" value="${path.build}/${build.platform}/${build.config}"/>
<property name="current.path.build.lib" value="${path.build}/${build.platform}/${build.config}/lib"/>
<property name="current.path.test" value="${path.build}/${build.platform}/tests" />
<mkdir dir="${current.path.build}" if="${not(directory::exists(current.path.build))}"/>
<mkdir dir="${current.path.build.lib}" if="${not(directory::exists(current.path.build.lib))}"/>
<copy todir="${current.path.build}">
<fileset basedir="${path.base}">
<include name="LICENSE.txt"/>
</fileset>
</copy>
<copy todir="${current.path.build.lib}">
<fileset basedir="${current.path.ninject.lib}">
<include name="**/*.dll"/>
<include name="**/*.xml"/>
</fileset>
</copy>
<copy todir="${current.path.build.lib}">
<fileset basedir="${current.path.context.lib}">
<include name="**/*.dll"/>
<include name="**/*.xml"/>
</fileset>
</copy>
<copy todir="${current.path.build.lib}">
<fileset basedir="${current.path.namedscope.lib}">
<include name="**/*.dll"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<target name="config-build-debug">
<property name="build.debug" value="true"/>
<property name="build.optimize" value="false" overwrite="false"/>
<property name="global.build.defines" value="DEBUG,TRACE"/>
</target>
<target name="config-build-release">
<property name="build.debug" value="PdbOnly"/>
<property name="build.optimize" value="true" overwrite="false"/>
<property name="global.build.defines" value="TRACE,STRONG"/>
</target>
<target name="config-platform-net-3.5-client">
<property name="nant.settings.currentframework" value="net-3.5-client"/>
<property name="build.defines" value="${global.build.defines},NET,NET_35"/>
<property name="nuget.platform" value="net35"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-3.5" overwrite="true"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.exe" dynamic="true"/>
</target>
<target name="config-platform-net-3.5">
<property name="nant.settings.currentframework" value="net-3.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_35"/>
<property name="nuget.platform" value="net35-full"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-3.5" overwrite="true"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.exe" dynamic="true"/>
</target>
<target name="config-platform-net-3.5_medium_trust">
<property name="nant.settings.currentframework" value="net-3.5-client"/>
<property name="build.defines" value="${global.build.defines},NET,NET_35,MEDIUM_TRUST"/>
<property name="nuget.add" value="false"/>
<property name="build.platform" value="net-3.5_medium_trust" overwrite="true"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.exe" dynamic="true"/>
</target>
<target name="config-platform-net-4.0-client">
<property name="nant.settings.currentframework" value="net-4.0-client"/>
<property name="build.defines" value="${global.build.defines},NET,NET_40,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.platform" value="net40"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-4.0" overwrite="true"/>
</target>
<target name="config-platform-net-4.0">
<property name="nant.settings.currentframework" value="net-4.0"/>
<property name="build.defines" value="${global.build.defines},NET,NET_40,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.platform" value="net40-full"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-4.0" overwrite="true"/>
</target>
<target name="config-platform-net-4.0_medium_trust">
<property name="nant.settings.currentframework" value="net-4.0-client"/>
<property name="build.defines" value="${global.build.defines},NET,NET_40,MEDIUM_TRUST,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.add" value="false"/>
<property name="build.platform" value="net-4.0_medium_trust" overwrite="true"/>
</target>
<target name="config-platform-net-4.5-client">
<property name="nant.settings.currentframework" value="net-4.5-client"/>
<property name="build.defines" value="${global.build.defines},NET,NET_45,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.platform" value="net45"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-4.5" overwrite="true"/>
</target>
<target name="config-platform-net-4.5_medium_trust">
<property name="nant.settings.currentframework" value="net-4.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_45,MEDIUM_TRUST,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.add" value="false"/>
<property name="build.platform" value="net-4.5_medium_trust" overwrite="true"/>
</target>
<target name="config-platform-net-4.5">
<property name="nant.settings.currentframework" value="net-4.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_45,NO_PARTIAL_TRUST"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
<property name="nuget.platform" value="net45-full"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="net-4.5" overwrite="true"/>
</target>
<target name="config-platform-silverlight-2.0">
<property name="nant.settings.currentframework" value="silverlight-2.0"/>
<property name="build.defines" value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_20,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS"/>
<property name="nuget.platform" value="sl2"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="silverlight-2.0" overwrite="true"/>
</target>
<target name="config-platform-silverlight-3.0">
<property name="nant.settings.currentframework" value="silverlight-3.0"/>
<property name="build.defines" value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_30,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS"/>
<property name="nuget.platform" value="sl3"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="silverlight-3.0" overwrite="true"/>
</target>
<target name="config-platform-silverlight-4.0">
<property name="nant.settings.currentframework" value="silverlight-4.0"/>
<property name="build.defines" value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_40,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS,NO_PARTIAL_TRUST"/>
<property name="nuget.platform" value="sl4"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="silverlight-4.0" overwrite="true"/>
</target>
<target name="config-platform-silverlight-5.0">
<property name="nant.settings.currentframework" value="silverlight-5.0"/>
<property name="build.defines" value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_50,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS,NO_PARTIAL_TRUST"/>
<property name="nuget.platform" value="sl5"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="silverlight-5.0" overwrite="true"/>
</target>
<target name="config-platform-silverlight-4.0-wp7">
<property name="nant.settings.currentframework" value="silverlight-wp7"/>
<property name="build.defines" value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_40,WINDOWS_PHONE,NO_LCG,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS,NO_MOQ"/>
<property name="nuget.platform" value="sl3-wp"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="silverlight-4.0-wp7" overwrite="true"/>
</target>
<target name="config-platform-silverlight-4.0-wp71">
<property name="nant.settings.currentframework" value="silverlight-wp71"/>
<property name="build.defines" value="${global.build.defines},SILVERLIGHT,SILVERLIGHT_40,WINDOWS_PHONE,NO_LCG,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS,NO_MOQ"/>
<property name="nuget.platform" value="sl4-windowsphone71"/>
<property name="nuget.add" value="true"/>
<property name="build.platform" value="silverlight-4.0-wp71" overwrite="true"/>
</target>
<target name="config-platform-netcf-3.5">
<property name="nant.settings.currentframework" value="netcf-3.5"/>
<property name="build.defines" value="${global.build.defines},NETCF,NETCF_35,NO_LCG,NO_ASSEMBLY_SCANNING,NO_PARTIAL_TRUST,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS"/>
<property name="nuget.add" value="false"/>
<property name="build.platform" value="netcf-3.5" overwrite="true"/>
</target>
<target name="config-platform-mono-2.0">
<property name="nant.settings.currentframework" value="mono-2.0"/>
<property name="build.defines" value="${global.build.defines},NET,NET_35,MONO,MONO_20,NO_GENERIC_MOQ" />
<property name="nuget.add" value="false"/>
<property name="build.platform" value="mono-2.0" overwrite="true"/>
</target>
<target name="config-platform-mono-3.5">
<property name="nant.settings.currentframework" value="mono-3.5"/>
<property name="build.defines" value="${global.build.defines},NET,NET_35,MONO,MONO_35,NO_GENERIC_MOQ" />
<property name="nuget.add" value="false"/>
<property name="build.platform" value="mono-3.5" overwrite="true"/>
</target>
<target name="config-platform-mono-4.0">
<property name="nant.settings.currentframework" value="mono-4.0"/>
<property name="build.defines" value="${global.build.defines},NET,NET_40,MONO,MONO_40,NO_GENERIC_MOQ" />
<property name="nuget.add" value="false"/>
<property name="build.platform" value="mono-4.0" overwrite="true"/>
<property name="path.tools.xunit.console" value="${path.tools.xunit}/xunit.console.clr4.exe"/>
</target>
<target name="test" depends="compile-tests" unless="${skip.tests}" if="${not(string::contains(build.platform, 'silverlight') or build.platform == 'netcf-3.5')}">
<exec
program="${path.tools.xunit.console}"
workingdir="${current.path.test}"
commandline="${product.assembly.test} /html ${current.path.test}/results.html"
failonerror="true"
if="${not(string::contains(build.platform, 'mono')) or teamcity}"/>
<if test="${string::contains(build.platform, 'mono') and not(teamcity)}">
<exec
program="${framework::get-runtime-engine(framework::get-target-framework())}"
workingdir="${current.path.test}"
commandline="${path.tools.xunit.console} ${product.assembly.test} /html ${current.path.test}/results.html"
failonerror="true"/>
</if>
<if test="${not Is64BitOperatingSystem}">
<exec verbose="true" program="${path.tools.ncover}/ncover.console.exe" workingdir="${current.path.test}"
commandline=""${path.tools.xunit.console}" "${product.assembly.test}" //reg //w "." //x "coverage.xml"" />
</if>
</target>
<target name="silverlight-test" depends="compile-silverlight-tests" unless="${skip.tests or skip.silverlightTests}" if="${string::contains(build.platform, 'silverlight')}">
<property name="cmdLine" value='-x"${product.assembly.silverlighttest}" --teamcity --debug' if="${teamcity}"/>
<property name="cmdLine" value='-x"${product.assembly.silverlighttest}"' unless="${teamcity}"/>
<exec program="${path.tools.statlight}" workingdir="${current.path.test}" commandline="${cmdLine}" failonerror="true" unless="${string::contains(build.platform, 'wp')}" />
<exec program="${path.tools.statlight}" workingdir="${current.path.test}" commandline="${cmdLine} --UsePhoneEmulator" failonerror="true" if="${string::contains(build.platform, 'wp')}" />
</target>
<target name="UnzipDependencies">
<foreach item="String" in="${dependencies}" delim="," property="dependency">
<delete>
<fileset>
<include name="${path.lib}/${dependency}/**/*" />
<exclude name="${path.lib}/${dependency}/*.txt" />
<exclude name="${path.lib}/${dependency}/*.zip" />
</fileset>
</delete>
<foreach item="File" property="filepath">
<in>
<items>
<include name="${path.lib}/${dependency}/*release*.zip"/>
</items>
</in>
<do>
<property name="filename" value="${path::get-file-name-without-extension(filepath)}"/>
<property name="index" value="${string::index-of(filename, 'release')}"/>
<property name="destinationDir" value="${string::substring(filename, string::index-of(filename, 'release') + 8, string::get-length(filename) - string::index-of(filename, 'release') - 8)}"/>
<unzip zipfile="${filepath}" todir="${path.lib}/${dependency}/${destinationDir}"/>
</do>
</foreach>
</foreach>
</target>
<target name="package-all" depends="all package-bin package-source" />
<target name="buildServerPlatforms" depends="InitializeBuildSystem">
<foreach item="String" in="${product.buildserverPlatforms}" delim="," property="platform">
<if test="${not(property::exists('skip.' + platform))}">
<property name="build.target" value="${platform}"/>
<call target="package-bin"/>
</if>
</foreach>
<call target="package-source"/>
</target>
<target name="allPlatforms" depends="InitializeBuildSystem">
<call target="csproj"/>
<foreach item="String" in="${product.platforms}" delim="," property="platform">
<if test="${not(property::exists('skip.' + platform))}">
<property name="build.target" value="${platform}"/>
<call target="package-bin"/>
</if>
</foreach>
<call target="package-source"/>
<call target="nuget-all"/>
</target>
<target name="package-bin" depends="create-assembly-info all">
<mkdir dir="${path.dist}" if="${not(directory::exists(path.dist))}"/>
<zip zipfile="${path.dist}\${product.name}${product.packagePostfix}-${build.version}${product.additionalVersionTag}-${build.config}-${build.platform}.zip" ziplevel="9">
<fileset basedir="${current.path.build}">
<include name="**/*.*"/>
</fileset>
</zip>
</target>
<target name="package-source" depends="create-assembly-info">
<mkdir dir="${path.dist}" if="${not(directory::exists(path.dist))}"/>
<zip zipfile="${path.dist}\${product.name}${product.packagePostfix}-${build.version}${product.additionalVersionTag}-source.zip" ziplevel="9">
<fileset basedir="${path.base}">
<include name="lib/*.*"/>
<include name="**/*.cs"/>
<include name="**/*.csproj"/>
<include name="**/*.sln"/>
<include name="**/*.txt"/>
<include name="**/*.build"/>
<include name="**/*.include"/>
<include name="**/*.snk"/>
</fileset>
</zip>
</target>
<target name="csproj">
<property name="nant.settings.currentframework" value="net-4.5"/>
<msbuild project="${path.src}/${product.name}/${product.name}.csproj" />
</target>
<target name="revert">
<echo message="Reverting version info"/>
<exec
program="${path.tools.git}/git.exe"
commandline='checkout "${path.build.assemblyinfo}"'
failonerror="false"/>
</target>
<target name="get-git-revision">
<property name="temp.revision.file" value="RevisionNr.tmp" />
<exec
program="${path.tools.git}/git.exe"
commandline='describe --long'
failonerror="true"
output="${temp.revision.file}"/>
<loadfile file="${temp.revision.file}" property="actual.git.revision"/>
<regex pattern="(?<gitmajor>\d+)\.(?<gitminor>\d+)\.(?<gitbuild>\d+)(\.(?<gitrevision>\d+))?-((?<gitprerelease>[^-]+)-)?(?<gitrevisionnumber>\d+)-.*" input="${actual.git.revision}"/>
<property name="version.major" value="${gitmajor}" overwrite="true" />
<property name="version.minor" value="${gitminor}" overwrite="true" />
<property name="version.build" value="${gitbuild}" overwrite="true" />
<property name="version.revision" value="${gitrevisionnumber}" overwrite="true" />
<delete file="${temp.revision.file}" failonerror="false"/>
</target>
<target name="nuget">
<property name="nuget.sourcedir" value="${path.base}/nuget" />
<property name="nuget.basedir" value="${path.base}/build/nuget" />
<property name="nuget.symbol.basedir" value="${path.base}/build/nuget_symbol" />
<property name="nuget.platforms" value="${product.platforms}" />
<property name="nuget.name" value="${product.name}" />
<property name="nuget.project" value="${path.src}/${product.name}/${product.name}.csproj" />
<property name="nuget.releaseDirectory" value="${path.build}\${build.platform}\release" dynamic="true"/>
<property name="nuget.dependencies" value="${dependencies}" />
<property name="nuget.additionalFiles" value="-" />
<property name="nuget.packageName" value="${nuget.name}${product.packagePostfix}" />
<call target="nuget-run"/>
</target>
<target name="nuget-run" depends="get-git-revision" description="Copies the nuget output to the top bin directory">
<delete dir="${nuget.basedir}"/>
<if test="${not(nuget.symbol.basedir == '')}"> <!-- unless does not work on delete -->
<delete dir="${nuget.symbol.basedir}"/>
</if>
<property name="nuget.platform" value=""/>
<property name="nuget.version" value="${build.version}" if="${product.additionalVersionTag == ''}"/>
<property name="nuget.version" value="${version.major}.${version.minor}.${version.build}${product.additionalVersionTag}-${version.revision}" unless="${product.additionalVersionTag == ''}"/>
<call target="config-build-${build.config}"/>
<foreach item="String" in="${nuget.platforms}" delim="," property="platform">
<if test="${not(property::exists('skip.' + platform))}">
<call target="config-platform-${platform}"/>
<copy overwrite="false" todir="${nuget.basedir}\lib\${nuget.platform}" flatten="true" if="${nuget.add}">
<fileset basedir="${nuget.releaseDirectory}">
<include name="${nuget.name}.dll" />
<include name="${nuget.name}.xml" />
<include name="${nuget.name}.pdb" />
<include name="${nuget.additionalFiles}" unless="${nuget.additionalFiles == '-'}"/>
</fileset>
</copy>
</if>
</foreach>
<copy overwrite="false" todir="${nuget.basedir}">
<fileset basedir="${nuget.sourcedir}">
<include name="**/*" />
</fileset>
</copy>
<copy overwrite="false" todir="${path.base}">
<fileset basedir="${nuget.sourcedir}">
<include name="License.txt" />
</fileset>
</copy>
<echo message="Build Version: ${nuget.version}"/>
<xmlpoke file="${nuget.basedir}/${nuget.name}.nuspec" xpath="//package/nu:metadata/nu:version" value="${nuget.version}">
<namespaces>
<namespace prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance" />
<namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema" />
<namespace prefix="nu" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
<foreach item="String" in="${nuget.dependencies}" delim="," property="dependency">
<property name="asm1" value="${path.lib}\${dependency}\net-4.0\${dependency}.dll"/>
<property name="asm2" value="${nuget.releaseDirectory}\${dependency}.dll"/>
<property name="asm3" value="${nuget.releaseDirectory}\lib\${dependency}.dll"/>
<property name="asm" value="${asm3}" if="${file::exists(asm3)}"/>
<property name="asm" value="${asm2}" if="${file::exists(asm2)}"/>
<property name="asm" value="${asm1}" if="${file::exists(asm1)}"/>
<property name="version" value="${assemblyname::get-version(assemblyname::get-assembly-name(asm))}"/>
<property name="maxVersion" value=""/>
<property name="versionPrerelease" value=""/>
<property name="i" value="0"/>
<foreach item="String" in="${version}" delim="." property="versionPart">
<property name="i" value="${int::parse(i) + 1}"/>
<property name="maxVersion" value="${maxVersion + '.'}" unless="${i == '1'}"/>
<property name="maxVersion" value="${maxVersion + versionPart}" if="${i == '1'}"/>
<property name="maxVersion" value="${maxVersion + int::to-string(int::parse(versionPart) + 1)}" if="${i == '2'}"/>
<property name="maxVersion" value="${maxVersion + '0'}" if="${i == '3'}"/>
<property name="maxVersion" value="${maxVersion + '0'}" if="${i == '4'}"/>
<property name="versionPrerelease" value="${versionPrerelease + '.'}" unless="${i == '1' or i == '4'}"/>
<property name="versionPrerelease" value="${versionPrerelease + versionPart}" unless="${i == '4'}"/>
</foreach>
<property name="versionPrerelease" value="${versionPrerelease + product.additionalVersionTag}"/>
<xmlpoke file="${nuget.basedir}/${nuget.name}.nuspec"
xpath="//package/nu:metadata/nu:dependencies/nu:dependency[@id='${dependency}']/@version"
value="${'[' + version + ',' + maxVersion + ')'}"
if="${product.additionalVersionTag == ''}">
<namespaces>
<namespace prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance" />
<namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema" />
<namespace prefix="nu" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
<xmlpoke file="${nuget.basedir}/${nuget.name}.nuspec"
xpath="//package/nu:metadata/nu:dependencies/nu:dependency[@id='${dependency}']/@version"
value="${versionPrerelease}"
unless="${product.additionalVersionTag == ''}">
<namespaces>
<namespace prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance" />
<namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema" />
<namespace prefix="nu" uri="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" />
</namespaces>
</xmlpoke>
</foreach>
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.basedir}\${nuget.name}.nuspec -Exclude **\*.pdb" />
<move todir="${path.dist}\NuGet\">
<fileset basedir="${nuget.basedir}">
<include name="*.nupkg" />
</fileset>
</move>
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.basedir}\${nuget.name}.nuspec" />
<if test="${not(nuget.project == '')}">
<exec program="${path.tools.nuget}" workingdir="${nuget.basedir}" commandline="pack ${nuget.project} -symbols" />
<unzip zipfile="${nuget.basedir}\${nuget.packageName}.${nuget.version}.nupkg" todir="${nuget.symbol.basedir}/target"/>
<unzip zipfile="${nuget.basedir}\${nuget.packageName}.${version.major}.${version.minor}.0.0.symbols.nupkg" todir="${nuget.symbol.basedir}/source"/>
<copy overwrite="false" todir="${nuget.symbol.basedir}/target">
<fileset basedir="${nuget.symbol.basedir}/source">
<include name="[Content_Types].xml" />
<include name="src/**" />
</fileset>
</copy>
<zip zipfile="${path.dist}\NuGet\${nuget.packageName}.${nuget.version}.symbols.nupkg">
<fileset basedir="${nuget.symbol.basedir}/target">
<include name="**"/>
</fileset>
</zip>
</if>
<if test="${not(nuget.apiKey == '')}">
<exec program="${path.tools.nuget}" workingdir="${path.dist}\NuGet\" commandline="push ${nuget.packageName}.${nuget.version}.nupkg ${nuget.apiKey} -NonInteractive" failonerror="false"/>
</if>
</target>
<target name="CopyDefaultTestInfrastructureAssemblies">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyDefaultTestInfrastructureAssemblies-Target" />
</target>
<target name="CopyDefaultTestInfrastructureAssemblies-Target">
<call target="CopyXUnit-Target"/>
<call target="CopyMoq-Target"/>
<call target="CopyFluentAssertions-Target"/>
<call target="CopyProjectOutput-Target"/>
</target>
<target name="CopyDefaultTestInfrastructureAssemblies-SL">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyDefaultTestInfrastructureAssemblies-SL-Target" />
</target>
<target name="CopyDefaultTestInfrastructureAssemblies-SL-Target">
<call target="CopyXUnit-SL-Target"/>
<call target="CopyMoq-SL-Target"/>
<call target="CopyFluentAssertions-SL-Target"/>
<call target="CopyProjectOutput-Target"/>
</target>
<target name="CopyFluentAssertions">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyFluentAssertions-Target" />
</target>
<target name="CopyFluentAssertions-Target">
<copy todir="${target}" if="${string::contains(build.platform, 'net-4.')}">
<fileset basedir="${path.tools.fluentassertions}/Net-4.0">
<include name="FluentAssertions.dll"/>
</fileset>
</copy>
<copy todir="${target}" unless="${string::contains(build.platform, 'net-4.0')}">
<fileset basedir="${path.tools.fluentassertions}/Net-3.5">
<include name="FluentAssertions.dll"/>
</fileset>
</copy>
</target>
<target name="CopyMoq">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyMoq-Target" />
</target>
<target name="CopyMoq-Target">
<copy todir="${target}" if="${not(string::contains(build.platform, 'net-4.')) and not(string::contains(build.platform, 'mono-4.'))}">
<fileset basedir="${path.tools.moq}/net35">
<include name="Moq.dll"/>
</fileset>
</copy>
<copy todir="${target}" if="${string::contains(build.platform, 'net-4.') or string::contains(build.platform, 'mono-4.')}">
<fileset basedir="${path.tools.moq}/net40">
<include name="Moq.dll"/>
</fileset>
</copy>
</target>
<target name="CopyXUnit">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyXUnit-Target" />
</target>
<target name="CopyXUnit-Target">
<copy todir="${target}">
<fileset basedir="${path.tools.xunit}">
<include name="xunit.dll"/>
<include name="xunit.extensions.dll"/>
</fileset>
</copy>
</target>
<target name="CopyFluentAssertions-SL">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyFluentAssertions-SL-Target" />
</target>
<target name="CopyFluentAssertions-SL-Target">
<copy todir="${target}">
<fileset basedir="${path.tools.fluentassertions}/${build.platform}">
<include name="FluentAssertions.Silverlight.dll"/>
</fileset>
</copy>
</target>
<target name="CopyMoq-SL">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyMoq-SL-Target" />
</target>
<target name="CopyMoq-SL-Target">
<copy todir="${target}" if="${string::contains(build.platform, 'silverlight-4.0') or string::contains(build.platform, 'silverlight-5.0')}">
<fileset basedir="${path.tools.moq}/silverlight4">
<include name="Moq.Silverlight.dll"/>
<include name="Castle.Core.dll"/>
</fileset>
</copy>
<copy todir="${target}" unless="${string::contains(build.platform, 'silverlight-4.0') or string::contains(build.platform, 'silverlight-5.0')}">
<fileset basedir="${path.tools.moq}/silverlight3">
<include name="Moq.Silverlight.dll"/>
<include name="Castle.Core-Silverlight.dll"/>
<include name="Castle.DynamicProxy-Silverlight.dll"/>
</fileset>
</copy>
</target>
<target name="CopyXUnit-SL">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyXUnit-SL-Target" />
</target>
<target name="CopyXUnit-SL-Target">
<copy todir="${target}">
<fileset basedir="${path.tools.xunit.sl}${build.platform}">
<include name="*.dll"/>
</fileset>
</copy>
</target>
<target name="CopyProjectOutput">
<property name="target" value="${current.path.test}" overwrite="true" />
<call target="CopyProjectOutput-Target" />
</target>
<target name="CopyProjectOutput-Target">
<copy todir="${target}" flatten="true" overwrite="true">
<fileset basedir="${current.path.build}">
<include name="**/*.dll"/>
</fileset>
</copy>
</target>
</project>