Chromium Code Reviews| 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) 2014, 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 rem Run pub.dart on the Dart VM. This script is only used when running pub from | |
| 7 rem within the Dart source repo. The shipped SDK instead uses "pub_sdk.bat", | |
| 8 rem which is renamed to "pub.bat" when the SDK is built. | |
| 9 | |
| 6 setlocal | 10 setlocal |
| 7 rem Handle the case where dart-sdk/bin has been symlinked to. | 11 rem Handle the case where dart-sdk/bin has been symlinked to. |
| 8 set DIR_NAME_WITH_SLASH=%~dp0 | 12 set DIR_NAME_WITH_SLASH=%~dp0 |
| 9 set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%% | 13 set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%% |
| 10 call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR | 14 call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR |
| 11 rem Get rid of surrounding quotes. | 15 rem Get rid of surrounding quotes. |
| 12 for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi | 16 for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi |
| 13 | 17 |
| 14 rem Get absolute full name for SDK_DIR. | 18 rem Get absolute full name for SDK_DIR. |
| 15 for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi | 19 for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi |
| 16 | 20 |
| 17 rem Remove trailing backslash if there is one | 21 rem Remove trailing backslash if there is one |
| 18 IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1% | 22 IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1% |
| 19 | 23 |
| 20 set PUB=%SDK_DIR%\lib\_internal\pub\bin\pub.dart | |
| 21 set DART=%BIN_DIR%\dart | |
| 22 set SNAPSHOT=%BIN_DIR%\snapshots\pub.dart.snapshot | |
| 23 set BUILD_DIR=%SDK_DIR%\..\build\ReleaseIA32 | |
| 24 set PACKAGES_DIR=%BUILD_DIR%\pub_packages | |
| 25 set DART_IN_BUILT_SDK=%BUILD_DIR%\dart-sdk\bin\dart | |
| 26 set VM_OPTIONS= | 24 set VM_OPTIONS= |
| 27 | 25 |
| 28 rem Give the VM extra memory for dart2js. | 26 rem Give the VM extra memory for dart2js. |
| 29 rem # TODO(rnystrom): Remove when #8355 is fixed. | 27 rem # TODO(rnystrom): Remove when #8355 is fixed. |
| 30 rem See comments regarding options below in dart2js shell script. | 28 rem See comments regarding options below in dart2js shell script. |
| 31 set VM_OPTIONS=%VM_OPTIONS% --old_gen_heap_size=1024 | 29 set VM_OPTIONS=%VM_OPTIONS% --old_gen_heap_size=1024 |
| 32 | 30 |
| 33 if exist "%SNAPSHOT%" ( | 31 rem Use the Dart binary in the built SDK so pub can find the version file next |
| 34 "%DART%" %VM_OPTIONS% "%SNAPSHOT%" %* | 32 rem to it. |
| 35 ) else ( | 33 set BUILD_DIR=%SDK_DIR%\..\build\ReleaseIA32 |
| 36 "%DART_IN_BUILT_SDK%" %VM_OPTIONS% --package-root="%PACKAGES_DIR%" "%PUB%" %* | 34 set PACKAGES_DIR=%BUILD_DIR%\pub_packages |
| 37 ) | 35 set DART=%BUILD_DIR%\dart-sdk\bin\dart |
| 36 | |
| 37 rem Compile async/await down to vanilla Dart. | |
| 38 rem TODO(rnystrom): Remove this when #104 is fixed. | |
| 39 set ASYNC_COMPILER="%SDK_DIR%"\lib\_internal\pub\bin\async_compile.dart | |
| 40 "%DART%" --package-root="%PACKAGES_DIR%" "%ASYNC_COMPILER%" "%BUILD_DIR%" --sile nt | |
|
nweiz
2014/08/25 21:44:14
Long line (assuming there's a way to wrap this).
Bob Nystrom
2014/08/25 21:58:48
Done. It uses "^" of all things.
| |
| 41 | |
| 42 rem Run the async/await compiled pub. | |
| 43 set PUB="%BUILD_DIR%\pub_async\bin\pub.dart" | |
| 44 "%DART%" %VM_OPTIONS% --package-root="%PACKAGES_DIR%" "%PUB%" %* | |
| 38 | 45 |
| 39 endlocal | 46 endlocal |
| 40 | 47 |
| 41 exit /b %errorlevel% | 48 exit /b %errorlevel% |
| 42 | 49 |
| 43 :follow_links | 50 :follow_links |
| 44 setlocal | 51 setlocal |
| 45 for %%i in (%1) do set result=%%~fi | 52 for %%i in (%1) do set result=%%~fi |
| 46 set current= | 53 set current= |
| 47 for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^ | 54 for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^ |
| 48 ^| find "> %~n1 ["`) do ( | 55 ^| find "> %~n1 ["`) do ( |
| 49 set current=%%i | 56 set current=%%i |
| 50 ) | 57 ) |
| 51 if not "%current%"=="" call :follow_links "%current%", result | 58 if not "%current%"=="" call :follow_links "%current%", result |
| 52 endlocal & set %~2=%result% | 59 endlocal & set %~2=%result% |
| 53 goto :eof | 60 goto :eof |
| 54 | 61 |
| 55 :end | 62 :end |
| OLD | NEW |