Chromium Code Reviews| Index: sdk/bin/dartanalyzer |
| diff --git a/sdk/bin/dartanalyzer b/sdk/bin/dartanalyzer |
| index 740332f2ebee679a2a32022793a4664d082d36b3..7c6977c69eb85e16f62fff4eeeceeb7f660a9ce6 100755 |
| --- a/sdk/bin/dartanalyzer |
| +++ b/sdk/bin/dartanalyzer |
| @@ -1,9 +1,10 @@ |
| -#!/bin/bash --posix |
| +#!/bin/bash |
| # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| # for details. All rights reserved. Use of this source code is governed by a |
| # BSD-style license that can be found in the LICENSE file. |
| -set -e |
| +# Run dartanalyzer.dart on the Dart VM. This script assumes the Dart SDK's directory |
|
ahe
2014/04/22 09:38:13
Long line.
danrubel
2014/04/22 18:37:54
Done.
|
| +# structure. |
| function follow_links() { |
| file="$1" |
| @@ -18,73 +19,33 @@ function follow_links() { |
| PROG_NAME="$(follow_links "$BASH_SOURCE")" |
| # Handle the case where dart-sdk/bin has been symlinked to. |
| -SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| +BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| -DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" |
| +SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| -FOUND_BATCH=0 |
| -FOUND_SDK=0 |
| -for ARG in "$@" |
| -do |
| - case $ARG in |
| - -batch|--batch) |
| - FOUND_BATCH=1 |
| - ;; |
| - --dart-sdk) |
| - FOUND_SDK=1 |
| - ;; |
| - *) |
| - ;; |
| - esac |
| -done |
| +SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot" |
| -DART_SDK="" |
| -if [ $FOUND_SDK -eq 0 ] ; then |
| - if [ -f "$DART_ANALYZER_HOME/lib/core/core.dart" ] ; then |
| - DART_SDK=(--dart-sdk "$DART_ANALYZER_HOME") |
| - else |
| - DART_SDK_HOME=$(dirname "$DART_ANALYZER_HOME")/dart-sdk |
| - if [ -d "$DART_SDK_HOME" ] ; then |
| - DART_SDK=(--dart-sdk "$DART_SDK_HOME") |
| - else |
| - DART_SDK_HOME=$(dirname "$DART_SDK_HOME")/dart-sdk |
| - if [ -d "$DART_SDK_HOME" ] ; then |
| - DART_SDK=(--dart-sdk "$DART_SDK_HOME") |
| - else |
| - echo "Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument" |
| - fi |
| - fi |
| +if test -f "$SNAPSHOT"; then |
| + # We are running the snapshot in the built SDK. |
| + DART="$BIN_DIR/dart" |
| + exec "$DART" "$SNAPSHOT" "$@" |
| +else |
| + # We are running dartanalyzer from source in the development repo. |
| + if [ -z "$DART_CONFIGURATION" ]; |
| + then |
| + DART_CONFIGURATION="ReleaseIA32" |
| fi |
| -fi |
| -if [ -f "$DART_SDK_HOME/util/dartanalyzer/dartanalyzer.jar" ] ; then |
| - DART_ANALYZER_LIBS=$DART_SDK_HOME/util/dartanalyzer |
| -elif [ -f "$DART_ANALYZER_HOME/util/dartanalyzer/dartanalyzer.jar" ] ; then |
| - DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/dartanalyzer |
| -else |
| - echo "Configuration problem. Couldn't find dartanalyzer.jar." |
| - exit 1 |
| -fi |
| + if [[ `uname` == 'Darwin' ]]; |
| + then |
| + BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION" |
| + else |
| + BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION" |
|
ahe
2014/04/22 09:38:13
Why do you need this code? dart2js doesn't. There
danrubel
2014/04/22 18:37:54
There are two modes supported here.
1) In a "produ
ahe
2014/04/23 09:15:05
Yes. That's because nobody asked my opinion.
Ther
danrubel
2014/04/29 16:10:39
Good point. It's probably in pub and dartfmt for h
|
| + fi |
| -if [ -x /usr/libexec/java_home ]; then |
| - export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+') |
| -fi |
| + DART="$BUILD_DIR/dart-sdk/bin/dart" |
| + PKG_DIR="$BUILD_DIR/packages" |
| + DARTANALYZER="$SDK_DIR/../pkg/analyzer/bin/analyzer.dart" |
| -EXTRA_JVMARGS="-Xss2M " |
| -OS=`uname | tr "[A-Z]" "[a-z]"` |
| -if [ "$OS" == "darwin" ] ; then |
| - # Bump up the heap on Mac VMs, some of which default to 128M or less. |
| - # Users can specify DART_JVMARGS in the environment to override this |
| - # setting. |
| - EXTRA_JVMARGS+=" -Xmx512M -client " |
| -else |
| - # On other architectures |
| - # -batch invocations will do better with a server vm |
| - # invocations for analyzing a single file do better with a client vm |
| - if [ $FOUND_BATCH -eq 0 ] ; then |
| - EXTRA_JVMARGS+=" -client " |
| - fi |
| + exec "$DART" "--package-root=$PKG_DIR" "$DARTANALYZER" "$@" |
| fi |
| - |
| -exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \ |
| - "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@ |