OLD | NEW |
1 #!/bin/bash --posix | 1 #!/bin/bash --posix |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 # Prevent problems where the caller has exported CLASSPATH, causing our | 8 # Prevent problems where the caller has exported CLASSPATH, causing our |
9 # computed value to be copied into the environment and double-counted | 9 # computed value to be copied into the environment and double-counted |
10 # against the argv limit. | 10 # against the argv limit. |
11 unset CLASSPATH | 11 unset CLASSPATH |
12 | 12 |
13 # Figure out where the dartc home is | 13 # Figure out where the dartc home is |
14 SCRIPT_DIR=`dirname $0` | 14 SCRIPT_DIR=`dirname $0` |
15 DARTC_HOME=`cd $SCRIPT_DIR; pwd` | 15 DARTA_HOME=`cd $SCRIPT_DIR; pwd` |
16 DIST_DIR=$DARTC_HOME/compiler | 16 DIST_DIR=$DARTA_HOME/compiler |
17 DARTC_LIBS=$DIST_DIR/lib | |
18 | 17 |
19 DARTC_FLAGS="" | 18 DARTA_FLAGS="" |
20 | 19 |
21 # Make it easy to insert 'set -x' or similar commands when debugging problems wi
th this script. | 20 # Make it easy to insert 'set -x' or similar commands when debugging problems wi
th this script. |
22 eval "$JAVA_STUB_DEBUG" | 21 eval "$JAVA_STUB_DEBUG" |
23 | 22 |
24 JVM_FLAGS_CMDLINE="" | 23 JVM_FLAGS_CMDLINE="" |
25 | 24 |
26 while [ ! -z "$1" ]; do | 25 while [ ! -z "$1" ]; do |
27 case "$1" in | 26 case "$1" in |
28 --prof) | 27 --prof) |
29 # Ensure the preset -optimize flag is gone when profiling. | 28 # Ensure the preset -optimize flag is gone when profiling. |
30 DARTC_FLAGS="--prof" | 29 DARTA_FLAGS="--prof" |
31 shift ;; | 30 shift ;; |
32 --debug) | 31 --debug) |
33 JVM_DEBUG_PORT=${DEFAULT_JVM_DEBUG_PORT:-"5005"} | 32 JVM_DEBUG_PORT=${DEFAULT_JVM_DEBUG_PORT:-"5005"} |
34 shift ;; | 33 shift ;; |
35 --debug=*) | 34 --debug=*) |
36 JVM_DEBUG_PORT=${1/--debug=/} | 35 JVM_DEBUG_PORT=${1/--debug=/} |
37 shift ;; | 36 shift ;; |
38 --jvm_flags=*) | 37 --jvm_flags=*) |
39 JVM_FLAGS_CMDLINE="$JVM_FLAGS_CMDLINE ${1/--jvm_flags=/}" | 38 JVM_FLAGS_CMDLINE="$JVM_FLAGS_CMDLINE ${1/--jvm_flags=/}" |
40 shift ;; | 39 shift ;; |
41 *) break ;; | 40 *) break ;; |
42 esac | 41 esac |
43 done | 42 done |
44 | 43 |
45 if [ "$JVM_DEBUG_PORT" != "" ]; then | 44 if [ "$JVM_DEBUG_PORT" != "" ]; then |
46 JVM_DEBUG_SUSPEND=${DEFAULT_JVM_DEBUG_SUSPEND:-"y"} | 45 JVM_DEBUG_SUSPEND=${DEFAULT_JVM_DEBUG_SUSPEND:-"y"} |
47 JVM_DEBUG_FLAGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=${JVM_DEB
UG_SUSPEND},address=${JVM_DEBUG_PORT}" | 46 JVM_DEBUG_FLAGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=${JVM_DEB
UG_SUSPEND},address=${JVM_DEBUG_PORT}" |
48 fi | 47 fi |
49 | 48 |
50 shopt -s execfail # Return control to this script if exec fails. | 49 shopt -s execfail # Return control to this script if exec fails. |
51 exec $JAVABIN -ea -classpath @CLASSPATH@ \ | 50 exec $JAVABIN -ea -classpath @CLASSPATH@ \ |
52 ${JVM_DEBUG_FLAGS} \ | 51 ${JVM_DEBUG_FLAGS} \ |
53 ${JVM_FLAGS} \ | 52 ${JVM_FLAGS} \ |
54 ${JVM_FLAGS_CMDLINE} \ | 53 ${JVM_FLAGS_CMDLINE} \ |
55 com.google.dart.compiler.DartCompiler \ | 54 com.google.dart.compiler.DartCompiler \ |
56 $DARTC_FLAGS \ | 55 $DARTA_FLAGS \ |
57 "$@" | 56 "$@" |
58 | 57 |
59 echo "ERROR: couldn't exec ${JAVABIN}." 1>&2 | 58 echo "ERROR: couldn't exec ${JAVABIN}." 1>&2 |
60 | 59 |
61 exit 1 | 60 exit 1 |
OLD | NEW |