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

Side by Side Diff: sdk/bin/dartanalyzer

Issue 240723006: Replace Java based analyzer with Dart based analyzer when building SDK (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 7 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 | « editor/tools/compile_analyzer_java.py ('k') | sdk/bin/dartanalyzer.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 set -e 6 # Run dartanalyzer.dart on the Dart VM. This script assumes the Dart SDK's
7 # directory structure.
7 8
8 function follow_links() { 9 function follow_links() {
9 file="$1" 10 file="$1"
10 while [ -h "$file" ]; do 11 while [ -h "$file" ]; do
11 # On Mac OS, readlink -f doesn't work. 12 # On Mac OS, readlink -f doesn't work.
12 file="$(readlink "$file")" 13 file="$(readlink "$file")"
13 done 14 done
14 echo "$file" 15 echo "$file"
15 } 16 }
16 17
17 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. 18 # Unlike $0, $BASH_SOURCE points to the absolute path of this file.
18 PROG_NAME="$(follow_links "$BASH_SOURCE")" 19 PROG_NAME="$(follow_links "$BASH_SOURCE")"
19 20
20 # Handle the case where dart-sdk/bin has been symlinked to. 21 # Handle the case where dart-sdk/bin has been symlinked to.
21 SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" 22 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
22 23
23 DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)" 24 SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot"
24 25
25 FOUND_BATCH=0 26 # We are running the snapshot in the built SDK.
26 FOUND_SDK=0 27 DART="$BIN_DIR/dart"
27 for ARG in "$@" 28 exec "$DART" "$SNAPSHOT" "$@"
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
59
60 if [ -f "$DART_SDK_HOME/util/dartanalyzer/dartanalyzer.jar" ] ; then
61 DART_ANALYZER_LIBS=$DART_SDK_HOME/util/dartanalyzer
62 elif [ -f "$DART_ANALYZER_HOME/util/dartanalyzer/dartanalyzer.jar" ] ; then
63 DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/dartanalyzer
64 else
65 echo "Configuration problem. Couldn't find dartanalyzer.jar."
66 exit 1
67 fi
68
69 if [ -x /usr/libexec/java_home ]; then
70 export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+')
71 fi
72
73 EXTRA_JVMARGS="-Xss2M "
74 OS=`uname | tr "[A-Z]" "[a-z]"`
75 if [ "$OS" == "darwin" ] ; then
76 # 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 "
80 else
81 # On other architectures
82 # -batch invocations will do better with a server vm
83 # invocations for analyzing a single file do better with a client vm
84 if [ $FOUND_BATCH -eq 0 ] ; then
85 EXTRA_JVMARGS+=" -client "
86 fi
87 fi
88
89 exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \
90 "$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@
OLDNEW
« no previous file with comments | « editor/tools/compile_analyzer_java.py ('k') | sdk/bin/dartanalyzer.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698