forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cmd
More file actions
446 lines (374 loc) · 12.7 KB
/
build.cmd
File metadata and controls
446 lines (374 loc) · 12.7 KB
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
@if "%_echo%"=="" echo off
:ARGUMENTS_VALIDATION
if /I "%1" == "/help" (goto :USAGE)
if /I "%1" == "/h" (goto :USAGE)
if /I "%1" == "/?" (goto :USAGE)
goto :ARGUMENTS_OK
:USAGE
echo Build and run a subset of test suites
echo.
echo Usage:
echo.
echo build.cmd ^<all^|proto^|build^|debug^|release^|diag^|compiler^|coreclr^|pcls^|vs^|ci^|ci_part1^|ci_part2^>
echo.
echo No arguments default to 'build'
echo.
echo To specify multiple values, separate strings by comma
echo.
echo The example below run pcls, vs and qa:
echo.
echo build.cmd pcls,vs,debug
exit /b 1
:ARGUMENTS_OK
set BUILD_PROTO=0
set BUILD_NET40=1
set BUILD_CORECLR=0
set BUILD_PORTABLE=0
set BUILD_VS=0
set BUILD_CONFIG=release
set BUILD_CONFIG_LOWERCASE=release
set BUILD_DIAG=
set TEST_COMPILERUNIT=0
set TEST_NET40_COREUNIT=0
set TEST_CORECLR=0
set TEST_PORTABLE_COREUNIT=0
set TEST_VS=0
set TEST_FSHARP_SUITE=0
set TEST_FSHARPQA_SUITE=0
set TEST_TAGS=
set SKIP_EXPENSIVE_TESTS=1
setlocal enableDelayedExpansion
set /a counter=0
for /l %%x in (1 1 9) do (
set /a counter=!counter!+1
call :SET_CONFIG %%!counter! "!counter!"
)
for %%i in (%BUILD_FSC_DEFAULT%) do ( call :SET_CONFIG %%i )
setlocal disableDelayedExpansion
echo.
goto :MAIN
:SET_CONFIG
set ARG=%~1
if "%ARG%" == "1" if "%2" == "" (set ARG=build)
if "%2" == "" if not "%ARG%" == "build" goto :EOF
echo Parse argument %ARG%
if /i '%ARG%' == 'compiler' (set TEST_COMPILERUNIT=1)
if /i '%ARG%' == 'pcls' (
set BUILD_PORTABLE=1
set TEST_PORTABLE_COREUNIT=1
)
if /i '%ARG%' == 'vs' (
set BUILD_VS=1
set TEST_VS=1
)
if /i '%ARG%' == 'diag' (
set BUILD_DIAG=/v:detailed
if not defined APPVEYOR ( set BUILD_LOG=fsharp_build_log.log )
)
if /i '%ARG%' == 'all' (
set BUILD_PROTO=1
set BUILD_NET40=1
set BUILD_CORECLR=1
set BUILD_PORTABLE=1
set BUILD_VS=1
set TEST_COMPILERUNIT=1
set TEST_NET40_COREUNIT=1
set TEST_PORTABLE_COREUNIT=1
set TEST_FSHARP_SUITE=1
set TEST_FSHARPQA_SUITE=1
set TEST_CORECLR=1
set TEST_VS=1
set SKIP_EXPENSIVE_TESTS=0
)
if /i '%ARG%' == 'proto' (
set BUILD_PROTO=1
)
REM Same as 'all' but smoke testing only
if /i '%ARG%' == 'ci' (
set SKIP_EXPENSIVE_TESTS=1
set BUILD_NET40=1
set BUILD_CORECLR=1
set BUILD_PORTABLE=1
set BUILD_VS=1
set TEST_COMPILERUNIT=1
set TEST_NET40_COREUNIT=1
set TEST_PORTABLE_COREUNIT=1
set TEST_FSHARP_SUITE=1
set TEST_FSHARPQA_SUITE=1
set TEST_CORECLR=1
set TEST_VS=0
set TEST_TAGS=
set CONF_FSHARPQA_SUITE=Smoke
)
REM These divide 'ci' into three chunks which can be done in parallel
if /i '%ARG%' == 'ci_part1' (
set BUILD_PROTO=1
set SKIP_EXPENSIVE_TESTS=1
set BUILD_CORECLR=0
set BUILD_PORTABLE=1
set BUILD_VS=1
set TEST_COMPILERUNIT=1
set TEST_NET40_COREUNIT=1
set TEST_PORTABLE_COREUNIT=1
set TEST_CORECLR=0
set TEST_TAGS=
set TEST_VS=1
)
if /i '%ARG%' == 'ci_part2' (
set BUILD_PROTO=1
set SKIP_EXPENSIVE_TESTS=1
set BUILD_CORECLR=1
set BUILD_PORTABLE=1
set TEST_CORECLR=1
set TEST_FSHARPQA_SUITE=1
set TEST_FSHARP_SUITE=1
)
if /i '%ARG%' == 'coreclr' (
set BUILD_CORECLR=1
set TEST_CORECLR=1
)
if /i '%ARG%' == 'debug' (
set BUILD_CONFIG=debug
set BUILD_CONFIG_LOWERCASE=debug
)
if /i '%ARG%' == 'build' (
set BUILD_PORTABLE=1
set BUILD_VS=1
)
if /i '%ARG%' == 'notests' (
set TEST_COMPILERUNIT=0
set TEST_NET40_COREUNIT=0
set TEST_CORECLR=0
set TEST_PORTABLE_COREUNIT=0
set TEST_VS=0
set TEST_FSHARP_SUITE=0
set TEST_FSHARPQA_SUITE=0
set SKIP_EXPENSIVE_TESTS=1
)
if /i '%ARG%' == 'test-smoke' (
REM Smoke tests are a very small quick subset of tests
set SKIP_EXPENSIVE_TESTS=1
set TEST_COMPILERUNIT=0
set TEST_NET40_COREUNIT=0
set TEST_FSHARP_SUITE=1
set TEST_FSHARPQA_SUITE=0
set TEST_TAGS=Smoke
)
if /i '%ARG%' == 'test-fsharpqa' (
set BUILD_NET40=1
set TEST_FSHARPQA_SUITE=1
)
if /i '%ARG%' == 'test-compilerunit' (
set BUILD_NET40=1
set TEST_COMPILERUNIT=1
)
if /i '%ARG%' == 'test-coreunit' (
set BUILD_NET40=1
set TEST_NET40_COREUNIT=1
)
if /i '%ARG%' == 'test-coreclr' (
set BUILD_CORECLR=1
set TEST_CORECLR=1
)
if /i '%ARG%' == 'test-pcls' (
set BUILD_PORTABLE=1
set TEST_PORTABLE_COREUNIT=1
)
if /i '%ARG%' == 'test-vs' (
set BUILD_VS=1
set TEST_VS=1
)
if /i '%ARG%' == 'test-fsharp' (
set TEST_FSHARP_SUITE=1
)
goto :EOF
:MAIN
REM after this point, ARG variable should not be used, use only BUILD_* or TEST_*
echo Build/Tests configuration:
echo.
echo BUILD_PROTO=%BUILD_PROTO%
echo BUILD_NET40=%BUILD_NET40%
echo BUILD_CORECLR=%BUILD_CORECLR%
echo BUILD_PORTABLE=%BUILD_PORTABLE%
echo BUILD_VS=%BUILD_VS%
echo BUILD_CONFIG=%BUILD_CONFIG%
echo BUILD_CONFIG_LOWERCASE=%BUILD_CONFIG_LOWERCASE%
echo.
echo TEST_COMPILERUNIT=%TEST_COMPILERUNIT%
echo TEST_NET40_COREUNIT=%TEST_NET40_COREUNIT%
echo TEST_PORTABLE_COREUNIT=%TEST_PORTABLE_COREUNIT%
echo TEST_VS=%TEST_VS%
echo TEST_FSHARP_SUITE=%TEST_FSHARP_SUITE%
echo TEST_FSHARPQA_SUITE=%TEST_FSHARPQA_SUITE%
echo TEST_TAGS=%TEST_TAGS%
echo SKIP_EXPENSIVE_TESTS=%SKIP_EXPENSIVE_TESTS%
echo.
if "%RestorePackages%"=="" (
set RestorePackages=true
)
@echo on
call src\update.cmd signonly
:: Check prerequisites
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS150COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=15.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 15.0\common7\ide\devenv.exe" set VisualStudioVersion=15.0
if exist "%ProgramFiles%\Microsoft Visual Studio 15.0\common7\ide\devenv.exe" set VisualStudioVersion=15.0
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS140COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if exist "%ProgramFiles%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe" set VisualStudioVersion=14.0
if not '%VisualStudioVersion%' == '' goto vsversionset
if exist "%VS120COMNTOOLS%..\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0
if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe" set VisualStudioVersion=12.0
:vsversionset
if '%VisualStudioVersion%' == '' echo Error: Could not find an installation of Visual Studio && goto :failure
if exist "%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" set _msbuildexe="%ProgramFiles(x86)%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if exist "%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe" set _msbuildexe="%ProgramFiles%\MSBuild\%VisualStudioVersion%\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. && goto :failure
set _nrswitch=/nr:false
rem uncomment to use coreclr msbuild not ready yet!!!!
rem set _msbuildexe=%~dp0Tools\CoreRun.exe %~dp0Tools\MSBuild.exe
rem set _nrswitch=
:: See <http://www.appveyor.com/docs/environment-variables>
if defined APPVEYOR (
rem See <http://www.appveyor.com/docs/build-phase>
if exist "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" (
rem HACK HACK HACK
set _msbuildexe=%_msbuildexe% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
)
)
set msbuildflags=/maxcpucount %_nrswitch%
set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure
if '%RestorePackages%' == 'true' (
%_ngenexe% install .\.nuget\NuGet.exe
.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config
@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure
)
:: Restore the Tools directory
call %~dp0init-tools.cmd
set _dotnetexe=%~dp0Tools\dotnetcli\dotnet.exe
pushd .\lkg & %_dotnetexe% restore &popd
@if ERRORLEVEL 1 echo Error: dotnet restore failed && goto :failure
pushd .\lkg & %_dotnetexe% publish project.json &popd
@if ERRORLEVEL 1 echo Error: dotnet publish failed && goto :failure
rem rename fsc and coreconsole to allow fsc.exe to to start compiler
pushd .\lkg\bin\debug\dnxcore50\win7-x64\publish
fc fsc.exe corehost.exe >nul
@if ERRORLEVEL 1 (
copy fsc.exe fsc.dll
copy corehost.exe fsc.exe
)
popd
rem rename fsc and coreconsole to allow fsc.exe to to start compiler
pushd .\lkg\bin\debug\dnxcore50\win7-x64\publish
fc fsi.exe corehost.exe >nul
@if ERRORLEVEL 1 (
copy fsi.exe fsi.dll
copy corehost.exe fsi.exe
)
popd
rem copy targestfile into tools directory ... temporary fix until packaging complete.
copy src\fsharp\FSharp.Build\Microsoft.FSharp.targets tools\Microsoft.FSharp.targets
copy src\fsharp\FSharp.Build\Microsoft.Portable.FSharp.targets tools\Microsoft.Portable.FSharp.targets
:: Build Proto
if NOT EXIST Proto\net40\bin\fsc-proto.exe (set BUILD_PROTO=1)
:: Build
if '%BUILD_PROTO%' == '1' (
%_msbuildexe% %msbuildflags% src\fsharp-proto-build.proj
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure
%_ngenexe% install Proto\net40\bin\fsc-proto.exe
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure
)
%_msbuildexe% %msbuildflags% build-everything.proj /p:Configuration=%BUILD_CONFIG% %BUILD_DIAG%
@if ERRORLEVEL 1 echo Error: '%_msbuildexe% %msbuildflags% build-everything.proj /p:Configuration=%BUILD_CONFIG% %BUILD_DIAG%' failed && goto :failure
@echo on
call src\update.cmd %BUILD_CONFIG_LOWERCASE% -ngen
pushd tests
if 'TEST_COMPILERUNIT' == '0' and 'TEST_PORTABLE_COREUNIT' == '0' and 'TEST_CORECLR' == '0' and 'TEST_VS' == '0' and 'TEST_FSHARP_SUITE' == '0' and 'TEST_FSHARPQA_SUITE' == '0' goto :finished
@echo on
call BuildTestTools.cmd %BUILD_CONFIG_LOWERCASE%
@if ERRORLEVEL 1 echo Error: 'BuildTestTools.cmd %BUILD_CONFIG_LOWERCASE%' failed && goto :failed_tests
@echo on
if '%TEST_FSHARP_SUITE%' == '1' (
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=true
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp %TEST_TAGS%
@if ERRORLEVEL 1 (
type testresults\FSharpNunit_Error.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp %TEST_TAGS%' failed
goto :failed_tests
)
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=
)
if '%TEST_FSHARPQA_SUITE%' == '1' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharpqa %TEST_TAGS%
@if ERRORLEVEL 1 (
type testresults\fsharpqa_failures.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharpqa %TEST_TAGS%' failed
goto :failed_tests
)
)
if '%TEST_COMPILERUNIT%' == '1' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% compilerunit %TEST_TAGS%
@if ERRORLEVEL 1 (
type testresults\CompilerUnit_net40_Error.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% compilerunit' failed
goto :failed_tests
)
)
if '%TEST_NET40_COREUNIT%' == '1' (
if '%TEST_PORTABLE_COREUNIT%' == '1' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitall %TEST_TAGS%
@if ERRORLEVEL 1 (
@echo "type testresults\CoreUnit_net40_Error.log "
type testresults\CoreUnit_net40_Error.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit' failed
goto :failed_tests
)
)
if '%TEST_PORTABLE_COREUNIT%' == '0' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit %TEST_TAGS%
@if ERRORLEVEL 1 (
type testresults\CoreUnit_Portable_Error.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit' failed
goto :failed_tests
)
)
)
if '%TEST_NET40_COREUNIT%' == '0' (
if '%TEST_PORTABLE_COREUNIT%' == '1' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitall %TEST_TAGS%
@if ERRORLEVEL 1 (
type testresults\CoreUnit_all_Error.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitall %TEST_TAGS%' failed
goto :failed_tests
)
)
)
if '%TEST_CORECLR%' == '1' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitcoreclr %TEST_TAGS%
@if ERRORLEVEL 1 (
type testresults\CoreUnit_coreclr_Error.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitcoreclr %TEST_TAGS%' failed
goto :failed_tests
)
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp coreclr
@if ERRORLEVEL 1 (
type testresults\FSharp_Failures.log
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitcoreclr %TEST_TAGS%' failed
goto :failed_tests
)
)
if '%TEST_VS%' == '1' (
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% ideunit %TEST_TAGS%
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWER% ideunit %TEST_TAGS%' failed && goto :failed_tests
)
:finished
@echo "Finished"
popd
goto :eof
:failed_tests
popd
:failure
exit /b 1