Chromium Code Reviews| 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 # The GNU version of readlink which has a -f option isn't available by default | |
| 7 # on Mac OS X. So we provide our own version. We try to avoid calling external | |
| 8 # programs such as dirname and readlink in the common case (not a symlink). The | |
| 9 # reason for this is that we notice an overhead in calling external programs and | |
| 10 # this affects script startup time which becomes notiable when running many | |
| 11 # compilations in parallel (as it happens, for example, during testing). | |
| 6 function follow_links() { | 12 function follow_links() { |
| 7 file="$1" | 13 file="$1" |
| 8 while [ -h "$file" ]; do | 14 while [ -h "$file" ]; do |
|
kustermann
2013/12/06 13:50:41
I think, this doesn't work in all cases, e.g.
/ho
| |
| 9 # On Mac OS, readlink -f doesn't work. | 15 target="$(readlink "$file")" |
| 10 file="$(readlink "$file")" | 16 if [[ "$target" != /* ]]; then |
|
kustermann
2013/12/06 13:50:41
What does this do?
| |
| 17 target="$(dirname "$file")/$target" | |
| 18 fi | |
| 19 file="$target" | |
| 11 done | 20 done |
| 21 # Make sure that ${foo%/*} can be used instead of dirname. | |
| 22 if [ "${file%/*}" = "$file" ]; then | |
| 23 file="./$file" | |
| 24 fi | |
|
kustermann
2013/12/06 13:50:41
Why is that necessary?
(IMHO, a function follow_l
| |
| 12 echo "$file" | 25 echo "$file" |
| 13 } | 26 } |
| 14 | 27 |
| 15 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 28 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| 16 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 29 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
| 17 | 30 |
| 18 # Handle the case where dart-sdk/bin has been symlinked to. | 31 # Handle the case where dart-sdk/bin has been symlinked to. |
| 19 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 32 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| 20 | 33 |
| 21 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 34 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 if [[ $DART_VM_OPTIONS ]]; then | 74 if [[ $DART_VM_OPTIONS ]]; then |
| 62 read -a OPTIONS <<< "$DART_VM_OPTIONS" | 75 read -a OPTIONS <<< "$DART_VM_OPTIONS" |
| 63 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") | 76 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") |
| 64 fi | 77 fi |
| 65 | 78 |
| 66 if test -f "$SNAPSHOT"; then | 79 if test -f "$SNAPSHOT"; then |
| 67 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" | 80 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" |
| 68 else | 81 else |
| 69 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | 82 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |
| 70 fi | 83 fi |
| OLD | NEW |