| OLD | NEW |
| 1 #!/bin/bash --posix | 1 #!/bin/bash --posix |
| 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2013, 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 set -e | 6 set -e |
| 7 | 7 |
| 8 function follow_links() { | 8 PROG_NAME=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && \ |
| 9 file="$1" | 9 PROG_NAME=$PROG_NAME/$(basename -- "$0") |
| 10 while [ -h "$file" ]; do | |
| 11 # On Mac OS, readlink -f doesn't work. | |
| 12 file="$(readlink "$file")" | |
| 13 done | |
| 14 echo "$file" | |
| 15 } | |
| 16 | 10 |
| 17 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 11 # resolve symlinks |
| 18 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 12 while [ -h $PROG_NAME ]; do |
| 13 DIR=$(dirname -- "$PROG_NAME") |
| 14 SYM=$(readlink $PROG_NAME) |
| 15 PROG_NAME=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") |
| 16 done |
| 19 | 17 |
| 20 # Handle the case where dart-sdk/bin has been symlinked to. | 18 # Handle the case where dart-sdk/bin has been symlinked to. |
| 21 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 19 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| 22 | 20 |
| 23 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" | 21 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" |
| 24 | 22 |
| 25 FOUND_BATCH=0 | 23 FOUND_BATCH=0 |
| 26 FOUND_SDK=0 | 24 FOUND_SDK=0 |
| 27 for ARG in "$@" | 25 for ARG in "$@" |
| 28 do | 26 do |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 # On other architectures | 79 # On other architectures |
| 82 # -batch invocations will do better with a server vm | 80 # -batch invocations will do better with a server vm |
| 83 # invocations for analyzing a single file do better with a client vm | 81 # invocations for analyzing a single file do better with a client vm |
| 84 if [ $FOUND_BATCH -eq 0 ] ; then | 82 if [ $FOUND_BATCH -eq 0 ] ; then |
| 85 EXTRA_JVMARGS+=" -client " | 83 EXTRA_JVMARGS+=" -client " |
| 86 fi | 84 fi |
| 87 fi | 85 fi |
| 88 | 86 |
| 89 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \ | 87 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \ |
| 90 "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@ | 88 "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@ |
| OLD | NEW |