OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2014, 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 . ${BASH_SOURCE%_developer} |
7 # It is a simple wrapper enabling us to have simpler command lines in | |
8 # the testing infrastructure. | |
9 set -e | |
10 | |
11 FOUND_BATCH=0 | |
12 for ARG in "$@" | |
13 do | |
14 case $ARG in | |
15 -batch|--batch) | |
16 FOUND_BATCH=1 | |
17 ;; | |
18 *) | |
19 ;; | |
20 esac | |
21 done | |
22 | |
23 function follow_links() { | |
24 file="$1" | |
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 | |
32 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | |
33 PROG_NAME="$(follow_links "$BASH_SOURCE")" | |
34 | |
35 # Handle the case where dart-sdk/bin has been symlinked to. | |
36 CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | |
37 | |
38 SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)" | |
39 | |
40 if [ -z "$DART_CONFIGURATION" ]; | |
41 then | |
42 DART_CONFIGURATION="ReleaseIA32" | |
43 fi | |
44 | |
45 if [ `uname` == 'Darwin' ]; | |
46 then | |
47 JAR_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer | |
48 else | |
49 JAR_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION/dartanalyzer | |
50 fi | |
51 | |
52 JAR_FILE="$JAR_DIR/dartanalyzer.jar" | |
53 | |
54 EXTRA_JVMARGS="-Xss2M " | |
55 OS=`uname | tr "[A-Z]" "[a-z]"` | |
56 if [ "$OS" == "darwin" ] ; then | |
57 # Bump up the heap on Mac VMs, some of which default to 128M or less. | |
58 EXTRA_JVMARGS+=" -Xmx512M -client " | |
59 else | |
60 # On other architectures | |
61 # -batch invocations will do better with a server vm | |
62 # invocations for analyzing a single file do better with a client vm | |
63 if [ $FOUND_BATCH -eq 0 ] ; then | |
64 EXTRA_JVMARGS+=" -client " | |
65 fi | |
66 fi | |
67 | |
68 exec java $EXTRA_JVMARGS -jar "$JAR_FILE" --dart-sdk "$SDK_DIR" "$@" | |
OLD | NEW |