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 # Setting SCRIPT_DIR this way is ugly, but is needed to handle the case where | 8 function follow_links() { |
9 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work | 9 file="$1" |
10 # with this case. | 10 while [ -h "$file" ]; do |
11 SCRIPT_DIR="$(cd "${0%/*}" ; pwd -P)" | 11 # On Mac OS, readlink -f doesn't work. |
| 12 file="$(readlink "$file")" |
| 13 done |
| 14 echo "$file" |
| 15 } |
| 16 |
| 17 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| 18 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
| 19 |
| 20 # Handle the case where dart-sdk/bin has been symlinked to. |
| 21 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| 22 |
12 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" | 23 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" |
13 | 24 |
14 FOUND_BATCH=0 | 25 FOUND_BATCH=0 |
15 FOUND_SDK=0 | 26 FOUND_SDK=0 |
16 for ARG in "$@" | 27 for ARG in "$@" |
17 do | 28 do |
18 case $ARG in | 29 case $ARG in |
19 -batch|--batch) | 30 -batch|--batch) |
20 FOUND_BATCH=1 | 31 FOUND_BATCH=1 |
21 ;; | 32 ;; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 # On other architectures | 81 # On other architectures |
71 # -batch invocations will do better with a server vm | 82 # -batch invocations will do better with a server vm |
72 # invocations for analyzing a single file do better with a client vm | 83 # invocations for analyzing a single file do better with a client vm |
73 if [ $FOUND_BATCH -eq 0 ] ; then | 84 if [ $FOUND_BATCH -eq 0 ] ; then |
74 EXTRA_JVMARGS+=" -client " | 85 EXTRA_JVMARGS+=" -client " |
75 fi | 86 fi |
76 fi | 87 fi |
77 | 88 |
78 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \ | 89 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \ |
79 "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@ | 90 "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@ |
OLD | NEW |