| OLD | NEW |
| 1 #!/bin/bash --posix | 1 #!/bin/bash --posix |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 SCRIPT_DIR=$(dirname $0) | 8 # Setting SCRIPT_DIR this way is ugly, but is needed to handle the case where |
| 9 DART_ANALYZER_HOME=$(dirname $SCRIPT_DIR) | 9 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work |
| 10 # with this case. |
| 11 SCRIPT_DIR="$(cd "${0%/*}" ; pwd -P)" |
| 12 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" |
| 10 | 13 |
| 11 FOUND_BATCH=0 | 14 FOUND_BATCH=0 |
| 12 FOUND_SDK=0 | 15 FOUND_SDK=0 |
| 13 for ARG in "$@" | 16 for ARG in "$@" |
| 14 do | 17 do |
| 15 case $ARG in | 18 case $ARG in |
| 16 -batch|--batch) | 19 -batch|--batch) |
| 17 FOUND_BATCH=1 | 20 FOUND_BATCH=1 |
| 18 ;; | 21 ;; |
| 19 --dart-sdk) | 22 --dart-sdk) |
| 20 FOUND_SDK=1 | 23 FOUND_SDK=1 |
| 21 ;; | 24 ;; |
| 22 *) | 25 *) |
| 23 ;; | 26 ;; |
| 24 esac | 27 esac |
| 25 done | 28 done |
| 26 | 29 |
| 27 DART_SDK="" | 30 DART_SDK="" |
| 28 if [ $FOUND_SDK = 0 ] ; then | 31 if [ $FOUND_SDK = 0 ] ; then |
| 29 if [ -f $DART_ANALYZER_HOME/lib/core/core_runtime.dart ] ; then | 32 if [ -f $DART_ANALYZER_HOME/lib/core/core.dart ] ; then |
| 30 DART_SDK="--dart-sdk $DART_ANALYZER_HOME" | 33 DART_SDK="--dart-sdk $DART_ANALYZER_HOME" |
| 31 else | 34 else |
| 32 DART_SDK_HOME=$(dirname $DART_ANALYZER_HOME)/dart-sdk | 35 DART_SDK_HOME=$(dirname $DART_ANALYZER_HOME)/dart-sdk |
| 33 if [ -d $DART_SDK_HOME ] ; then | 36 if [ -d $DART_SDK_HOME ] ; then |
| 34 DART_SDK="--dart-sdk $DART_SDK_HOME" | 37 DART_SDK="--dart-sdk $DART_SDK_HOME" |
| 35 else | 38 else |
| 36 DART_SDK_HOME=$(dirname $DART_SDK_HOME)/dart-sdk | 39 DART_SDK_HOME=$(dirname $DART_SDK_HOME)/dart-sdk |
| 37 if [ -d $DART_SDK_HOME ] ; then | 40 if [ -d $DART_SDK_HOME ] ; then |
| 38 DART_SDK="--dart-sdk $DART_SDK_HOME" | 41 DART_SDK="--dart-sdk $DART_SDK_HOME" |
| 39 else | 42 else |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 # On other architectures | 70 # On other architectures |
| 68 # -batch invocations will do better with a server vm | 71 # -batch invocations will do better with a server vm |
| 69 # invocations for analyzing a single file do better with a client vm | 72 # invocations for analyzing a single file do better with a client vm |
| 70 if [ $FOUND_BATCH = 0 ] ; then | 73 if [ $FOUND_BATCH = 0 ] ; then |
| 71 EXTRA_JVMARGS+=" -client " | 74 EXTRA_JVMARGS+=" -client " |
| 72 fi | 75 fi |
| 73 fi | 76 fi |
| 74 | 77 |
| 75 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -classpath "@CLASSPATH@" \ | 78 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -classpath "@CLASSPATH@" \ |
| 76 com.google.dart.compiler.DartCompiler ${DART_SDK} $@ | 79 com.google.dart.compiler.DartCompiler ${DART_SDK} $@ |
| OLD | NEW |