OLD | NEW |
| (Empty) |
1 #!/bin/bash --posix | |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
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. | |
5 | |
6 set -e | |
7 | |
8 SCRIPT_DIR=$(dirname $0) | |
9 DART_ANALYZER_HOME=$(dirname $SCRIPT_DIR) | |
10 | |
11 FOUND_BATCH=0 | |
12 FOUND_SDK=0 | |
13 for ARG in "$@" | |
14 do | |
15 case $ARG in | |
16 -batch|--batch) | |
17 FOUND_BATCH=1 | |
18 ;; | |
19 --dart-sdk) | |
20 FOUND_SDK=1 | |
21 ;; | |
22 *) | |
23 ;; | |
24 esac | |
25 done | |
26 | |
27 DART_SDK="" | |
28 if [ $FOUND_SDK = 0 ] ; then | |
29 if [ -f $DART_ANALYZER_HOME/lib/core/core_runtime.dart ] ; then | |
30 DART_SDK="--dart-sdk $DART_ANALYZER_HOME" | |
31 else | |
32 DART_ANALYZER_HOME=$(dirname $DART_ANALYZER_HOME)/dart-sdk | |
33 if [ -d $DART_ANALYZER_HOME ] ; then | |
34 DART_SDK="--dart-sdk $DART_ANALYZER_HOME" | |
35 else | |
36 echo "Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument" | |
37 fi | |
38 fi | |
39 fi | |
40 | |
41 DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/analyzer | |
42 | |
43 if [ -x /usr/libexec/java_home ]; then | |
44 export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+') | |
45 fi | |
46 | |
47 EXTRA_JVMARGS="-Xss2M " | |
48 OS=`uname | tr [A-Z] [a-z]` | |
49 if [ "$OS" == "darwin" ] ; then | |
50 # Bump up the heap on Mac VMs, some of which default to 128M or less. | |
51 # Users can specify DART_JVMARGS in the environment to override | |
52 # this setting. Force to 32 bit client vm. 64 bit and server VM make for | |
53 # poor performance. | |
54 EXTRA_JVMARGS+=" -Xmx256M -client -d32 " | |
55 else | |
56 # On other architectures | |
57 # -batch invocations will do better with a server vm | |
58 # invocations for analyzing a single file do better with a client vm | |
59 if [ $FOUND_BATCH = 0 ] ; then | |
60 EXTRA_JVMARGS+=" -client " | |
61 fi | |
62 fi | |
63 | |
64 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -classpath "@CLASSPATH@" \ | |
65 com.google.dart.compiler.DartCompiler ${DART_SDK} $@ | |
OLD | NEW |