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