mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:57:43 +00:00
b9116653bd
The dartanalyzer script (and its Windows companion, dartanalyzer.bat) now support: - Executing from snapshot if present, otherwise from source (needed for buildbot tests). - Passing in the appropriate package root when executind from source. - Passing in VM tuning parameters to speed up analysis. - Passing through extra DART_VM_OPTIONS to the VM. Also, the old editor/tools/analyzer script has been removed and the test infrastructure now uses sdk/bin/dartanalyzer, in the same way that it works for dart2js. R=ahe@google.com, johnniwinther@google.com, ricow@google.com Review URL: https://codereview.chromium.org//628363002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41150 260f80e4-7a28-3924-810f-c04153c831b5
62 lines
1.5 KiB
Bash
Executable file
62 lines
1.5 KiB
Bash
Executable file
#!/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.
|
|
|
|
# Run dartanalyzer.dart on the Dart VM. This script assumes the Dart repo's
|
|
# directory structure.
|
|
|
|
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.
|
|
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
|
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
|
|
|
|
SDK_ARG="--dart-sdk=$SDK_DIR"
|
|
|
|
DART="$BIN_DIR/dart"
|
|
|
|
unset EXTRA_VM_OPTIONS
|
|
declare -a EXTRA_VM_OPTIONS
|
|
|
|
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
|
|
|
|
DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"
|
|
|
|
ANALYZER="$DART_ROOT/pkg/analyzer/bin/analyzer.dart"
|
|
|
|
if [ -z "$DART_CONFIGURATION" ];
|
|
then
|
|
DART_CONFIGURATION="ReleaseIA32"
|
|
fi
|
|
|
|
if [[ `uname` == 'Darwin' ]]; then
|
|
BUILD_DIR="$DART_ROOT/xcodebuild/$DART_CONFIGURATION"
|
|
else
|
|
BUILD_DIR="$DART_ROOT/out/$DART_CONFIGURATION"
|
|
fi
|
|
|
|
PACKAGE_ROOT="$BUILD_DIR/packages/"
|
|
|
|
exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "--package-root=$PACKAGE_ROOT" "$ANALYZER" "$SDK_ARG" "$@"
|