Index: sdk/bin/dartanalyzer |
diff --git a/sdk/bin/dartanalyzer b/sdk/bin/dartanalyzer |
index cc49a5c8293165d323178d90213af08683af46d2..540e72926fedaedfc85e82046bfacf6efd00bcf8 100755 |
--- a/sdk/bin/dartanalyzer |
+++ b/sdk/bin/dartanalyzer |
@@ -21,11 +21,51 @@ PROG_NAME="$(follow_links "$BASH_SOURCE")" |
# Handle the case where dart-sdk/bin has been symlinked to. |
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
+DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" |
ricow1
2014/10/07 06:03:08
this is not true if we are running from the snapsh
Paul Berry
2014/10/07 23:39:17
Acknowledged. I've moved DART_ROOT and ANALYZER i
|
+ |
+ANALYZER="$DART_ROOT/pkg/analyzer/bin/analyzer.dart" |
SDK_ARG="--dart-sdk=$SDK_DIR" |
-SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot" |
+if [ -z "$DART_CONFIGURATION" ]; |
+then |
+ DART_CONFIGURATION="ReleaseIA32" |
ricow1
2014/10/07 06:03:08
I really don't like this, and I don't think we nee
Paul Berry
2014/10/07 23:39:17
I've tried doing this but it's proving to be diffi
|
+fi |
-# We are running the snapshot in the built SDK. |
DART="$BIN_DIR/dart" |
-exec "$DART" "$SNAPSHOT" "$SDK_ARG" "$@" |
+ |
+SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot" |
+ |
+if [[ `uname` == 'Darwin' ]]; then |
ricow1
2014/10/07 06:03:08
see comment above
|
+ BUILD_DIR="$DART_ROOT/xcodebuild/$DART_CONFIGURATION" |
+else |
+ BUILD_DIR="$DART_ROOT/out/$DART_CONFIGURATION" |
+fi |
+ |
+PACKAGE_ROOT="$BUILD_DIR/packages/" |
+ |
+unset EXTRA_VM_OPTIONS |
+declare -a EXTRA_VM_OPTIONS |
+ |
+# Set some optimization options that speed up analysis. |
+EXTRA_VM_OPTIONS+=("--heap_growth_rate=512") |
+EXTRA_VM_OPTIONS+=("--inlining_hotness=90") |
+EXTRA_VM_OPTIONS+=("--optimization_counter_threshold=5000") |
+ |
+case $0 in |
+ *_developer) |
+ EXTRA_VM_OPTIONS+=('--checked') |
+ ;; |
+esac |
+ |
+# We allow extra vm options to be passed in through an environment variable. |
+if [[ $DART_VM_OPTIONS ]]; then |
+ read -a OPTIONS <<< "$DART_VM_OPTIONS" |
+ EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") |
+fi |
+ |
+if test -f "$SNAPSHOT"; then |
+ exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "$SDK_ARG" "$@" |
+else |
+ exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "--package-root=$PACKAGE_ROOT" "$ANALYZER" "$SDK_ARG" "$@" |
+fi |