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