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 setlocal |
7 rem Handle the case where dart-sdk/bin has been symlinked to. | 7 rem Handle the case where dart-sdk/bin has been symlinked to. |
8 set DIR_NAME_WITH_SLASH=%~dp0 | 8 set DIR_NAME_WITH_SLASH=%~dp0 |
9 set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%% | 9 set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%% |
10 call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR | 10 call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR |
11 rem Get rid of surrounding quotes. | 11 rem Get rid of surrounding quotes. |
12 for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi | 12 for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi |
13 | 13 |
14 rem Get absolute full name for SDK_DIR. | 14 rem Get absolute full name for SDK_DIR. |
15 for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi | 15 for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi |
16 | 16 |
17 set DART2JS=%SDK_DIR%lib\_internal\compiler\implementation\dart2js.dart | 17 set DART2JS=%SDK_DIR%lib\_internal\compiler\implementation\dart2js.dart |
18 set DART=%BIN_DIR%\dart | 18 set DART=%BIN_DIR%\dart |
19 set SNAPSHOT=%DART2JS%.snapshot | 19 set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot |
20 | 20 |
21 set EXTRA_OPTIONS= | 21 set EXTRA_OPTIONS= |
22 set EXTRA_VM_OPTIONS= | 22 set EXTRA_VM_OPTIONS= |
23 | 23 |
24 if _%DART2JS_DEVELOPER_MODE%_ == _1_ ( | 24 if _%DART2JS_DEVELOPER_MODE%_ == _1_ ( |
25 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --checked | 25 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --checked |
26 ) | 26 ) |
27 | 27 |
28 if exist "%SNAPSHOT%" ( | 28 if exist "%SNAPSHOT%" ( |
29 echo Using snapshot "%SNAPSHOT%" >&2 | 29 echo Using snapshot "%SNAPSHOT%" >&2 |
30 set DART2JS=%SNAPSHOT% | 30 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --library-root=%SDK_DIR% |
31 ) | 31 ) |
32 | 32 |
33 rem See comments regarding options below in dart2js shell script. | 33 rem See comments regarding options below in dart2js shell script. |
34 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --heap_growth_rate=512 | 34 set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --heap_growth_rate=512 |
35 | 35 |
36 "%DART%" %EXTRA_VM_OPTIONS% "%DART2JS%" %EXTRA_OPTIONS% %* | 36 if exist "%SNAPSHOT%" ( |
| 37 "%DART%" %EXTRA_VM_OPTIONS% "SNAPSHOT%" "dart2js" %EXTRA_OPTIONS% %* |
| 38 ) else ( |
| 39 "%DART%" %EXTRA_VM_OPTIONS% "%DART2JS%" %EXTRA_OPTIONS% %* |
| 40 ) |
| 41 |
37 endlocal | 42 endlocal |
38 | 43 |
39 exit /b %errorlevel% | 44 exit /b %errorlevel% |
40 | 45 |
41 :follow_links | 46 :follow_links |
42 setlocal | 47 setlocal |
43 for %%i in (%1) do set result=%%~fi | 48 for %%i in (%1) do set result=%%~fi |
44 set current= | 49 set current= |
45 for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^ | 50 for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^ |
46 ^| find "> %~n1 ["') do ( | 51 ^| find "> %~n1 ["') do ( |
47 set current=%%i | 52 set current=%%i |
48 ) | 53 ) |
49 if not "%current%"=="" call :follow_links "%current%", result | 54 if not "%current%"=="" call :follow_links "%current%", result |
50 endlocal & set %~2=%result% | 55 endlocal & set %~2=%result% |
51 goto :eof | 56 goto :eof |
52 | 57 |
53 :end | 58 :end |
OLD | NEW |