| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 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 assumes the Dart SDK's directory |
| 7 # structure. | 7 # structure. |
| 8 | 8 |
| 9 # Setting BIN_DIR this way is ugly, but is needed to handle the case where | 9 # Setting BIN_DIR this way is ugly, but is needed to handle the case where |
| 10 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work | 10 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work |
| 11 # with this case. | 11 # with this case. |
| 12 BIN_DIR="$(cd "${0%/*}" ; pwd -P)" | 12 BIN_DIR="$(cd "${0%/*}" ; pwd -P)" |
| 13 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 13 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| 14 | 14 |
| 15 # Increase the heap size for Dart. Pub runs dart2js, which uses a lot of | |
| 16 # memory. | |
| 17 DART_FLAGS="--new_gen_heap_size=256 --old_gen_heap_size=1536" | |
| 18 | |
| 19 SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot" | 15 SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot" |
| 20 | 16 |
| 21 if test -f "$SNAPSHOT"; then | 17 if test -f "$SNAPSHOT"; then |
| 22 # We are running the snapshot in the built SDK. | 18 # We are running the snapshot in the built SDK. |
| 23 DART="$BIN_DIR/dart" | 19 DART="$BIN_DIR/dart" |
| 24 exec "$DART" "$DART_FLAGS" "$SNAPSHOT" "$@" | 20 exec "$DART" "$SNAPSHOT" "$@" |
| 25 else | 21 else |
| 26 # We are running pub from source in the development repo. | 22 # We are running pub from source in the development repo. |
| 27 if [ -z "$DART_CONFIGURATION" ]; | 23 if [ -z "$DART_CONFIGURATION" ]; |
| 28 then | 24 then |
| 29 DART_CONFIGURATION="ReleaseIA32" | 25 DART_CONFIGURATION="ReleaseIA32" |
| 30 fi | 26 fi |
| 31 | 27 |
| 32 if [[ `uname` == 'Darwin' ]]; | 28 if [[ `uname` == 'Darwin' ]]; |
| 33 then | 29 then |
| 34 BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION" | 30 BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION" |
| 35 else | 31 else |
| 36 BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION" | 32 BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION" |
| 37 fi | 33 fi |
| 38 | 34 |
| 39 # Use the Dart binary in the built SDK so pub can find the version file next | 35 # Use the Dart binary in the built SDK so pub can find the version file next |
| 40 # to it. | 36 # to it. |
| 41 DART="$BUILD_DIR/dart-sdk/bin/dart" | 37 DART="$BUILD_DIR/dart-sdk/bin/dart" |
| 42 PACKAGES_DIR="$BUILD_DIR/packages/" | 38 PACKAGES_DIR="$BUILD_DIR/packages/" |
| 43 | 39 |
| 44 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart" | 40 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart" |
| 45 | 41 |
| 46 exec "$DART" "$DART_FLAGS" "--package-root=$PACKAGES_DIR" "$PUB" "$@" | 42 exec "$DART" "--package-root=$PACKAGES_DIR" "$PUB" "$@" |
| 47 fi | 43 fi |
| OLD | NEW |