| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 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 # This file is used to execute the analyzer by running the jar file. | 6 # This file is used to execute the analyzer by running the jar file. |
| 7 # It is a simple wrapper enabling us to have simpler command lines in | 7 # It is a simple wrapper enabling us to have simpler command lines in |
| 8 # the testing infrastructure. | 8 # the testing infrastructure. |
| 9 set -e | 9 set -e |
| 10 | 10 |
| 11 FOUND_BATCH=0 | 11 FOUND_BATCH=0 |
| 12 for ARG in "$@" | 12 for ARG in "$@" |
| 13 do | 13 do |
| 14 case $ARG in | 14 case $ARG in |
| 15 -batch|--batch) | 15 -batch|--batch) |
| 16 FOUND_BATCH=1 | 16 FOUND_BATCH=1 |
| 17 ;; | 17 ;; |
| 18 *) | 18 *) |
| 19 ;; | 19 ;; |
| 20 esac | 20 esac |
| 21 done | 21 done |
| 22 | 22 |
| 23 function follow_links() { | 23 PROG_NAME=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && \ |
| 24 file="$1" | 24 PROG_NAME=$PROG_NAME/$(basename -- "$0") |
| 25 while [ -h "$file" ]; do | |
| 26 # On Mac OS, readlink -f doesn't work. | |
| 27 file="$(readlink "$file")" | |
| 28 done | |
| 29 echo "$file" | |
| 30 } | |
| 31 | 25 |
| 32 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 26 # resolve symlinks |
| 33 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 27 while [ -h $PROG_NAME ]; do |
| 28 DIR=$(dirname -- "$PROG_NAME") |
| 29 SYM=$(readlink $PROG_NAME) |
| 30 PROG_NAME=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") |
| 31 done |
| 34 | 32 |
| 35 # Handle the case where dart-sdk/bin has been symlinked to. | 33 # Handle the case where dart-sdk/bin has been symlinked to. |
| 36 CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 34 CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| 37 | 35 |
| 38 SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)" | 36 SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)" |
| 39 | 37 |
| 40 if [ -z "$DART_CONFIGURATION" ]; | 38 if [ -z "$DART_CONFIGURATION" ]; |
| 41 then | 39 then |
| 42 DART_CONFIGURATION="ReleaseIA32" | 40 DART_CONFIGURATION="ReleaseIA32" |
| 43 fi | 41 fi |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 else | 57 else |
| 60 # On other architectures | 58 # On other architectures |
| 61 # -batch invocations will do better with a server vm | 59 # -batch invocations will do better with a server vm |
| 62 # invocations for analyzing a single file do better with a client vm | 60 # invocations for analyzing a single file do better with a client vm |
| 63 if [ $FOUND_BATCH -eq 0 ] ; then | 61 if [ $FOUND_BATCH -eq 0 ] ; then |
| 64 EXTRA_JVMARGS+=" -client " | 62 EXTRA_JVMARGS+=" -client " |
| 65 fi | 63 fi |
| 66 fi | 64 fi |
| 67 | 65 |
| 68 exec java $EXTRA_JVMARGS -jar $JAR_FILE --dart-sdk "$SDK_DIR" "$@" | 66 exec java $EXTRA_JVMARGS -jar $JAR_FILE --dart-sdk "$SDK_DIR" "$@" |
| OLD | NEW |