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 # Setting BIN_DIR this way is ugly, but is needed to handle the case where |
7 while [ -h "$1" ]; do | 7 # dart-sdk/bin or the script itself has been symlinked to. On MacOS, readlink -f |
8 # On Mac OS, readlink -f doesn't work. | 8 # doesn't work with this case. |
9 1="$(readlink "$1")" | 9 SCRIPT=`readlink "$0" || echo "$0"` |
ahe
2013/11/12 10:14:43
This is a bug: it should be something like:
funct
nweiz
2013/11/12 20:26:40
Done.
|
ahe
2013/11/12 10:14:43
Unlike $0, $BASH_SOURCE points to this file. This
ahe
2013/11/12 10:16:01
... is a symlink to a symlink itself.
nweiz
2013/11/12 20:26:40
Done.
|
10 done | 10 BIN_DIR="$(cd "${SCRIPT%/*}" ; pwd -P)" |
11 echo "$1" | |
12 } | |
13 | |
14 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | |
15 PROG_NAME="$(follow_links "$BASH_SOURCE")" | |
16 | |
17 # Handle the case where dart-sdk/bin has been symlinked to. | |
18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" | |
ahe
2013/11/12 10:14:43
I guess follow_links is unnecessary here.
nweiz
2013/11/12 20:26:40
Done.
| |
19 | |
20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 11 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
21 | 12 |
22 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" | 13 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" |
23 | 14 |
24 DART="$BIN_DIR/dart" | 15 DART="$BIN_DIR/dart" |
25 | 16 |
26 SNAPSHOT_DIR="$BIN_DIR/snapshots" | 17 SNAPSHOT_DIR="$BIN_DIR/snapshots" |
27 SNAPSHOT="$SNAPSHOT_DIR/dart2js.dart.snapshot" | 18 SNAPSHOT="$SNAPSHOT_DIR/dart2js.dart.snapshot" |
28 | 19 |
29 unset EXTRA_OPTIONS | 20 unset EXTRA_OPTIONS |
(...skipping 30 matching lines...) Expand all Loading... | |
60 if [[ $DART_VM_OPTIONS ]]; then | 51 if [[ $DART_VM_OPTIONS ]]; then |
61 read -a OPTIONS <<< "$DART_VM_OPTIONS" | 52 read -a OPTIONS <<< "$DART_VM_OPTIONS" |
62 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") | 53 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") |
63 fi | 54 fi |
64 | 55 |
65 if test -f "$SNAPSHOT"; then | 56 if test -f "$SNAPSHOT"; then |
66 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" | 57 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" |
67 else | 58 else |
68 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | 59 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |
69 fi | 60 fi |
OLD | NEW |