Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
|
nweiz
2014/08/22 19:29:15
Don't we need to do this for pub.cmd as well? Othe
Bob Nystrom
2014/08/25 17:40:00
Yes, I'll do the Windows side of things in a separ
| |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 # Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory | 6 # Run pub.dart on the Dart VM. This script is only used when running pub from |
| 7 # structure. | 7 # within the Dart source repo. The shipped SDK instead uses "pub_sdk", which is |
| 8 # renamed to "pub" when the SDK is built. | |
| 8 | 9 |
| 9 function follow_links() { | 10 function follow_links() { |
| 10 file="$1" | 11 file="$1" |
| 11 while [ -h "$file" ]; do | 12 while [ -h "$file" ]; do |
| 12 # On Mac OS, readlink -f doesn't work. | 13 # On Mac OS, readlink -f doesn't work. |
| 13 file="$(readlink "$file")" | 14 file="$(readlink "$file")" |
| 14 done | 15 done |
| 15 echo "$file" | 16 echo "$file" |
| 16 } | 17 } |
| 17 | 18 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 31 # Give the VM extra memory for dart2js. | 32 # Give the VM extra memory for dart2js. |
| 32 # TODO(rnystrom): Remove when #8355 is fixed. | 33 # TODO(rnystrom): Remove when #8355 is fixed. |
| 33 VM_OPTIONS+=("--old_gen_heap_size=1024") | 34 VM_OPTIONS+=("--old_gen_heap_size=1024") |
| 34 | 35 |
| 35 # Allow extra VM options to be passed in through an environment variable. | 36 # Allow extra VM options to be passed in through an environment variable. |
| 36 if [[ $DART_VM_OPTIONS ]]; then | 37 if [[ $DART_VM_OPTIONS ]]; then |
| 37 read -a OPTIONS <<< "$DART_VM_OPTIONS" | 38 read -a OPTIONS <<< "$DART_VM_OPTIONS" |
| 38 VM_OPTIONS+=("${OPTIONS[@]}") | 39 VM_OPTIONS+=("${OPTIONS[@]}") |
| 39 fi | 40 fi |
| 40 | 41 |
| 41 if test -f "$SNAPSHOT"; then | 42 if [ -z "$DART_CONFIGURATION" ]; |
| 42 # We are running the snapshot in the built SDK. | 43 then |
| 43 DART="$BIN_DIR/dart" | 44 DART_CONFIGURATION="ReleaseIA32" |
| 44 exec "$DART" "${VM_OPTIONS[@]}" "$SNAPSHOT" "$@" | 45 fi |
| 46 | |
| 47 if [[ `uname` == 'Darwin' ]]; | |
| 48 then | |
| 49 BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION" | |
| 45 else | 50 else |
| 46 # We are running pub from source in the development repo. | 51 BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION" |
| 47 if [ -z "$DART_CONFIGURATION" ]; | 52 fi |
| 48 then | |
| 49 DART_CONFIGURATION="ReleaseIA32" | |
| 50 fi | |
| 51 | 53 |
| 52 if [[ `uname` == 'Darwin' ]]; | 54 # Use the Dart binary in the built SDK so pub can find the version file next |
| 53 then | 55 # to it. |
| 54 BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION" | 56 DART="$BUILD_DIR/dart-sdk/bin/dart" |
| 55 else | 57 PACKAGES_DIR="$BUILD_DIR/pub_packages/" |
| 56 BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION" | |
| 57 fi | |
| 58 | 58 |
| 59 # Use the Dart binary in the built SDK so pub can find the version file next | 59 # Compile async/await down to vanilla Dart. |
| 60 # to it. | 60 # TODO(rnystrom): Remove this when #104 is fixed. |
| 61 DART="$BUILD_DIR/dart-sdk/bin/dart" | 61 ASYNC_COMPILER="$SDK_DIR/lib/_internal/pub/bin/async_compile.dart" |
| 62 PACKAGES_DIR="$BUILD_DIR/pub_packages/" | 62 "$DART" "--package-root=$PACKAGES_DIR" "$ASYNC_COMPILER" "$BUILD_DIR" --silent |
| 63 | 63 |
| 64 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart" | 64 # Run the async/await compiled pub. |
| 65 | 65 PUB="$BUILD_DIR/pub_async/bin/pub.dart" |
| 66 exec "$DART" "${VM_OPTIONS[@]}" "--package-root=$PACKAGES_DIR" "$PUB" "$@" | 66 exec "$DART" "${VM_OPTIONS[@]}" "--package-root=$PACKAGES_DIR" "$PUB" "$@" |
| 67 fi | |
| OLD | NEW |