-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
637 lines (564 loc) · 18.3 KB
/
build.bat
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
@echo off
setlocal enabledelayedexpansion
@rem only for interactive debugging !
set _DEBUG=0
@rem #########################################################################
@rem ## Environment setup
set _EXITCODE=0
call :env
if not %_EXITCODE%==0 goto end
call :props
if not %_EXITCODE%==0 goto end
call :args %*
if not %_EXITCODE%==0 goto end
@rem #########################################################################
@rem ## Main
if %_HELP%==1 (
call :help
exit /b !_EXITCODE!
)
if %_CLEAN%==1 (
call :clean
if not !_EXITCODE!==0 goto end
)
if %_UPDATE%==1 (
call :update
if not !_EXITCODE!==0 goto end
)
if %_DIST%==1 (
call :clone
if not !_EXITCODE!==0 goto end
call :dist
if not !_EXITCODE!==0 goto end
)
goto :end
@rem #########################################################################
@rem ## Subroutines
@rem output parameters: _DEBUG_LABEL, _ERROR_LABEL, _WARNING_LABEL
@rem _GIT_CMD, _GIT_OPTS, _MX_CMD, _MX_OPTS, _TAR_CMD
:env
set _BASENAME=%~n0
for %%f in ("%~dp0\.") do set "_ROOT_DIR=%%~dpf"
call :env_colors
set _DEBUG_LABEL=%_NORMAL_BG_CYAN%[%_BASENAME%]%_RESET%
set _ERROR_LABEL=%_STRONG_FG_RED%Error%_RESET%:
set _WARNING_LABEL=%_STRONG_FG_YELLOW%Warning%_RESET%:
set "_TRAVIS_BUILD_DIR=%~dp0"
set "_TMP_DIR=%_ROOT_DIR%\tmp"
set "_GRAAL_PATH=%_TRAVIS_BUILD_DIR%"
set "_MX_PATH=%_ROOT_DIR%\mx"
if not exist "%MSVS_HOME%\VC\Auxiliary\Build\vcvarsall.bat" (
echo %_ERROR_LABEL% MSVS installation not found 1>&2
echo %_ERROR_LABEL% ^(MSVS_HOME="%MSVS_HOME%"^) 1>&2
set _EXITCODE=1
goto :eof
)
set "_VCVARALL_BAT=%MSVS_HOME%\VC\Auxiliary\Build\vcvarsall.bat"
if not exist "%GIT_HOME%\bin\git.exe" (
echo %_ERROR_LABEL% Git installation directory not found 1>&2
set _EXITCODE=1
goto :eof
)
set "_GIT_CMD=%GIT_HOME%\bin\git.exe"
set "_TAR_CMD=%GIT_HOME%\usr\bin\tar.exe"
set "_MX_CMD=%_MX_PATH%\mx.cmd"
set _MX_OPTS=
@rem mx requirement
if not exist "%PYTHON_HOME%\python.exe" (
echo %_ERROR_LABEL% Python installation directory not found 1>&2
set _EXITCODE=1
goto :eof
)
goto :eof
:env_colors
@rem ANSI colors in standard Windows 10 shell
@rem see https://gist.github.com/mlocati/#file-win10colors-cmd
set _RESET=[0m
set _BOLD=[1m
set _UNDERSCORE=[4m
set _INVERSE=[7m
@rem normal foreground colors
set _NORMAL_FG_BLACK=[30m
set _NORMAL_FG_RED=[31m
set _NORMAL_FG_GREEN=[32m
set _NORMAL_FG_YELLOW=[33m
set _NORMAL_FG_BLUE=[34m
set _NORMAL_FG_MAGENTA=[35m
set _NORMAL_FG_CYAN=[36m
set _NORMAL_FG_WHITE=[37m
@rem normal background colors
set _NORMAL_BG_BLACK=[40m
set _NORMAL_BG_RED=[41m
set _NORMAL_BG_GREEN=[42m
set _NORMAL_BG_YELLOW=[43m
set _NORMAL_BG_BLUE=[44m
set _NORMAL_BG_MAGENTA=[45m
set _NORMAL_BG_CYAN=[46m
set _NORMAL_BG_WHITE=[47m
@rem strong foreground colors
set _STRONG_FG_BLACK=[90m
set _STRONG_FG_RED=[91m
set _STRONG_FG_GREEN=[92m
set _STRONG_FG_YELLOW=[93m
set _STRONG_FG_BLUE=[94m
set _STRONG_FG_MAGENTA=[95m
set _STRONG_FG_CYAN=[96m
set _STRONG_FG_WHITE=[97m
@rem strong background colors
set _STRONG_BG_BLACK=[100m
set _STRONG_BG_RED=[101m
set _STRONG_BG_GREEN=[102m
set _STRONG_BG_YELLOW=[103m
set _STRONG_BG_BLUE=[104m
goto :eof
@rem output parameters: _INI, _INI_N
@rem see https://en.wikipedia.org/wiki/INI_file
@rem - properties: name=value
@rem - sections : [section]
@rem - comments : ; commented text
:props
set "__INI_FILE=%_GRAAL_PATH%%_BASENAME%.ini"
if not exist "%__INI_FILE%" goto :eof
set _INI=
set _INI_N=0
set __SECTION=global
for /f "delims=" %%f in (%__INI_FILE%) do (
set __LINE=%%f
if "!__LINE:~0,1!"==";" (
@rem ignore comment
) else if "!__LINE:~0,1!"=="[" (
if not "!__LINE:~-1!"=="]" (
echo %_ERROR_LABEL% Section name must end with ']' in .ini file 1>&2
set _EXITCODE=1
)
@rem section start/end
set __SECTION=!__LINE:~1,-1!
set /a _INI_N+=1
set _INI[!_INI_N!]=!__SECTION!
) else (
for /f "delims=^= tokens=1,*" %%i in ("!__LINE!") do (
set !__SECTION![%%i]=%%~j
)
)
)
@rem properties defined outside a section are put into 'global'.
set /a _INI_N+=1
set _INI[%_INI_N%]=global
goto :eof
@rem input parameter: %*
@rem output paramters: _CLEAN, _DIST, _DIST_ENV, _HELP, _UPDATE, _VERBOSE
:args
set _CLEAN=0
set _DIST=0
set _DIST_ENV=env2
set _HELP=0
set _TIMER=0
set _UPDATE=0
set _VERBOSE=0
set __N=0
:args_loop
set "__ARG=%~1"
if not defined __ARG (
if !__N!==0 set _HELP=1
goto args_done
)
if "%__ARG:~0,1%"=="-" (
@rem option
if "%__ARG%"=="-debug" ( set _DEBUG=1
) else if "%__ARG%"=="-help" ( set _HELP=1
) else if "%__ARG%"=="-timer" ( set _TIMER=1
) else if "%__ARG%"=="-verbose" ( set _VERBOSE=1
) else (
echo %_ERROR_LABEL% Unknown option %__ARG% 1>&2
set _EXITCODE=1
goto args_done
)
) else (
@rem subcommand
if "%__ARG%"=="clean" ( set _CLEAN=1
) else if "%__ARG%"=="dist" ( set _DIST=1
) else if "%__ARG%"=="help" ( set _HELP=1
) else if "%__ARG%"=="update" ( set _UPDATE=1
) else if "%__ARG:~0,5%"=="dist:" (
set /a "__N_MAX=_INI_N-1"
set /a "__N=%__ARG:~5%+0"
if 1 leq !__N! if !__N! leq !__N_MAX! (
set _DIST=1
set "_DIST_ENV=env!__N!"
) else (
echo %_ERROR_LABEL% Invalid environment ID !__N! ^(1..!__N_MAX!^) 1>&2
set _EXITCODE=1
goto args_done
)
) else (
echo %_ERROR_LABEL% Unknown subcommand %__ARG% 1>&2
set _EXITCODE=1
goto args_done
)
set /a __N+=1
)
shift
goto args_loop
:args_done
if %_DEBUG%==1 (
echo %_DEBUG_LABEL% Options : _DIST_ENV=%_DIST_ENV% _TIMER=%_TIMER% _VERBOSE=%_VERBOSE% 1>&2
echo %_DEBUG_LABEL% Subcommands: _CLEAN=%_CLEAN% _DIST=%_DIST% _UPDATE=%_UPDATE% 1>&2
echo %_DEBUG_LABEL% Variables : "GRAALVM_HOME=%GRAALVM_HOME%" 1>&2
echo %_DEBUG_LABEL% Variables : "JAVA_HOME=%JAVA_HOME%" 1>&2
echo %_DEBUG_LABEL% Variables : "LLVM_HOME=%LLVM_HOME%" 1>&2
echo %_DEBUG_LABEL% Variables : "MSVS_HOME=%MSVS_HOME%" 1>&2
echo %_DEBUG_LABEL% Variables : "PYTHON_HOME=%PYTHON_HOME%" 1>&2
)
if %_TIMER%==1 for /f "delims=" %%i in ('powershell -c "(Get-Date)"') do set _TIMER_START=%%i
goto :eof
:help
if %_VERBOSE%==1 (
set __BEG_P=%_STRONG_FG_CYAN%
set __BEG_O=%_STRONG_FG_GREEN%
set __BEG_N=%_NORMAL_FG_YELLOW%
set __END=%_RESET%
) else (
set __BEG_P=
set __BEG_O=
set __BEG_N=
set __END=
)
set /a "__N_MAX=_INI_N-1"
echo Usage: %__BEG_O%%_BASENAME% { ^<option^> ^| ^<subcommand^> }%__END%
echo.
echo %__BEG_P%Options:%__END%
echo %__BEG_O%-debug%__END% show commands executed by this batch file
echo %__BEG_O%-timer%__END% display total elapsed time
echo %__BEG_O%-verbose%__END% display progress messages
echo.
echo %__BEG_P%Subcommands:%__END%
echo %__BEG_O%clean%__END% delete generated files
echo %__BEG_O%dist[:^<n^>]%__END% generate distribution with environment n=1-%__N_MAX% ^(default=2^)
echo ^(see environment definitions in file %__BEG_O%build.ini%__END%^)
echo %__BEG_O%help%__END% display this help message
echo %__BEG_O%update%__END% fetch/merge local directories graal/mx
goto :eof
:clean
call :rmdir "%_TMP_DIR%"
for /f %%d in ('dir /ad /b "%_GRAAL_PATH%\CompilationWrapperTest_*" 2^>NUL') do (
call :rmdir "%_GRAAL_PATH%\%%d"
)
for /f %%d in ('dir /ad /b "%_GRAAL_PATH%\DumpPathTest*" 2^>NUL') do (
call :rmdir "%_GRAAL_PATH%\%%d"
)
for /f %%f in ('dir /a-d /b "%_GRAAL_PATH%\hs_err_pid*.log" 2^>NUL') do (
call :del "%_GRAAL_PATH%\%%f"
)
@rem workaround: mx tool has troubles with long file paths on Windows.
if exist "%_GRAAL_PATH%\truffle\mxbuild\src" (
call :rmdir "%_GRAAL_PATH%\truffle\mxbuild\src"
)
goto :eof
:rmdir
set "__DIR=%~1"
if not exist "%__DIR%\" goto :eof
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% rmdir /s /q "%__DIR%" 1>&2
) else if %_VERBOSE%==1 ( echo Remove directory "!__DIR:%_ROOT_DIR%\=!" 1>&2
)
rmdir /s /q "%__DIR%"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
goto :eof
:del
set "__FILE=%~1"
if not exist "%__FILE%" goto :eof
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% del /q "%__FILE%" 1>&2
) else if %_VERBOSE%==1 ( echo Remove file "!__FILE:%_ROOT_DIR%\=!" 1>&2
)
del /q "%__FILE%"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
goto :eof
:update
call :update_graal
if not %_EXITCODE%==0 goto :eof
call :update_mx
if not %_EXITCODE%==0 goto :eof
goto :eof
:update_graal
if not exist "%_GRAAL_PATH%\.travis.yml" goto :eof
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% Current directory is "%_GRAAL_PATH%" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Current directory is "!_GRAAL_PATH:%_ROOT_DIR%=!" 1>&2
)
pushd "%_GRAAL_PATH%"
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%_GIT_CMD%" %_GIT_OPTS% fetch upstream 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Update local directory %_GRAAL_PATH% 1>&2
)
call "%_GIT_CMD%" %_GIT_OPTS% fetch upstream
if not %ERRORLEVEL%==0 (
popd
set _EXITCODE=1
goto :eof
)
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%_GIT_CMD%" %_GIT_OPTS% merge upstream/master 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Update local directory %_GRAAL_PATH% 1>&2
)
call "%_GIT_CMD%" %_GIT_OPTS% merge upstream/master
if not %ERRORLEVEL%==0 (
popd
set _EXITCODE=1
goto :eof
)
popd
goto :eof
:update_mx
if not exist "%_MX_CMD%" goto :eof
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% Current directory is "%_MX_PATH%" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Current directory is "!_MX_PATH:%_ROOT_DIR%=!" 1>&2
)
pushd "%_MX_PATH%"
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% %_GIT_CMD% %_GIT_OPTS% fetch 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Update MX suite repository into directory %_MX_PATH% 1>&2
)
call "%_GIT_CMD%" %_GIT_OPTS% fetch
if not %ERRORLEVEL%==0 (
popd
set _EXITCODE=1
goto :eof
)
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% %_GIT_CMD% %_GIT_OPTS% merge 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Update MX suite repository into directory %_MX_PATH% 1>&2
)
call "%_GIT_CMD%" %_GIT_OPTS% merge
if not %ERRORLEVEL%==0 (
popd
set _EXITCODE=1
goto :eof
)
popd
goto :eof
:clone
call :clone_graal
if not %_EXITCODE%==0 goto :eof
call :clone_mx
if not %_EXITCODE%==0 goto :eof
goto :eof
:clone_graal
goto :eof
@rem if exist "%_GRAAL_PATH%\.github\NUL" goto :eof
set "__GRAAL_URL=https://github.com/oracle/graal.git"
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%_GIT_CMD%" %_GIT_OPTS% clone %__GRAAL_URL% %"_GRAAL_PATH%" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Clone Graal repository into directory "%_GRAAL_PATH%" 1>&2
)
call "%_GIT_CMD%" %_GIT_OPTS% clone "%__GRAAL_URL%" "%_GRAAL_PATH%"
if not %ERRORLEVEL%==0 (
echo %_ERROR_LABEL% Failed to clone graal remote Git repository 1>&2
set _EXITCODE=1
goto :eof
)
if not exist "%_GRAALVM_HOME%\.travis.yml" (
echo %_ERROR_LABEL% Travis configuration file not found ^(%_GRAAL_PATH%^) 1>&2
set _EXITCODE=1
goto :eof
)
goto :eof
:clone_mx
if exist "%_MX_CMD%" goto :eof
set __MX_URL=https://github.com/graalvm/mx.git
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%_GIT_CMD%" %_GIT_OPTS% clone %__MX_URL% %_MX_PATH% 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Clone MX suite repository into directory %_MX_PATH% 1>&2
)
call "%_GIT_CMD%" %_GIT_OPTS% clone "%__MX_URL%" "%_MX_PATH%"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
if not exist "%_MX_CMD%" (
echo %_ERROR_LABEL% MX command not found ^(%_MX_PATH%^) 1>&2
set _EXITCODE=1
goto :eof
)
goto :eof
@rem output parameter: JDT
:style
if "%GATE:style=%"=="%GATE%" goto :eof
set "__JAR_URL=https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/3.24.0/ecj-3.24.0.jar"
set "__JAR_FILE=%_ROOT_DIR%ecj-3.24.0.jar"
if exist "%__JAR_FILE%" goto style_done
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% powershell -C "wget -OutFile '%__JAR_FILE%' -Uri '%__JAR_URL%'" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Download Eclipse JDT standalone archive to directory %_ROOT_DIR% 1>&2
)
powershell -C "$progressPreference='silentlyContinue'; wget -OutFile '%__JAR_FILE%' -Uri '%__JAR_URL%'"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
:style_done
set "JDT=%__JAR_FILE%"
goto :eof
@rem depends on :dist_env
:fullbuild
if "%GATE:fullbuild=%"=="%GATE%" goto :eof
if not %JDK%==jdk8 goto :eof
set "__JAR_URL=https://archive.eclipse.org/eclipse/downloads/drops4/R-4.5.2-201602121500/ecj-4.5.2.jar"
set "__JAR_FILE=%_MX_PATH%\ecj.jar"
if exist "%__JAR_FILE%" goto fullbuild_done
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% powershell -C "wget -OutFile '%__JAR_FILE%' -Uri '%__JAR_URL%'" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Download Eclipse JDT archive to directory %_MX_PATH% 1>&2
)
powershell -C "$progressPreference='silentlyContinue'; wget -OutFile '%__JAR_FILE%' -Uri '%__JAR_URL%'"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
:fullbuild_done
set "JDT=%__JAR_FILE%"
goto :eof
@rem depends on :dist_env
:jvmci
if not %JDK%==jdk8 goto :eof
@rem see https://github.com/graalvm/labs-openjdk-11/releases
set __JVMCI_VERSION=jvmci-22.3-b09
@rem rule: <os_name>-<os_arch>, eg. darwin-amd64, linux-amd64, windows-amd64
set __JDK_PLATFORM=windows-amd64
set "__JDK_INSTALL_NAME=labsjdk-ce-11.0.18+2-%__JVMCI_VERSION%"
set "__JDK_TGZ_NAME=labsjdk-ce-11.0.18+2-%__JVMCI_VERSION%-%__JDK_PLATFORM%.tar.gz"
set "__JDK_TGZ_URL=https://github.com/graalvm/labs-openjdk-11/releases/download/%__JVMCI_VERSION%/%__JDK_TGZ_NAME%"
set "__JDK_TGZ_FILE=%_ROOT_DIR%\%__JDK_TGZ_NAME%"
if exist "%_ROOT_DIR%\%__JDK_INSTALL_NAME%\" goto jvmci_done
if exist "%__JDK_TGZ_FILE%" goto jvmci_extract
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% powershell -C "wget -OutFile '%__JDK_TGZ_FILE%' -Uri '%__JDK_TGZ_URL%'" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Download OpenJDK 8 archive to directory %_ROOT_DIR% 1>&2
)
powershell -C "$progressPreference='silentlyContinue'; wget -OutFile '%__JDK_TGZ_FILE%' -Uri '%__JDK_TGZ_URL%'"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
:jvmci_extract
if not exist "%_TMP_DIR%" mkdir "%_TMP_DIR%"
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%_TAR_CMD%" -C "%_TMP_DIR%" -xf "%__JDK_TGZ_FILE%" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Extract archive %__JDK_TGZ_FILE% into directory %_ROOT_DIR% 1>&2
)
@rem NB. tar on Windows dislike it when <dir1>=<dir2>, given -xf <dir2>\*.tar.gz and -C <dir1>
call "%_TAR_CMD%" -C "%_TMP_DIR%" -xf "%__JDK_TGZ_FILE%"
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% move "%_TMP_DIR%\"%__JDK_INSTALL_NAME%" "%_ROOT_DIR%\" 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Move JDK installation directory to directory %_ROOT_DIR% 1>&2
)
move "%_TMP_DIR%\%__JDK_INSTALL_NAME%" "%_ROOT_DIR%\" 1>NUL
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
:jvmci_done
set "JAVA_HOME=%_ROOT_DIR%\%__JDK_INSTALL_NAME%"
goto :eof
:dist
setlocal
call :dist_env
set "__PRIMARY_PATH=%_TRAVIS_BUILD_DIR%\%PRIMARY%"
if not exist "%__PRIMARY_PATH%" (
echo %_ERROR_LABEL% Primary directory not found ^(%PRIMARY%^) 1>&2
set _EXITCODE=1
goto dist_done
)
call :style
if not %_EXITCODE%==0 goto dist_done
call :fullbuild
if not %_EXITCODE%==0 goto dist_done
call :jvmci
if not %_EXITCODE%==0 goto dist_done
echo %JAVA_HOME%
call "%JAVA_HOME%\bin\java.exe" -version
if %_DEBUG%==1 ( set __MX_OPTS=-V %_MX_OPTS%
) else if %_VERBOSE%==1 ( set __MX_OPTS=-v %_MX_OPTS%
) else ( set __MX_OPTS=%_MX_OPTS%
)
set __PATH=%PATH%
set "PATH=%__PATH%;%PYTHON_HOME%;%PYTHON_HOME%\Scripts"
if %_DEBUG%==1 where python.exe
if %_DEBUG%==1 ( echo %_DEBUG_LABEL% "%_MX_CMD%" %__MX_OPTS% --primary-suite-path %PRIMARY% --java-home=%JAVA_HOME% gate --strict-mode --tags %GATE% 1>&2
) else if %_VERBOSE%==1 ( echo %_VERBOSE_LABEL% Create GraalVM build with tags %GATE% 1>&2
)
call "%_MX_CMD%" %__MX_OPTS% --primary-suite-path "%PRIMARY%" --java-home=%JAVA_HOME% gate --strict-mode --tags %GATE%
if not %ERRORLEVEL%==0 (
set "PATH=%__PATH%"
set _EXITCODE=1
goto dist_done
)
set "PATH=%__PATH%"
:dist_done
endlocal
goto :eof
@rem Defined variables are local to subroutine dist
:dist_env
call :dist_env_ini
if "%JDK%"=="jdk11" set JAVA_HOME=%JAVA11_HOME%
if %_DEBUG%==1 echo %_DEBUG_LABEL% "%_VCVARALL_BAT%" x64 1>&2
call "%_VCVARALL_BAT%" x64
if not %ERRORLEVEL%==0 (
set _EXITCODE=1
goto :eof
)
@rem Official LLVM variables: https://llvm.org/docs/CMake.html#llvm-specific-variables
if defined LLVM_VERSION (
set CLANG=clang-%LLVM_VERSION%.exe
set CLANGXX=clang++-%LLVM_VERSION%.exe
set OPT=opt-%LLVM_VERSION%.exe
set LLVM_AS=llvm-as-%LLVM_VERSION%.exe
set LLVM_LINK=llvm-link-%LLVM_VERSION%.exe
) else (
set CLANG=clang.exe
set CLANGXX=clang++.exe
set OPT=opt.exe
set LLVM_AS=llvm-as.exe
set LLVM_LINK=llvm-link.exe
)
if %_DEBUG%==1 (
echo %_DEBUG_LABEL% ===== B U I L D V A R I A B L E S ===== 1>&2
echo %_DEBUG_LABEL% "JAVA_HOME=%JAVA_HOME%" 1>&2
echo %_DEBUG_LABEL% "INCLUDE=%INCLUDE%" 1>&2
echo %_DEBUG_LABEL% "LIB=%LIB%" 1>&2
echo %_DEBUG_LABEL% "LIBPATH=%LIBPATH%" 1>&2
echo %_DEBUG_LABEL% ========================================= 1>&2
)
goto :eof
@rem both _INI and _INI_N are defined in subroutine :ini
:dist_env_ini
for /l %%i in (1, 1, %_INI_N%) do (
set __SECTION=!_INI[%%i]!
if "!__SECTION!"=="%_DIST_ENV%" (
if %_DEBUG%==1 echo %_DEBUG_LABEL% _SECTION=!__SECTION!
for %%s in (!__SECTION!) do (
set JDK=!%%s[JDK]!
set GATE=!%%s[GATE]!
set PRIMARY=!%%s[PRIMARY]!
set DYNAMIC_IMPORTS=!%%s[DYNAMIC_IMPORTS]!
set LLVM_VERSION=!%%s[LLVM_VERSION]!
set DISABLE_POLYGLOT=!%%s[DISABLE_POLYGLOT]!
set DISABLE_LIBPOLYGLOT=!%%s[DISABLE_LIBPOLYGLOT]!
set NO_FEMBED_BITCODE=!%%s[NO_FEMBED_BITCODE]!
)
)
)
goto :eof
@rem output parameter: _DURATION
:duration
set __START=%~1
set __END=%~2
for /f "delims=" %%i in ('powershell -c "$interval = New-TimeSpan -Start '%__START%' -End '%__END%'; Write-Host $interval"') do set _DURATION=%%i
goto :eof
@rem #########################################################################
@rem ## Cleanups
:end
if %_TIMER%==1 (
for /f "delims=" %%i in ('powershell -c "(Get-Date)"') do set __TIMER_END=%%i
call :duration "%_TIMER_START%" "!__TIMER_END!"
echo Total execution time: !_DURATION! 1>&2
)
if %_DEBUG%==1 echo %_DEBUG_LABEL% _EXITCODE=%_EXITCODE% 1>&2
exit /b %_EXITCODE%
endlocal