forked from aspnet/dnx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.shade
1441 lines (1198 loc) · 63 KB
/
makefile.shade
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
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
use assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
use import="Environment"
use import="Regex"
use namespace="System.IO"
use namespace="System.Linq"
use namespace="System.Xml.Linq"
var PRODUCT_VERSION = '1.0.0'
var AUTHORS='Microsoft Open Technologies, Inc.'
use-standard-lifecycle
k-standard-goals
var Configuration2='${E("Configuration")}'
var ROOT = '${Directory.GetCurrentDirectory()}'
var SCRIPTS_DIR = '${Path.Combine(ROOT, "scripts")}'
var ARTIFACTS_DIR = '${Path.Combine(ROOT, "artifacts")}'
var BUILD_DIR2 = '${Path.Combine(ROOT, "artifacts", "build")}'
var NUSPEC_ROOT = '${Path.Combine(ROOT, "nuspec")}'
var TEST_RESULTS = '${Path.Combine(ROOT, "artifacts", "TestResults")}'
var SAMPLES_DIR = '${Path.Combine(ROOT, "samples")}'
var FULL_VERSION = '${PRODUCT_VERSION + "-" + E("DNX_BUILD_VERSION")}'
var CORECLR_TARGET_PATH = '${Path.Combine(BUILD_DIR2, "DnxCoreCLR")}'
var RUNTIME_NAME_PREFIX = 'dnx-'
- // Runtime names
var RUNTIME_MONO_NAME = '${RUNTIME_NAME_PREFIX + "mono"}'
var RUNTIME_CLR_WIN_x86_NAME = '${RUNTIME_NAME_PREFIX + "clr-win-x86"}'
var RUNTIME_CLR_WIN_x64_NAME = '${RUNTIME_NAME_PREFIX + "clr-win-x64"}'
var RUNTIME_CORECLR_WIN_x86_NAME = '${RUNTIME_NAME_PREFIX + "coreclr-win-x86"}'
var RUNTIME_CORECLR_WIN_x64_NAME = '${RUNTIME_NAME_PREFIX + "coreclr-win-x64"}'
var RUNTIME_CORECLR_WIN_arm_NAME = '${RUNTIME_NAME_PREFIX + "coreclr-win-arm"}'
var RUNTIME_CORECLR_DARWIN_x64_NAME = '${RUNTIME_NAME_PREFIX + "coreclr-darwin-x64"}'
var RUNTIME_CORECLR_LINUX_x64_NAME = '${RUNTIME_NAME_PREFIX + "coreclr-linux-x64"}'
- // Runtime paths
var RUNTIME_MONO_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_MONO_NAME, "bin")}'
var RUNTIME_CLR_WIN_x86_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CLR_WIN_x86_NAME, "bin")}'
var RUNTIME_CLR_WIN_x64_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CLR_WIN_x64_NAME, "bin")}'
var RUNTIME_CORECLR_WIN_x86_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CORECLR_WIN_x86_NAME, "bin")}'
var RUNTIME_CORECLR_WIN_x64_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CORECLR_WIN_x64_NAME, "bin")}'
var RUNTIME_CORECLR_WIN_arm_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CORECLR_WIN_arm_NAME, "bin")}'
var RUNTIME_CORECLR_DARWIN_x64_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CORECLR_DARWIN_x64_NAME, "bin")}'
var RUNTIME_CORECLR_LINUX_x64_BIN = '${Path.Combine(BUILD_DIR2, RUNTIME_CORECLR_LINUX_x64_NAME, "bin")}'
var RUNTIME_CLR_TARGETS = '${new [] {RUNTIME_MONO_BIN, RUNTIME_CLR_WIN_x86_BIN, RUNTIME_CLR_WIN_x64_BIN}}'
var RUNTIME_CORECLR_TARGETS = '${new [] {RUNTIME_CORECLR_WIN_x86_BIN, RUNTIME_CORECLR_WIN_x64_BIN, RUNTIME_CORECLR_WIN_arm_BIN, RUNTIME_CORECLR_DARWIN_x64_BIN, RUNTIME_CORECLR_LINUX_x64_BIN }}'
var ALL_TARGETS = '${RUNTIME_CLR_TARGETS.Concat(RUNTIME_CORECLR_TARGETS)}'
var BOOTSTRAPPER_FOLDER_NAME = 'dnx'
var BOOTSTRAPPER_EXE_NAME = 'dnx'
var BOOTSTRAPPER_WINDOWS_FOLDER_NAME="dnx.windows"
var BOOTSTRAPPER_CLR_NAME = 'dnx.clr'
var BOOTSTRAPPER_CORECLR_NAME = 'dnx.coreclr'
var BOOTSTRAPPER_CLR_MANAGED_NAME = 'Microsoft.Dnx.Host.Clr'
var BOOTSTRAPPER_CORECLR_MANAGED_NAME = 'Microsoft.Dnx.Host.CoreClr'
var BOOTSTRAPPER_MONO_MANAGED_NAME = 'Microsoft.Dnx.Host.Mono'
var BOOTSTRAPPER_HOST_NAME = 'Microsoft.Dnx.Host'
var BOOTSTRAPPER_COMMON_FOLDER_NAME = 'dnx.common'
var PROGRAM_FILES_X86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
var MSBUILD = '${Path.Combine(PROGRAM_FILES_X86, "MSBuild", "14.0", "Bin", "MSBuild.exe")}'
var VS_REDIST_ROOT = '${Path.Combine(PROGRAM_FILES_X86, @"Microsoft Visual Studio 14.0\VC\redist")}'
var WIN10_SDK_LIB = '${Path.Combine(PROGRAM_FILES_X86, @"Windows Kits\10\Lib")}'
var VS_ONECORE_ROOT = '${Path.Combine(PROGRAM_FILES_X86, @"Microsoft Visual Studio 14.0\VC\lib\onecore")}'
var CLANG = '${SearchForClang()}'
var MANAGED_PROJECTS = '${FindAllProjects(
BOOTSTRAPPER_HOST_NAME,
BOOTSTRAPPER_CORECLR_MANAGED_NAME,
"Microsoft.Dnx.ApplicationHost",
"Microsoft.Dnx.Compilation",
"Microsoft.Dnx.Compilation.Abstractions",
"Microsoft.Dnx.Compilation.CSharp",
"Microsoft.Dnx.Compilation.CSharp.Abstractions",
"Microsoft.Dnx.Compilation.CSharp.Common",
"Microsoft.Dnx.Compilation.DesignTime",
"Microsoft.Dnx.DesignTimeHost",
"Microsoft.Dnx.DesignTimeHost.Abstractions",
"Microsoft.Dnx.Loader",
"Microsoft.Dnx.Runtime",
"Microsoft.Dnx.Runtime.Abstractions",
"Microsoft.Dnx.Runtime.CommandParsing.Sources",
"Microsoft.Dnx.Runtime.Json.Sources",
"Microsoft.Dnx.Runtime.Sources",
"Microsoft.Dnx.Project",
"Microsoft.Dnx.Tooling",
"Microsoft.Framework.CommandLineUtils.Sources")}'
var WIN_MANAGED_PROJECTS = '${FindAllProjects(
BOOTSTRAPPER_CLR_MANAGED_NAME)}'
var RUNTIME_TARGETS='${new List<RuntimeTarget>()}'
var CAN_BUILD_ONECORE = '${Directory.Exists(VS_ONECORE_ROOT) && Directory.GetFiles(VS_ONECORE_ROOT, "vcruntime.lib", SearchOption.AllDirectories).Any() && Directory.Exists(WIN10_SDK_LIB) && Directory.GetFiles(WIN10_SDK_LIB, "onecore.lib", SearchOption.AllDirectories).Any()}'
@{
// Always build mono
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_MONO_NAME, TargetFolder = RUNTIME_MONO_BIN, Framework = "dnx451", Arch = "any", OS = "any", Flavor = "mono" });
if (CanBuildForWindows)
{
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CLR_WIN_x86_NAME, TargetFolder = RUNTIME_CLR_WIN_x86_BIN, Framework = "dnx451", Arch = "x86", OS = "win", Flavor = "clr" });
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CLR_WIN_x64_NAME, TargetFolder = RUNTIME_CLR_WIN_x64_BIN, Framework = "dnx451", Arch = "x64", OS = "win", Flavor = "clr" });
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CORECLR_WIN_x86_NAME, TargetFolder = RUNTIME_CORECLR_WIN_x86_BIN, Framework = "dnxcore50", Arch = "x86", OS = "win", Flavor = "coreclr" });
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CORECLR_WIN_x64_NAME, TargetFolder = RUNTIME_CORECLR_WIN_x64_BIN, Framework = "dnxcore50", Arch = "x64", OS = "win", Flavor = "coreclr" });
if (CAN_BUILD_ONECORE)
{
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CORECLR_WIN_arm_NAME, TargetFolder = RUNTIME_CORECLR_WIN_arm_BIN, Framework = "dnxcore50", Arch = "arm", OS = "win", Flavor = "coreclr" });
}
}
if (CanBuildForLinux)
{
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CORECLR_LINUX_x64_NAME, TargetFolder = RUNTIME_CORECLR_LINUX_x64_BIN, Framework = "dnxcore50", Arch = "x64", OS = "linux", Flavor = "coreclr" });
}
if (CanBuildForDarwin)
{
RUNTIME_TARGETS.Add(new RuntimeTarget { Name = RUNTIME_CORECLR_DARWIN_x64_NAME, TargetFolder = RUNTIME_CORECLR_DARWIN_x64_BIN, Framework = "dnxcore50", Arch = "x64", OS = "darwin", Flavor = "coreclr" });
}
}
-// Replace repo-initialize with a less greedy restore
#repo-initialize target='initialize'
git gitCommand="submodule update --init"
@{
DoRestore();
}
- // k-standard-goal overrides
#native-compile
#build-compile target='compile'
#package-runtime .clean-sdk-dir target='package'
#xunit-test
-// Specific to building the dnx
#build-common target='build-compile'
#package-common target='package-runtime'
-// Define platform specific builds as a n00p if the current platform can't produce a build
#build-darwin target='build-compile' if='CanBuildForDarwin'
#build-darwin if='!CanBuildForDarwin'
#package-darwin target='package-runtime' if='CanBuildForDarwin'
#package-darwin if='CanBuildForDarwin'
#build-linux target='build-compile' if='CanBuildForLinux'
#build-linux if='!CanBuildForLinux'
#package-linux target='package-runtime' if='CanBuildForLinux'
#package-linux if='CanBuildForLinux'
#build-windows target='build-compile' if='CanBuildForWindows'
#build-windows if='!CanBuildForWindows'
#package-windows target='package-runtime' if='CanBuildForWindows'
#package-windows if='!CanBuildForWindows'
- // ===================== BUILD =====================
- // ===================== COMMON =====================
#build-managed-projects target='build-common'
@{
var BUILD_DIR = BUILD_DIR2;
if (IsBuildV2)
{
DnuPack("src/**", BUILD_DIR, Configuration2);
}
else
{
foreach(var projectFile in MANAGED_PROJECTS)
{
DnuPack(projectFile, BUILD_DIR, Configuration2);
}
}
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/*.nupkg")))
{
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
}
}
-// This target's build-common since mono is built on all platforms
#build-dnx-mono-bootstrapper target='build-common'
var monoManagedOutpath='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_MONO_MANAGED_NAME)}'
directory create='${monoManagedOutpath}'
@{
var bootstrapperAssembly = Path.Combine(BUILD_DIR2, BOOTSTRAPPER_HOST_NAME, "dnx451", BOOTSTRAPPER_HOST_NAME + ".dll");
var sourceFiles = new string[]
{
Path.Combine("src", BOOTSTRAPPER_MONO_MANAGED_NAME, "EntryPoint.cs"),
Path.Combine("src", "Microsoft.Framework.CommandLineUtils.Sources", "CommandLine", "CommandArgument.cs"),
Path.Combine("src", "Microsoft.Framework.CommandLineUtils.Sources", "CommandLine", "CommandLineApplication.cs"),
Path.Combine("src", "Microsoft.Framework.CommandLineUtils.Sources", "CommandLine", "CommandOption.cs"),
Path.Combine("src", "Microsoft.Framework.CommandLineUtils.Sources", "CommandLine", "CommandOptionType.cs"),
Path.Combine("src", "Microsoft.Dnx.Runtime.Sources", "Impl", "EnvironmentNames.cs"),
Path.Combine("src", "Microsoft.Dnx.Runtime.Sources", "Impl", "Constants.cs")
};
var arguments = string.Format(
@"/target:exe /nologo /unsafe /out:""{0}"" /r:""{1}"" /define:DNX451 {2}",
Path.Combine(monoManagedOutpath, BOOTSTRAPPER_MONO_MANAGED_NAME + ".dll"),
bootstrapperAssembly,
string.Join(" ", sourceFiles));
var compiler = IsMono ? "mcs" : Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "Microsoft.NET", "Framework", "v4.0.30319", "csc.exe");
Exec(compiler, arguments);
}
#clean-sdk-dir
directory each='var delete in ALL_TARGETS.Select(t => Path.GetDirectoryName(t))'
directory each='var create in RUNTIME_TARGETS.Select(t => t.TargetFolder)'
- // ===================== WINDOWS =====================
#build-win-managed-projects target='build-windows'
@{ var BUILD_DIR = BUILD_DIR2; }
kpm-pack each='var projectFile in WIN_MANAGED_PROJECTS' configuration='${Configuration2}' kpmPackOutputDir='${BUILD_DIR}'
@{
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/*.nupkg")))
{
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
}
}
#build-dnx-win-exe .ensure-msbuild target='build-windows'
var bootstrapperProj = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_WINDOWS_FOLDER_NAME, "dnx.windows.vcxproj")}'
@{
var commonParameters =
" /p:Configuration=" + Configuration2 +
" /p:ProductVersion=" + PRODUCT_VERSION +
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
var environmentRuntimeTargetOS = Environment.GetEnvironmentVariable("RUNTIME_TARGET_OS");
var configRuntimeTargetOS = "";
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=Win32;TargetFramework=dnx451;RuntimeType=CLR");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=x64;TargetFramework=dnx451;RuntimeType=CLR");
if (environmentRuntimeTargetOS == "WIN7_PLUS_CORESYSTEM")
{
configRuntimeTargetOS = ";RuntimeTargetOS=WIN7_PLUS_CORESYSTEM";
}
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=Win32;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN" + configRuntimeTargetOS);
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=x64;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN" + configRuntimeTargetOS);
}
directory delete='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_WINDOWS_FOLDER_NAME)}'
copy sourceDir='${Path.Combine(ROOT, "src", BOOTSTRAPPER_WINDOWS_FOLDER_NAME)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_WINDOWS_FOLDER_NAME)}' overwrite='${true}'
#build-dnx-win-dll .ensure-msbuild target='build-windows'
var bootstrapperProj = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_FOLDER_NAME, "dnx.vcxproj")}'
@{
var commonParameters =
" /p:Configuration=" + Configuration2 +
" /p:ProductVersion=" + PRODUCT_VERSION +
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=Win32;TargetFramework=dnx451;RuntimeType=CLR;BuildForOneCore=False");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=x64;TargetFramework=dnx451;RuntimeType=CLR;BuildForOneCore=False");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=Win32;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN;BuildForOneCore=False");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=x64;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN;BuildForOneCore=False");
if (CAN_BUILD_ONECORE)
{
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=Win32;TargetFramework=dnx451;RuntimeType=CLR;BuildForOneCore=True");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=x64;TargetFramework=dnx451;RuntimeType=CLR;BuildForOneCore=True");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=Win32;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN;BuildForOneCore=True");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=x64;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN;BuildForOneCore=True");
Exec(MSBUILD, bootstrapperProj + commonParameters + ";Platform=ARM;TargetFramework=dnxcore50;RuntimeType=CORECLR_WIN");
}
else
{
Log.Warn("Windows 10 SDK not installed. Building for One Core skipped.");
}
}
directory delete='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME)}'
copy sourceDir='${Path.Combine(ROOT, "src", BOOTSTRAPPER_FOLDER_NAME)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME)}' overwrite='${true}'
#build-dnx-coreclr-win-bootstrapper .ensure-msbuild .update-tpa target='build-windows'
var bootstrapperCoreClrProj = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_CORECLR_NAME, BOOTSTRAPPER_CORECLR_NAME + ".vcxproj")}'
@{
var commonParameters =
" /p:Configuration=" + Configuration2 +
" /p:ProductVersion=" + PRODUCT_VERSION +
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
Exec(MSBUILD, bootstrapperCoreClrProj + commonParameters + ";Platform=Win32;BuildForOneCore=False");
Exec(MSBUILD, bootstrapperCoreClrProj + commonParameters + ";Platform=x64;BuildForOneCore=False");
if (CAN_BUILD_ONECORE)
{
Exec(MSBUILD, bootstrapperCoreClrProj + commonParameters + ";Platform=Win32;BuildForOneCore=True");
Exec(MSBUILD, bootstrapperCoreClrProj + commonParameters + ";Platform=x64;BuildForOneCore=True");
Exec(MSBUILD, bootstrapperCoreClrProj + commonParameters + ";Platform=ARM");
}
else
{
Log.Warn("Windows 10 SDK not installed. Building for One Core skipped.");
}
}
directory delete='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME)}'
copy sourceDir='${Path.Combine(ROOT, "src", BOOTSTRAPPER_CORECLR_NAME)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME)}' overwrite='${true}'
#build-dnx-clr-win-bootstrapper .ensure-msbuild target='build-windows'
var bootstrapperClrProj ='${Path.Combine(ROOT, "src", BOOTSTRAPPER_CLR_NAME, BOOTSTRAPPER_CLR_NAME + ".vcxproj")}'
@{
var commonParameters =
" /p:Configuration=" + Configuration2 +
" /p:ProductVersion=" + PRODUCT_VERSION +
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
Exec(MSBUILD, bootstrapperClrProj + commonParameters + ";Platform=Win32");
Exec(MSBUILD, bootstrapperClrProj + commonParameters + ";Platform=x64");
}
directory delete='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CLR_NAME)}'
copy sourceDir='${Path.Combine(ROOT, "src", BOOTSTRAPPER_CLR_NAME)}' include='bin/**/' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CLR_NAME)}' overwrite='${true}'
- // ===================== LINUX =====================
#build-dnx-coreclr-linux-bootstrapper .ensure-clang .update-tpa target='build-linux'
var soOutputDir = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_CORECLR_NAME + ".unix", "bin")}'
var soOutputPath = '${Path.Combine(soOutputDir, BOOTSTRAPPER_CORECLR_NAME + ".so")}'
@{
var sourceFiles = new string[]
{
Path.Combine("src", BOOTSTRAPPER_COMMON_FOLDER_NAME, "tpa.cpp"),
Path.Combine("src", BOOTSTRAPPER_CORECLR_NAME + ".unix", BOOTSTRAPPER_CORECLR_NAME + ".cpp")
};
Directory.CreateDirectory(soOutputDir);
Exec(CLANG, string.Format("-fPIC -shared {0} -g -o {1} -DPLATFORM_LINUX --std=c++11 -ldl -Isrc/{2}/include", string.Join(" ", sourceFiles), soOutputPath, BOOTSTRAPPER_COMMON_FOLDER_NAME));
}
copy sourceDir='${soOutputDir}' include='*.so' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME + ".unix")}' overwrite='${true}'
#build-dnx-linux-bootstrapper .ensure-clang target='build-linux'
var soOutputDir = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_FOLDER_NAME, "bin", "x64")}'
var soOutputPath = '${Path.Combine(soOutputDir, BOOTSTRAPPER_EXE_NAME)}'
@{
var sourceFiles = new string[]
{
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, "main.cpp"),
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, BOOTSTRAPPER_EXE_NAME + ".cpp"),
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, "pal.unix.cpp"),
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, "pal.linux.cpp"),
Path.Combine("src", BOOTSTRAPPER_COMMON_FOLDER_NAME, "utils.cpp"),
};
Directory.CreateDirectory(soOutputDir);
Exec(CLANG, string.Format("{0} -g -o {1} -DCORECLR_LINUX -DPLATFORM_UNIX -std=c++11 -ldl -Isrc/{2}/include", string.Join(" ", sourceFiles), soOutputPath, BOOTSTRAPPER_COMMON_FOLDER_NAME));
}
copy sourceDir='${soOutputDir}' include='*' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "linux", "x64")}' overwrite='${true}'
- // ===================== DARWIN (OSX) =====================
#build-dnx-coreclr-darwin-bootstrapper .ensure-clang .update-tpa target='build-darwin'
var soOutputDir = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_CORECLR_NAME + ".unix", "bin")}'
var soOutputPath = '${Path.Combine(soOutputDir, BOOTSTRAPPER_CORECLR_NAME + ".dylib")}'
@{
var sourceFiles = new string[]
{
Path.Combine("src", BOOTSTRAPPER_COMMON_FOLDER_NAME, "tpa.cpp"),
Path.Combine("src", BOOTSTRAPPER_CORECLR_NAME + ".unix", BOOTSTRAPPER_CORECLR_NAME + ".cpp")
};
Directory.CreateDirectory(soOutputDir);
Exec(CLANG, string.Format("-fPIC -shared {0} -g -o {1} -DPLATFORM_DARWIN --std=c++11 -ldl -Isrc/{2}/include", string.Join(" ", sourceFiles), soOutputPath, BOOTSTRAPPER_COMMON_FOLDER_NAME));
}
copy sourceDir='${soOutputDir}' include='*.dylib' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME + ".unix")}' overwrite='${true}'
#build-dnx-darwin-bootstrapper .ensure-clang target='build-darwin'
var soOutputDir = '${Path.Combine(ROOT, "src", BOOTSTRAPPER_FOLDER_NAME, "bin", "x64")}'
var soOutputPath = '${Path.Combine(soOutputDir, BOOTSTRAPPER_EXE_NAME)}'
@{
var sourceFiles = new string[]
{
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, "main.cpp"),
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, BOOTSTRAPPER_EXE_NAME + ".cpp"),
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, "pal.unix.cpp"),
Path.Combine("src", BOOTSTRAPPER_FOLDER_NAME, "pal.darwin.cpp"),
Path.Combine("src", BOOTSTRAPPER_COMMON_FOLDER_NAME, "utils.cpp"),
};
Directory.CreateDirectory(soOutputDir);
Exec(CLANG, string.Format("{0} -g -o {1} -DCORECLR_DARWIN -DPLATFORM_UNIX -std=c++11 -ldl -Isrc/{2}/include", string.Join(" ", sourceFiles), soOutputPath, BOOTSTRAPPER_COMMON_FOLDER_NAME));
}
copy sourceDir='${soOutputDir}' include='*' outputDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "darwin", "x64")}' overwrite='${true}'
- // ===================== PACKAGE =====================
#copy-coreclr
@{
var extras = "-pre";
var coreCLRPackageSource = E("CORECLR_PACKAGE_SOURCE");
if (!string.IsNullOrEmpty(coreCLRPackageSource))
{
extras += " -source " + coreCLRPackageSource;
}
if (IsTeamCity)
{
extras += " -nocache";
}
var downloadComplete = false;
// Travis ci has a timelimit for no activity and the CoreCLR pacakge is
// about 51MB. We're going to print to the console while this is happening
// so the build doesn't timeout
if (IsTravis)
{
new System.Threading.Thread(() =>
{
while (!downloadComplete)
{
Console.Write(".");
System.Threading.Thread.Sleep(1000);
}
Console.WriteLine();
})
{
IsBackground = true
}
.Start();
}
}
nuget-install package='DnxCoreCLR' outputDir='packages' extra='${extras}' once='DnxCoreCLR' nugetPath='.nuget/nuget.exe' if='!Directory.Exists(CORECLR_TARGET_PATH)'
var CoreCLR_DIR='${""}'
@{
downloadComplete = true;
Func<string, long> getVersion = version => {
var dash = version.LastIndexOf('-');
var parsedVersion = Int64.MaxValue;
if(dash != -1)
{
var lastToken = version.Substring(dash + 1);
var flag = false;
if(lastToken.StartsWith("t"))
{
flag = Int64.TryParse(lastToken.Substring(1), out parsedVersion);
}
else
{
flag = Int64.TryParse(lastToken, out parsedVersion);
}
if(!flag)
{
Log.Info(string.Format("Version does not have build number: {0}", version));
parsedVersion = Int64.MaxValue;
}
}
return parsedVersion;
};
string packagesDir = Path.Combine(Directory.GetCurrentDirectory(), "packages");
CoreCLR_DIR = Directory.EnumerateDirectories(packagesDir, "DnxCoreCLR*")
.OrderByDescending(getVersion)
.First();
Log.Info("Using " + CoreCLR_DIR);
}
-// Copy to target
copy sourceDir='${Path.Combine(CoreCLR_DIR, "Runtime")}' outputDir='${Path.Combine(CORECLR_TARGET_PATH, "Runtime")}' overwrite='${true}' if='!Directory.Exists(CORECLR_TARGET_PATH)'
#copy-required-dependencies
@{
var runtimeProjects = new[]
{
"Microsoft.Dnx.ApplicationHost",
"Microsoft.Dnx.Compilation.CSharp",
"Microsoft.Dnx.Compilation.DesignTime",
BOOTSTRAPPER_HOST_NAME,
BOOTSTRAPPER_CORECLR_MANAGED_NAME
};
var sdkProjects = new[]
{
"Microsoft.Dnx.DesignTimeHost",
"Microsoft.Dnx.Project",
"Microsoft.Dnx.Tooling"
};
foreach (var target in RUNTIME_TARGETS)
{
var coreclrFolder = target.Flavor == "coreclr" ? Path.Combine(CORECLR_TARGET_PATH, "Runtime", target.OS, target.Arch) : null;
// Parse and copy runtime assemblies
var runtimeAssemblies = new HashSet<string>();
foreach (var project in runtimeProjects)
{
if (project == BOOTSTRAPPER_CORECLR_MANAGED_NAME && target.Flavor != "coreclr")
{
continue;
}
var projectFolder = Path.Combine(ROOT, "src", project);
var projectAssemblies = ListDependencyAssemblies(projectFolder, target.Framework, coreclrFolder);
try
{
foreach (var file in projectAssemblies)
{
if (runtimeAssemblies.Add(file))
{
var targetFilePath = Path.Combine(target.TargetFolder, Path.GetFileName(file));
Log.Info("Copying " + file + " to " + targetFilePath);
File.Copy(file, targetFilePath, true);
}
}
}
catch (Exception ex)
{
throw new InvalidOperationException(string.Format("Fail to copy runtime assemblies [{0}]", ex.Message));
}
}
// Parse and copy lib assemblies
foreach (var project in sdkProjects)
{
var projectFolder = Path.Combine(ROOT, "src", project);
var projectAssemblies = ListDependencyAssemblies(projectFolder, target.Framework, coreclrFolder);
projectAssemblies.ExceptWith(runtimeAssemblies);
var targetLibDir = Path.Combine(target.TargetFolder, "lib", project);
Directory.CreateDirectory(targetLibDir);
foreach (var file in projectAssemblies)
{
var targetFilePath = Path.Combine(targetLibDir, Path.GetFileName(file));
Log.Info("Copying " + file + " to " + targetFilePath);
File.Copy(file, targetFilePath, true);
}
}
// Copy required CoreCLR assemblies
if (target.Flavor == "coreclr")
{
var extraBinaries = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var nativeExtension = target.OS == "linux" ? ".so" : ".dylib";
if (target.OS != "win")
{
// For now, we ship cross platform specific binaries as part of DNX for Linux and Darwin, since
// the versions in NuGet are Windows specific.
extraBinaries.Add("Microsoft.Win32.Primitives.dll");
extraBinaries.Add("System.Console.dll");
extraBinaries.Add("System.Data.SqlClient.dll");
extraBinaries.Add("System.Diagnostics.Debug.dll");
extraBinaries.Add("System.Diagnostics.FileVersionInfo.dll");
extraBinaries.Add("System.Diagnostics.Process.dll");
extraBinaries.Add("System.Diagnostics.TraceSource.dll");
extraBinaries.Add("System.Globalization.Extensions.dll");
extraBinaries.Add("System.IO.Compression.dll");
extraBinaries.Add("System.IO.FileSystem.dll");
extraBinaries.Add("System.IO.FileSystem.DriveInfo.dll");
extraBinaries.Add("System.IO.FileSystem.Watcher.dll");
extraBinaries.Add("System.IO.MemoryMappedFiles.dll");
extraBinaries.Add("System.IO.Pipes.dll");
extraBinaries.Add("System.Net.Security.dll");
extraBinaries.Add("System.Runtime.Extensions.dll");
extraBinaries.Add("System.Security.Cryptography.Encoding.dll");
extraBinaries.Add("System.Security.Cryptography.Primitives.dll");
extraBinaries.Add("System.Security.Cryptography.Algorithms.dll");
extraBinaries.Add("System.Security.SecureString.dll");
extraBinaries.Add("System.Text.Encoding.CodePages.dll");
extraBinaries.Add("System.Threading.dll");
}
foreach (var file in Directory.GetFiles(coreclrFolder).Where(f => extraBinaries.Contains(Path.GetFileName(f)) || !Path.GetFileName(f).StartsWith("System")
|| (Path.GetFileName(f).StartsWith("System") && Path.GetFileName(f).EndsWith(nativeExtension))))
{
var targetFilePath = Path.Combine(target.TargetFolder, Path.GetFileName(file));
Log.Info("Copying " + file + " to " + targetFilePath);
File.Copy(file, targetFilePath, true);
}
// Copy the managed resources the runtime needs for Linux
if (target.OS == "linux")
{
foreach (var file in Files.BasePath(coreclrFolder).Include("**/*.mo"))
{
var sourceFile = Path.Combine(coreclrFolder, file);
var outputFile = Path.Combine(target.TargetFolder, file);
if (!Directory.Exists(Path.GetDirectoryName(outputFile)))
{
Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
}
Log.Info("Copying " + sourceFile + " to " + outputFile);
File.Copy(sourceFile, outputFile, true);
}
}
}
}
}
#copy-common .copy-coreclr .copy-required-dependencies target='package-common'
copy sourceDir='${SCRIPTS_DIR}' include='*.sh' outputDir='${RUNTIME_MONO_BIN}' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_MONO_MANAGED_NAME)}' outputDir='${RUNTIME_MONO_BIN}' include='*.dll' overwrite='${true}'
@{
FixShFiles(RUNTIME_MONO_BIN);
}
-// Copy built projects to the appropriate locations
@{
var dnxCore50Pattern = Path.Combine(BUILD_DIR2, "*", "dnxcore50", "**.*");
var dnx451Pattern = Path.Combine(BUILD_DIR2, "*", "dnx451", "**.*");
var libPackages = new[] { "Microsoft.Dnx.Project",
"Microsoft.Dnx.DesignTimeHost",
"Microsoft.Dnx.Tooling" };
var sharedSourceAssemblies = new [] {
Path.Combine(BUILD_DIR2, "Microsoft.Dnx.Runtime.Sources/**/*.*"),
Path.Combine(BUILD_DIR2, "Microsoft.Dnx.Runtime.CommandParsing.Sources/**/*.*"),
Path.Combine(BUILD_DIR2, "Microsoft.Dnx.Runtime.Json.Sources/**/*.*"),
Path.Combine(BUILD_DIR2, "Microsoft.Framework.CommandLineUtils.Sources/**/*.*"),
};
foreach (var file in Files.Include(dnxCore50Pattern).Exclude(sharedSourceAssemblies))
{
foreach (var runtimeTarget in RUNTIME_TARGETS.Where(t => t.Flavor == "coreclr"))
{
string dest = Path.Combine(runtimeTarget.TargetFolder, Path.GetFileName(file));
File.Copy(file, dest, true);
}
}
foreach (var file in Files.Include(dnx451Pattern).Exclude(sharedSourceAssemblies))
{
foreach (var runtimeTarget in RUNTIME_TARGETS.Where(t => t.Flavor != "coreclr"))
{
string dest = Path.Combine(runtimeTarget.TargetFolder, Path.GetFileName(file));
File.Copy(file, dest, true);
}
}
// Clean up net45.managed from mono (it's never used)
File.Delete(Path.Combine(RUNTIME_MONO_BIN, BOOTSTRAPPER_CLR_MANAGED_NAME + ".dll"));
Action<string, string, string> move = (binFolder, name, extension) =>
{
var libPath = Path.Combine(binFolder, "lib", name);
var source = Path.Combine(binFolder, name + extension);
var target = Path.Combine(libPath, name + extension);
if (File.Exists(source))
{
if (File.Exists(target))
{
File.Delete(target);
}
Directory.CreateDirectory(libPath);
File.Move(source, target);
Log.Info("Moving " + name + " to " + target);
}
else
{
Log.Warn(source + " does not exist in " + binFolder);
}
};
// Move some packages into the lib/ folder
foreach (var libPackage in libPackages)
{
foreach (var runtimeTarget in RUNTIME_TARGETS)
{
move(runtimeTarget.TargetFolder, libPackage, ".dll");
if (!IsMono)
{
move(runtimeTarget.TargetFolder, libPackage, ".pdb");
}
}
}
}
#copy-windows-bits .ensure-vs-redist target='package-windows'
-// Runtime for clr-win-x86
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "Win32", Configuration2, "dnx451")}' outputDir='${RUNTIME_CLR_WIN_x86_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_WINDOWS_FOLDER_NAME, "bin", "Win32", Configuration2, "dnx451")}' outputDir='${RUNTIME_CLR_WIN_x86_BIN}' include='*.exe' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CLR_NAME, "bin", "Win32", Configuration2)}' outputDir='${RUNTIME_CLR_WIN_x86_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CLR_NAME, "bin", "Win32", Configuration2)}' outputDir='${RUNTIME_CLR_WIN_x86_BIN}' include='*.pdb' overwrite='${true}'
copy sourceDir='${Path.Combine(ROOT, "src", BOOTSTRAPPER_CLR_MANAGED_NAME)}' outputDir='${RUNTIME_CLR_WIN_x86_BIN}' include='*.config' overwrite='${true}'
-// Runtime for clr-win-x64
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "x64", Configuration2, "dnx451")}' outputDir='${RUNTIME_CLR_WIN_x64_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_WINDOWS_FOLDER_NAME, "bin", "x64", Configuration2, "dnx451")}' outputDir='${RUNTIME_CLR_WIN_x64_BIN}' include='*.exe' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CLR_NAME, "bin", "x64", Configuration2)}' outputDir='${RUNTIME_CLR_WIN_x64_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CLR_NAME, "bin", "x64", Configuration2)}' outputDir='${RUNTIME_CLR_WIN_x64_BIN}' include='*.pdb' overwrite='${true}'
copy sourceDir='${Path.Combine(ROOT, "src", BOOTSTRAPPER_CLR_MANAGED_NAME)}' outputDir='${RUNTIME_CLR_WIN_x64_BIN}' include='*.config' overwrite='${true}'
-// Runtime for coreclr-win-x86
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "Win32", Configuration2, "dnxcore50")}' outputDir='${RUNTIME_CORECLR_WIN_x86_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_WINDOWS_FOLDER_NAME, "bin", "Win32", Configuration2, "dnxcore50")}' outputDir='${RUNTIME_CORECLR_WIN_x86_BIN}' include='*.exe' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME, "bin", "Win32", Configuration2)}' outputDir='${RUNTIME_CORECLR_WIN_x86_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME, "bin", "Win32", Configuration2)}' outputDir='${RUNTIME_CORECLR_WIN_x86_BIN}' include='*.pdb' overwrite='${true}'
-// Since we can't build debug versions of some native binaries for CoreClr/OneCore we only copy ret version of vcruntime dll
copy sourceDir='${Path.Combine(VS_REDIST_ROOT, @"onecore\x86\Microsoft.VC140.CRT")}' outputDir='${RUNTIME_CLR_WIN_x86_BIN}' include='vcruntime140.dll' overwrite='${true}' if='Configuration2 == "Release"'
-// Runtime for coreclr-win-x64
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "x64", Configuration2, "dnxcore50")}' outputDir='${RUNTIME_CORECLR_WIN_x64_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_WINDOWS_FOLDER_NAME, "bin", "x64", Configuration2, "dnxcore50")}' outputDir='${RUNTIME_CORECLR_WIN_x64_BIN}' include='*.exe' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME, "bin", "x64", Configuration2)}' outputDir='${RUNTIME_CORECLR_WIN_x64_BIN}' include='*.dll' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME, "bin", "x64", Configuration2)}' outputDir='${RUNTIME_CORECLR_WIN_x64_BIN}' include='*.pdb' overwrite='${true}'
-// Since we can't build debug versions of some native binaries for CoreClr/OneCore we only copy ret version of vcruntime dll
copy sourceDir='${Path.Combine(VS_REDIST_ROOT, @"onecore\x64\Microsoft.VC140.CRT")}' outputDir='${RUNTIME_CORECLR_WIN_x64_BIN}' include='vcruntime140.dll' overwrite='${true}' if='Configuration2 == "Release"'
-// Runtime for coreclr-win-arm
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "ARM", Configuration2, "dnxcore50")}' outputDir='${RUNTIME_CORECLR_WIN_arm_BIN}' include='*.exe' overwrite='${true}' if='CAN_BUILD_ONECORE'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "ARM", Configuration2, "dnxcore50")}' outputDir='${RUNTIME_CORECLR_WIN_arm_BIN}' include='*.pdb' overwrite='${true}' if='CAN_BUILD_ONECORE'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME, "bin", "ARM", Configuration2)}' outputDir='${RUNTIME_CORECLR_WIN_arm_BIN}' include='*.dll' overwrite='${true}' if='CAN_BUILD_ONECORE'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME, "bin", "ARM", Configuration2)}' outputDir='${RUNTIME_CORECLR_WIN_arm_BIN}' include='*.pdb' overwrite='${true}' if='CAN_BUILD_ONECORE'
-// Copy cmd files
copy sourceDir='${SCRIPTS_DIR}' include='*.cmd' exclude='dnx-crossgen.cmd' overwrite='${true}' each='var outputDir in new[]{ RUNTIME_CLR_WIN_x86_BIN, RUNTIME_CLR_WIN_x64_BIN}'
copy sourceDir='${SCRIPTS_DIR}' include='*.cmd' overwrite='${true}' each='var outputDir in new[]{ RUNTIME_CORECLR_WIN_x86_BIN, RUNTIME_CORECLR_WIN_x64_BIN }'
copy sourceDir='${SCRIPTS_DIR}' include='*.cmd' overwrite='${true}' each='var outputDir in new[]{ RUNTIME_CORECLR_WIN_arm_BIN }' if='CAN_BUILD_ONECORE'
#copy-linux-bits target='package-linux'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME + ".unix")}' include='*.so' outputDir='${RUNTIME_CORECLR_LINUX_x64_BIN}' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "linux", "x64")}' include='dnx' outputDir='${RUNTIME_CORECLR_LINUX_x64_BIN}' overwrite='${true}'
copy sourceDir='${SCRIPTS_DIR}' include='dnu.sh' outputDir='${RUNTIME_CORECLR_LINUX_x64_BIN}' overwrite='${true}'
@{
FixShFiles(RUNTIME_CORECLR_LINUX_x64_BIN);
}
var CI_LINUX_DROP_PATH = '${Environment.GetEnvironmentVariable("CI_LINUX_DROP_PATH")}'
#copy-ci-linux-bits target='package-runtime' if='!string.IsNullOrEmpty(CI_LINUX_DROP_PATH)'
@{
var extractDirectory = Path.Combine(ARTIFACTS_DIR, "Dnx.Linux");
}
copy sourceDir='${CI_LINUX_DROP_PATH}' outputDir='${extractDirectory}' include='*.nupkg' overwrite='${true}'
@{
foreach (var package in Directory.EnumerateFiles(extractDirectory, "*.nupkg"))
{
var unpackagePath = Path.Combine(extractDirectory, Path.GetFileNameWithoutExtension(package));
UnzipPackage(package, unpackagePath);
File.Delete(Path.Combine(unpackagePath, "[Content_Types].xml"));
Directory.Delete(Path.Combine(unpackagePath, "_rels"), recursive: true);
}
}
nuget-pack packageVersion='${FULL_VERSION}' outputDir='${BUILD_DIR2}' extra='-NoPackageAnalysis' nugetPath='.nuget/nuget.exe' each='var nuspecFile in Files.Include(Path.Combine(extractDirectory, "**", "*.nuspec"))'
#copy-darwin-bits target='package-darwin'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_CORECLR_NAME + ".unix")}' include='*.dylib' outputDir='${RUNTIME_CORECLR_DARWIN_x64_BIN}' overwrite='${true}'
copy sourceDir='${Path.Combine(BUILD_DIR2, BOOTSTRAPPER_FOLDER_NAME, "bin", "darwin", "x64")}' include='dnx' outputDir='${RUNTIME_CORECLR_DARWIN_x64_BIN}' overwrite='${true}'
copy sourceDir='${SCRIPTS_DIR}' include='dnu.sh' outputDir='${RUNTIME_CORECLR_DARWIN_x64_BIN}' overwrite='${true}'
@{
FixShFiles(RUNTIME_CORECLR_DARWIN_x64_BIN);
}
var CI_DARWIN_DROP_PATH = '${Environment.GetEnvironmentVariable("CI_DARWIN_DROP_PATH")}'
#copy-ci-darwin-bits target='package-runtime' if='!string.IsNullOrEmpty(CI_DARWIN_DROP_PATH)'
@{
var extractDirectory = Path.Combine(ARTIFACTS_DIR, "Dnx.Darwin");
}
copy sourceDir='${CI_DARWIN_DROP_PATH}' outputDir='${extractDirectory}' include='*.nupkg' overwrite='${true}'
@{
foreach (var package in Directory.EnumerateFiles(extractDirectory, "*.nupkg"))
{
var unpackagePath = Path.Combine(extractDirectory, Path.GetFileNameWithoutExtension(package));
UnzipPackage(package, unpackagePath);
File.Delete(Path.Combine(unpackagePath, "[Content_Types].xml"));
Directory.Delete(Path.Combine(unpackagePath, "_rels"), recursive: true);
}
}
nuget-pack packageVersion='${FULL_VERSION}' outputDir='${BUILD_DIR2}' extra='-NoPackageAnalysis' nugetPath='.nuget/nuget.exe' each='var nuspecFile in Files.Include(Path.Combine(extractDirectory, "**", "*.nuspec"))'
#nuget-pack-runtime target='package'
@{
UpdateAllNuspecs(RUNTIME_TARGETS, NUSPEC_ROOT, BUILD_DIR2);
}
nuget-pack packageVersion='${FULL_VERSION}' outputDir='${BUILD_DIR2}' extra='-NoPackageAnalysis -Properties RuntimeNamePrefix=${RUNTIME_NAME_PREFIX}' nugetPath='.nuget/nuget.exe' each='var nuspecFile in Files.Include(Path.Combine(BUILD_DIR2, "*.nuspec"))'
- // ===================== TESTING =====================
#test-package target='integration-test'
- // We want to run functional tests on both CLR flavors (wrt the RUNTIME_TARGETS)
- // We want to separate function tests from unit tests
@{
var binPaths = new Dictionary<string, string>();
// Unzip all runtime targets
foreach (var target in RUNTIME_TARGETS)
{
var nupkgPath = Files.Include(Path.Combine(BUILD_DIR2, target.Name + ".*.nupkg")).Single();
// This is bizzare because it needs to be predictable for the functional tests
// Each runtime must exist in it's own unique root
var unpackagePath = Path.Combine(ARTIFACTS_DIR, "test", target.Name, "runtimes", Path.GetFileNameWithoutExtension(nupkgPath));
var binPath = Path.Combine(unpackagePath, "bin");
Log.Info("Unpacking " + nupkgPath + " to " + unpackagePath);
binPaths[target.Name] = binPath;
// Nuke any previously installed package
UnzipPackage(nupkgPath, unpackagePath);
if (IsMono)
{
Exec("chmod", "+x " + Path.Combine(binPath, "dnx"));
Exec("chmod", "+x " + Path.Combine(binPath, "dnu"));
}
}
// We need to run restore with the new runtime (just one of them)
// On windows, grab a random windows target, otherwise use mono
string path = null;
if (CanBuildForWindows)
{
path = binPaths[RUNTIME_CLR_WIN_x86_NAME];
}
else
{
path = binPaths[RUNTIME_MONO_NAME];
}
ExecuteWithPath(path, () =>
{
DoRestore();
});
// Group by operation system since we only want to run unit tests on a single bitness
// any = [dnx-mono]
// win = [dnx-clr-win-x86, dnx-clr-win-x64, dnx-coreclr-win-x86, dnx-coreclr-win-x64]
// darwin = [dnx-coreclr-darwin-x64]
// linux = [dnx-coreclr-linux-x64]
foreach (var group in RUNTIME_TARGETS.GroupBy(t => t.OS))
{
// Group by architecture since we only care about a single one for unit tests
// any
// any = [dnx-mono]
// win
// x86 = [dnx-clr-win-x86, dnx-coreclr-win-x86]
// x64 = [dnx-clr-win-x64, dnx-coreclr-win-x64]
// linux
// x64 = [dnx-coreclr-linux-x64]
// darwin
// x64 [dnx-coreclr-darwin-x64]
foreach (var target in group.GroupBy(t => t.Arch).First())
{
// Skip mono if we're not running on mono
if (!IsMono && target.Flavor == "mono")
{
continue;
}
// TODO: enable tests on darwin and linux after we get rid of ansi console color issue on CoreCLR
if (target.OS == "darwin" || target.OS == "linux")
{
continue;
}
var binPath = binPaths[target.Name];
ExecuteWithPath(binPath, () =>
{
foreach(var projectFile in Files.Include("test/*.Tests/project.json"))
{
var serializer = new JavaScriptSerializer();
var projectText = File.ReadAllText(projectFile);
var project = (Dictionary<string, object>)serializer.DeserializeObject(projectText);
object configsObject;
var configs = project.TryGetValue("frameworks", out configsObject)
? (Dictionary<string, object>)configsObject
: new Dictionary<string, object>
{
{ "dnx451", new Dictionary<string, object>() } // Assume dnx451 only if none specified
};
var targetFrameworks = configs.Keys.Where(k => k.StartsWith("dnx", StringComparison.OrdinalIgnoreCase));
foreach (var framework in targetFrameworks)
{
if(framework == target.Framework)
{
KTest(projectFile);
break;
}
else
{
continue;
}
}
}
});
// Functional tests run there own dnx versions
// we only need to kick them off with Desktop CLR once
if (target.Flavor == "coreclr")
{
continue;
}
// Functional tests dont work on linux and osx yet
if (target.OS == "darwin" || target.OS == "linux")
{
continue;
}
ExecuteWithPath(binPath, () =>
{
foreach(var projectFile in Files.Include("test/*.FunctionalTests/project.json"))
{
KTest(projectFile);
}
});
}
}
}
- // ===================== SHARED UTILITIES =====================
macro name='DoRestore'
for each='var projectFile in Files.Include("src/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("test/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("samples/*/project.json")'
exec program='cmd' commandline='/C dnu restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='dnu' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
#update-tpa .copy-coreclr
@{
var envTrace = Environment.GetEnvironmentVariable("DNX_TRACE");
try
{
var dotnetcoreclrDepFile = Path.Combine(BUILD_DIR2, "dotnetcoreclr-dependencies.txt");
var runtimeCandidates = new[] {
Path.Combine(CORECLR_TARGET_PATH, "Runtime", "win", "x86"),
};
Environment.SetEnvironmentVariable("DNX_TRACE", "0");
if (IsMono)
{
var args = string.Format(@"list {0} --assemblies --runtime {1}",
Path.Combine(ROOT, "src", BOOTSTRAPPER_HOST_NAME),