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 # Setting BIN_DIR this way is ugly, but is needed to handle the case where | 6 # Setting BIN_DIR this way is ugly, but is needed to handle the case where |
7 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work | 7 # dart-sdk/bin and/or dart-sdk/bin/pub has been symlinked to. On MacOS, readlink |
dgrove
2013/05/30 19:46:38
pub => dartdoc
nweiz
2013/05/30 20:01:26
Done.
| |
8 # with this case. | 8 # doesn't work with this case. |
9 BIN_DIR="$(cd "${0%/*}" ; pwd -P)" | 9 linked_path=`readlink "$0"` |
10 if [ "$linked_path" = "" ]; then | |
11 BIN_DIR="$(cd "${0%/*}" ; pwd -P)" | |
12 else | |
13 BIN_DIR="$(cd "${linked_path%/*}" ; pwd -P)" | |
dgrove
2013/05/30 19:46:38
I am not following what you're trying to do here.
nweiz
2013/05/30 20:01:26
If dart-sdk/bin/dartdoc is symlinked to, $0 will p
| |
14 fi | |
15 DART_SDK="$(cd "${BIN_DIR%/*}" ; pwd -P)" | |
dgrove
2013/05/30 19:46:38
what is this used for?
nweiz
2013/05/30 20:01:26
Left over from the pub script; removed.
| |
10 | 16 |
11 unset COLORS | 17 unset COLORS |
12 if test -t 1; then | 18 if test -t 1; then |
13 # Stdout is a terminal. | 19 # Stdout is a terminal. |
14 if test 8 -le `tput colors`; then | 20 if test 8 -le `tput colors`; then |
15 # Stdout has at least 8 colors, so enable colors. | 21 # Stdout has at least 8 colors, so enable colors. |
16 COLORS="--enable-diagnostic-colors" | 22 COLORS="--enable-diagnostic-colors" |
17 fi | 23 fi |
18 fi | 24 fi |
19 | 25 |
20 unset SNAPSHOT | 26 unset SNAPSHOT |
21 if test -f "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapshot"; then | 27 if test -f "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapshot"; then |
22 # TODO(ahe): Remove the following line when we are relatively sure it works. | 28 # TODO(ahe): Remove the following line when we are relatively sure it works. |
23 echo Using snapshot "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapsh ot" 1>&2 | 29 echo Using snapshot "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapsh ot" 1>&2 |
24 SNAPSHOT="--use-script-snapshot=$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc. dart.snapshot" | 30 SNAPSHOT="--use-script-snapshot=$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc. dart.snapshot" |
25 fi | 31 fi |
26 exec "$BIN_DIR"/dart --heap_growth_rate=32 "--package-root=$BIN_DIR/../packages/ " $SNAPSHOT "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart" "--package-root =$BIN_DIR/../packages/" $COLORS "$@" | 32 exec "$BIN_DIR"/dart --heap_growth_rate=32 "--package-root=$BIN_DIR/../packages/ " $SNAPSHOT "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart" "--package-root =$BIN_DIR/../packages/" $COLORS "$@" |
OLD | NEW |