Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: sdk/bin/dartanalyzer_java

Issue 668743003: Clean up scripts to run Java-based analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/bin/dartanalyzer_developer.bat ('k') | sdk/bin/dartanalyzer_java.bat » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/bin/dartanalyzer_java
diff --git a/sdk/bin/dartanalyzer_java b/sdk/bin/dartanalyzer_java
index 740332f2ebee679a2a32022793a4664d082d36b3..d2839b5e1f6c2a5e6584ee2ed86743c30f65bb46 100755
--- a/sdk/bin/dartanalyzer_java
+++ b/sdk/bin/dartanalyzer_java
@@ -1,10 +1,25 @@
-#!/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.
+# This file is used to execute the analyzer by running the jar file.
+# It is a simple wrapper enabling us to have simpler command lines in
+# the testing infrastructure.
set -e
+FOUND_BATCH=0
+for ARG in "$@"
+do
+ case $ARG in
+ -batch|--batch)
+ FOUND_BATCH=1
+ ;;
+ *)
+ ;;
+ esac
+done
+
function follow_links() {
file="$1"
while [ -h "$file" ]; do
@@ -18,64 +33,28 @@ 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
-
-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
- fi
+if [ -z "$DART_CONFIGURATION" ];
+then
+ DART_CONFIGURATION="ReleaseIA32"
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
+if [ `uname` == 'Darwin' ];
+then
+ JAR_DIR="$BIN_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer
else
- echo "Configuration problem. Couldn't find dartanalyzer.jar."
- exit 1
+ JAR_DIR="$BIN_DIR"/../../out/$DART_CONFIGURATION/dartanalyzer
fi
-if [ -x /usr/libexec/java_home ]; then
- export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+')
-fi
+JAR_FILE="$JAR_DIR/dartanalyzer.jar"
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
@@ -86,5 +65,4 @@ else
fi
fi
-exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \
- "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@
+exec java $EXTRA_JVMARGS -jar "$JAR_FILE" --dart-sdk "$SDK_DIR" "$@"
« no previous file with comments | « sdk/bin/dartanalyzer_developer.bat ('k') | sdk/bin/dartanalyzer_java.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698