OLD | NEW |
1 @echo off | 1 @echo off |
2 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 REM for details. All rights reserved. Use of this source code is governed by a | 3 REM for details. All rights reserved. Use of this source code is governed by a |
4 REM BSD-style license that can be found in the LICENSE file. | 4 REM BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 setlocal | 6 set SCRIPTPATH=%~dp0 |
7 | 7 |
8 rem Handle the case where dart-sdk/bin has been symlinked to. | 8 REM Does the path have a trailing slash? If so, remove it. |
9 set DIR_NAME_WITH_SLASH=%~dp0 | 9 if %SCRIPTPATH:~-1%== set SCRIPTPATH=%SCRIPTPATH:~0,-1% |
10 set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%% | |
11 call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR | |
12 | 10 |
13 rem Get rid of surrounding quotes. | 11 set arguments=%* |
14 for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi | 12 set SNAPSHOTNAME="%SCRIPTPATH%dart2js.snapshot" |
| 13 if exist %SNAPSHOTNAME% set SNAPSHOT=--use_script_snapshot=%SNAPSHOTNAME% |
15 | 14 |
16 rem Get absolute full name for SDK_DIR. | 15 "%SCRIPTPATH%dart" --no_use_inlining --heap_growth_rate=512 %SNAPSHOT% "%SCRIPTP
ATH%..\lib\_internal\compiler\implementation\dart2js.dart" %arguments% |
17 for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi | |
18 | |
19 set DART2JS=%SDK_DIR%lib\_internal\compiler\implementation\dart2js.dart | |
20 set DART=%BIN_DIR%\dart | |
21 set SNAPSHOT=%DART2JS%.snapshot | |
22 | |
23 set EXTRA_OPTIONS= | |
24 set EXTRA_VM_OPTIONS= | |
25 | |
26 if _%DART2JS_DEVELOPER_MODE%_ == _1_ ( | |
27 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --checked | |
28 ) | |
29 | |
30 if exist "%SNAPSHOT%" ( | |
31 echo Using snapshot "%SNAPSHOT%" >&2 | |
32 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --use_script_snapshot="%SNAPSHOT%" | |
33 ) | |
34 | |
35 rem See comments regarding options below in dart2js shell script. | |
36 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --heap_growth_rate=512 | |
37 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --no_use_inlining | |
38 | |
39 "%DART%" %EXTRA_VM_OPTIONS% "%DART2JS%" %EXTRA_OPTIONS% %* | |
40 | |
41 endlocal | |
42 | |
43 goto end | |
44 | |
45 :follow_links | |
46 setlocal | |
47 for %%i in (%1) do set result=%%~fi | |
48 set current= | |
49 for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^ | |
50 ^| find "> %~n1 ["') do ( | |
51 set current=%%i | |
52 ) | |
53 if not "%current%"=="" call :follow_links "%current%", result | |
54 endlocal & set %~2=%result% | |
55 goto :eof | |
56 | |
57 :end | |
OLD | NEW |