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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/bin/dartanalyzer_developer.bat ('k') | sdk/bin/dartanalyzer_java.bat » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash --posix 1 #!/bin/bash
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2013, 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 # This file is used to execute the analyzer by running the jar file.
7 # It is a simple wrapper enabling us to have simpler command lines in
8 # the testing infrastructure.
6 set -e 9 set -e
7 10
11 FOUND_BATCH=0
12 for ARG in "$@"
13 do
14 case $ARG in
15 -batch|--batch)
16 FOUND_BATCH=1
17 ;;
18 *)
19 ;;
20 esac
21 done
22
8 function follow_links() { 23 function follow_links() {
9 file="$1" 24 file="$1"
10 while [ -h "$file" ]; do 25 while [ -h "$file" ]; do
11 # On Mac OS, readlink -f doesn't work. 26 # On Mac OS, readlink -f doesn't work.
12 file="$(readlink "$file")" 27 file="$(readlink "$file")"
13 done 28 done
14 echo "$file" 29 echo "$file"
15 } 30 }
16 31
17 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. 32 # Unlike $0, $BASH_SOURCE points to the absolute path of this file.
18 PROG_NAME="$(follow_links "$BASH_SOURCE")" 33 PROG_NAME="$(follow_links "$BASH_SOURCE")"
19 34
20 # Handle the case where dart-sdk/bin has been symlinked to. 35 # Handle the case where dart-sdk/bin has been symlinked to.
21 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" 36 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
22 37
23 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" 38 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
24 39
25 FOUND_BATCH=0 40 if [ -z "$DART_CONFIGURATION" ];
26 FOUND_SDK=0 41 then
27 for ARG in "$@" 42 DART_CONFIGURATION="ReleaseIA32"
28 do
29 case $ARG in
30 -batch|--batch)
31 FOUND_BATCH=1
32 ;;
33 --dart-sdk)
34 FOUND_SDK=1
35 ;;
36 *)
37 ;;
38 esac
39 done
40
41 DART_SDK=""
42 if [ $FOUND_SDK -eq 0 ] ; then
43 if [ -f "$DART_ANALYZER_HOME/lib/core/core.dart" ] ; then
44 DART_SDK=(--dart-sdk "$DART_ANALYZER_HOME")
45 else
46 DART_SDK_HOME=$(dirname "$DART_ANALYZER_HOME")/dart-sdk
47 if [ -d "$DART_SDK_HOME" ] ; then
48 DART_SDK=(--dart-sdk "$DART_SDK_HOME")
49 else
50 DART_SDK_HOME=$(dirname "$DART_SDK_HOME")/dart-sdk
51 if [ -d "$DART_SDK_HOME" ] ; then
52 DART_SDK=(--dart-sdk "$DART_SDK_HOME")
53 else
54 echo "Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument"
55 fi
56 fi
57 fi
58 fi 43 fi
59 44
60 if [ -f "$DART_SDK_HOME/util/dartanalyzer/dartanalyzer.jar" ] ; then 45 if [ `uname` == 'Darwin' ];
61 DART_ANALYZER_LIBS=$DART_SDK_HOME/util/dartanalyzer 46 then
62 elif [ -f "$DART_ANALYZER_HOME/util/dartanalyzer/dartanalyzer.jar" ] ; then 47 JAR_DIR="$BIN_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer
63 DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/dartanalyzer
64 else 48 else
65 echo "Configuration problem. Couldn't find dartanalyzer.jar." 49 JAR_DIR="$BIN_DIR"/../../out/$DART_CONFIGURATION/dartanalyzer
66 exit 1
67 fi 50 fi
68 51
69 if [ -x /usr/libexec/java_home ]; then 52 JAR_FILE="$JAR_DIR/dartanalyzer.jar"
70 export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+')
71 fi
72 53
73 EXTRA_JVMARGS="-Xss2M " 54 EXTRA_JVMARGS="-Xss2M "
74 OS=`uname | tr "[A-Z]" "[a-z]"` 55 OS=`uname | tr "[A-Z]" "[a-z]"`
75 if [ "$OS" == "darwin" ] ; then 56 if [ "$OS" == "darwin" ] ; then
76 # Bump up the heap on Mac VMs, some of which default to 128M or less. 57 # Bump up the heap on Mac VMs, some of which default to 128M or less.
77 # Users can specify DART_JVMARGS in the environment to override this
78 # setting.
79 EXTRA_JVMARGS+=" -Xmx512M -client " 58 EXTRA_JVMARGS+=" -Xmx512M -client "
80 else 59 else
81 # On other architectures 60 # On other architectures
82 # -batch invocations will do better with a server vm 61 # -batch invocations will do better with a server vm
83 # invocations for analyzing a single file do better with a client vm 62 # invocations for analyzing a single file do better with a client vm
84 if [ $FOUND_BATCH -eq 0 ] ; then 63 if [ $FOUND_BATCH -eq 0 ] ; then
85 EXTRA_JVMARGS+=" -client " 64 EXTRA_JVMARGS+=" -client "
86 fi 65 fi
87 fi 66 fi
88 67
89 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \ 68 exec java $EXTRA_JVMARGS -jar "$JAR_FILE" --dart-sdk "$SDK_DIR" "$@"
90 "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@
OLDNEW
« 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