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 function follow_links() { | |
12 while [ -h "$1" ]; do | |
13 # On Mac OS, readlink -f doesn't work. | |
14 1="$(readlink "$1")" | |
15 done | |
16 echo "$1" | |
17 } | |
18 | |
19 FOUND_BATCH=0 | 11 FOUND_BATCH=0 |
20 for ARG in "$@" | 12 for ARG in "$@" |
21 do | 13 do |
22 case $ARG in | 14 case $ARG in |
23 -batch|--batch) | 15 -batch|--batch) |
24 FOUND_BATCH=1 | 16 FOUND_BATCH=1 |
25 ;; | 17 ;; |
26 *) | 18 *) |
27 ;; | 19 ;; |
28 esac | 20 esac |
29 done | 21 done |
30 | 22 |
31 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 23 # Setting BIN_DIR this way is ugly, but is needed to handle the case where |
32 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 24 # dart-sdk/bin or the script itself has been symlinked to. On MacOS, readlink -f |
33 | 25 # doesn't work with this case. |
34 # Handle the case where the binary dir has been symlinked to. | 26 SCRIPT=`readlink "$0" || echo "$0"` |
35 CUR_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" | 27 CUR_DIR="$(cd "${SCRIPT%/*}" ; pwd -P)" |
36 | |
37 SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)" | 28 SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)" |
38 | 29 |
39 if [ -z "$DART_CONFIGURATION" ]; | 30 if [ -z "$DART_CONFIGURATION" ]; |
40 then | 31 then |
41 DART_CONFIGURATION="ReleaseIA32" | 32 DART_CONFIGURATION="ReleaseIA32" |
42 fi | 33 fi |
43 | 34 |
44 if [ `uname` == 'Darwin' ]; | 35 if [ `uname` == 'Darwin' ]; |
45 then | 36 then |
46 JAR_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer | 37 JAR_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer |
(...skipping 11 matching lines...) Expand all Loading... |
58 else | 49 else |
59 # On other architectures | 50 # On other architectures |
60 # -batch invocations will do better with a server vm | 51 # -batch invocations will do better with a server vm |
61 # invocations for analyzing a single file do better with a client vm | 52 # invocations for analyzing a single file do better with a client vm |
62 if [ $FOUND_BATCH -eq 0 ] ; then | 53 if [ $FOUND_BATCH -eq 0 ] ; then |
63 EXTRA_JVMARGS+=" -client " | 54 EXTRA_JVMARGS+=" -client " |
64 fi | 55 fi |
65 fi | 56 fi |
66 | 57 |
67 exec java $EXTRA_JVMARGS -jar $JAR_FILE --dart-sdk "$SDK_DIR" "$@" | 58 exec java $EXTRA_JVMARGS -jar $JAR_FILE --dart-sdk "$SDK_DIR" "$@" |
OLD | NEW |