mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:47:03 +00:00
521aef0d96
* include analyzer dart files and snapshot in SDK * modified bin/dartanalyzer to call dart based analyzer * removed jar files in utils directory BUG=dartbug.com/18289 R=ricow@google.com, scheglov@google.com Review URL: https://codereview.chromium.org//240723006 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35604 260f80e4-7a28-3924-810f-c04153c831b5
91 lines
2.4 KiB
Bash
Executable file
91 lines
2.4 KiB
Bash
Executable file
#!/bin/bash --posix
|
|
# 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
|
|
|
|
function follow_links() {
|
|
file="$1"
|
|
while [ -h "$file" ]; do
|
|
# On Mac OS, readlink -f doesn't work.
|
|
file="$(readlink "$file")"
|
|
done
|
|
echo "$file"
|
|
}
|
|
|
|
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
|
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
|
|
|
# Handle the case where dart-sdk/bin has been symlinked to.
|
|
SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
|
|
|
DART_ANALYZER_HOME="$(cd "${SCRIPT_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
|
|
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 [ -x /usr/libexec/java_home ]; then
|
|
export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+')
|
|
fi
|
|
|
|
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
|
|
fi
|
|
|
|
exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \
|
|
"$DART_ANALYZER_LIBS/dartanalyzer.jar" "${DART_SDK[@]}" $@
|