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 while [ -h "$1" ]; do |
8 # On Mac OS, readlink -f doesn't work. | 8 # On Mac OS, readlink -f doesn't work. |
9 1="$(readlink "$1")" | 9 1="$(readlink "$1")" |
10 done | 10 done |
11 echo "$1" | 11 echo "$1" |
12 } | 12 } |
13 | 13 |
14 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 14 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
15 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 15 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
16 | 16 |
17 # Handle the case where dart-sdk/bin has been symlinked to. | 17 # Handle the case where dart-sdk/bin has been symlinked to. |
18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" | 18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" |
19 | 19 |
20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
21 | 21 |
22 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" | 22 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" |
23 | 23 |
24 DART="$BIN_DIR/dart" | 24 DART="$BIN_DIR/dart" |
25 | 25 |
26 SNAPSHOT_DIR="$BIN_DIR/snapshots" | 26 SNAPSHOT_DIR="$BIN_DIR/snapshots" |
27 SNAPSHOT="$SNAPSHOT_DIR/utils_wrapper.dart.snapshot" | 27 SNAPSHOT="$SNAPSHOT_DIR/dart2js.dart.snapshot" |
28 | 28 |
29 unset EXTRA_OPTIONS | 29 unset EXTRA_OPTIONS |
30 declare -a EXTRA_OPTIONS | 30 declare -a EXTRA_OPTIONS |
31 | 31 |
32 if test -t 1; then | 32 if test -t 1; then |
33 # Stdout is a terminal. | 33 # Stdout is a terminal. |
34 if test 8 -le `tput colors`; then | 34 if test 8 -le `tput colors`; then |
35 # Stdout has at least 8 colors, so enable colors. | 35 # Stdout has at least 8 colors, so enable colors. |
36 EXTRA_OPTIONS[${#EXTRA_OPTIONS[@]}]='--enable-diagnostic-colors' | 36 EXTRA_OPTIONS[${#EXTRA_OPTIONS[@]}]='--enable-diagnostic-colors' |
37 fi | 37 fi |
(...skipping 12 matching lines...) Expand all Loading... |
50 # TODO(ahe): Remove this option (http://dartbug.com/6495). | 50 # TODO(ahe): Remove this option (http://dartbug.com/6495). |
51 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--heap_growth_rate=512' | 51 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--heap_growth_rate=512' |
52 | 52 |
53 case $0 in | 53 case $0 in |
54 *_developer) | 54 *_developer) |
55 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--checked' | 55 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--checked' |
56 ;; | 56 ;; |
57 esac | 57 esac |
58 | 58 |
59 if test -f "$SNAPSHOT"; then | 59 if test -f "$SNAPSHOT"; then |
60 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "dart2js" \ | 60 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" |
61 "${EXTRA_OPTIONS[@]}" "$@" | |
62 else | 61 else |
63 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | 62 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |
64 fi | 63 fi |
OLD | NEW |