| 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 function follow_links() { | 6 function follow_links() { |
| 7 while [ -h "$1" ]; do | 7 file="$1" |
| 8 while [ -h "$file" ]; do |
| 8 # On Mac OS, readlink -f doesn't work. | 9 # On Mac OS, readlink -f doesn't work. |
| 9 1="$(readlink "$1")" | 10 file="$(readlink "$file")" |
| 10 done | 11 done |
| 11 echo "$1" | 12 echo "$file" |
| 12 } | 13 } |
| 13 | 14 |
| 14 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 15 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| 15 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 16 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
| 16 | 17 |
| 17 # Handle the case where dart-sdk/bin has been symlinked to. | 18 # Handle the case where dart-sdk/bin has been symlinked to. |
| 18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" | 19 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| 19 | 20 |
| 20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 21 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| 21 | 22 |
| 22 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" | 23 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" |
| 23 | 24 |
| 24 DART="$BIN_DIR/dart" | 25 DART="$BIN_DIR/dart" |
| 25 | 26 |
| 26 SNAPSHOT_DIR="$BIN_DIR/snapshots" | 27 SNAPSHOT_DIR="$BIN_DIR/snapshots" |
| 27 SNAPSHOT="$SNAPSHOT_DIR/dart2js.dart.snapshot" | 28 SNAPSHOT="$SNAPSHOT_DIR/dart2js.dart.snapshot" |
| 28 | 29 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if [[ $DART_VM_OPTIONS ]]; then | 61 if [[ $DART_VM_OPTIONS ]]; then |
| 61 read -a OPTIONS <<< "$DART_VM_OPTIONS" | 62 read -a OPTIONS <<< "$DART_VM_OPTIONS" |
| 62 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") | 63 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") |
| 63 fi | 64 fi |
| 64 | 65 |
| 65 if test -f "$SNAPSHOT"; then | 66 if test -f "$SNAPSHOT"; then |
| 66 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" | 67 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" |
| 67 else | 68 else |
| 68 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | 69 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |
| 69 fi | 70 fi |
| OLD | NEW |