Clean up scripts to run Java-based analyzer.

sdk/bin/dartanalyzer_developer is renamed sdk/bin/dartanalyzer_java
(replacing the old sdk/bin/dartanalyzer_java, which was unused), and
the test infrastructure is modified to use sdk/bin/dartanalyzer_java
to start the Java-based analyzer.

This frees up sdk/bin/dartanallyzer_developer to be the --host-checked
version of sdk/bin/dartanalyzer (paralleling what we do for
/sdk/bin/dart2js_developer).

R=ricow@google.com

Review URL: https://codereview.chromium.org//668743003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41227 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
paulberry@google.com 2014-10-21 13:02:37 +00:00
parent e820e5b214
commit f7db779401
5 changed files with 55 additions and 189 deletions

View file

@ -1,68 +1,6 @@
#!/bin/bash
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# Copyright (c) 2014, 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
# 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.
CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)"
if [ -z "$DART_CONFIGURATION" ];
then
DART_CONFIGURATION="ReleaseIA32"
fi
if [ `uname` == 'Darwin' ];
then
JAR_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer
else
JAR_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION/dartanalyzer
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.
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 -jar "$JAR_FILE" --dart-sdk "$SDK_DIR" "$@"
. ${BASH_SOURCE%_developer}

View file

@ -1,27 +1,10 @@
@echo off
rem Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
rem for details. All rights reserved. Use of this source code is governed by a
rem BSD-style license that can be found in the LICENSE file.
rem
REM Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.
rem This file is used to execute the analyzer by running the jar file.
rem It is a simple wrapper enabling us to have simpler command lines in
rem the testing infrastructure.
set SCRIPTPATH=%~dp0
rem Does the path have a trailing slash? If so, remove it.
if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1%
rem DART_CONFIGURATION defaults to ReleaseIA32
if "%DART_CONFIGURATION%"=="" set DART_CONFIGURATION=ReleaseIA32
set arguments=%*
set "SDK_DIR=%SCRIPTPATH%\..\..\build\%DART_CONFIGURATION%\dart-sdk"
set "JAR_DIR=%SCRIPTPATH%\..\..\build\%DART_CONFIGURATION%\dartanalyzer"
set "JAR_FILE=%JAR_DIR%\dartanalyzer.jar"
java -jar "%JAR_FILE%" --dart-sdk "%SDK_DIR%" %arguments%
setlocal
set DARTANALYZER_DEVELOPER_MODE=1
call "%~dp0dartanalyzer.bat" %*
endlocal
exit /b %errorlevel%

View file

@ -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" "$@"

View file

@ -2,56 +2,26 @@
rem Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
rem for details. All rights reserved. Use of this source code is governed by a
rem BSD-style license that can be found in the LICENSE file.
rem
set SCRIPT_DIR=%~dp0
if %SCRIPT_DIR:~-1%==\ set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%
rem This file is used to execute the analyzer by running the jar file.
rem It is a simple wrapper enabling us to have simpler command lines in
rem the testing infrastructure.
for %%I in ("%SCRIPT_DIR%\..") do set "DART_ANALYZER_HOME=%%~fI"
if %DART_ANALYZER_HOME:~-1%==\ set DART_ANALYZER_HOME=%DART_ANALYZER_HOME:~0,-1%
set SCRIPTPATH=%~dp0
set FOUND_BATCH=0
set FOUND_SDK=0
for %%a in (%*) do (
if [%%a] == [--batch] set FOUND_BATCH=1
if [%%a] == [-b] set FOUND_BATCH=1
if [%%a] == [--dart-sdk] set FOUND_SDK=1
)
rem Does the path have a trailing slash? If so, remove it.
if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1%
setlocal EnableDelayedExpansion
set DART_SDK=""
if [%FOUND_SDK%] == [0] (
if exist "%DART_ANALYZER_HOME%\lib\core\core.dart" (
set DART_SDK=--dart-sdk "%DART_ANALYZER_HOME%"
) else (
for /f %%i in ('echo %DART_ANALYZER_HOME%') do set DART_SDK_HOME=%%~dpi\dart-sdk
if exist "!DART_SDK_HOME!" (
set DART_SDK=--dart-sdk !DART_SDK_HOME!
) else (
for /f %%j in ('call echo !DART_SDK_HOME!') do set DART_SDK_HOME=%%~dpj\dart-sdk
if exist "!DART_SDK_HOME!" (
set DART_SDK=--dart-sdk !DART_SDK_HOME!
) else (
echo Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument
)
)
)
)
endlocal & set DART_SDK=%DART_SDK% & set DART_SDK_HOME=%DART_SDK_HOME%
rem DART_CONFIGURATION defaults to ReleaseIA32
if "%DART_CONFIGURATION%"=="" set DART_CONFIGURATION=ReleaseIA32
if exist "%DART_SDK_HOME%\util\dartanalyzer\dartanalyzer.jar" (
set DART_ANALYZER_LIBS=%DART_SDK_HOME%\util\dartanalyzer
) else if exist "%DART_ANALYZER_HOME%\util\dartanalyzer\dartanalyzer.jar" (
set DART_ANALYZER_LIBS=%DART_ANALYZER_HOME%\util\dartanalyzer
) else (
echo Configuration problem. Couldn't find dartanalyzer.jar.
exit /b 1
)
set arguments=%*
setlocal EnableDelayedExpansion
set EXTRA_JVMARGS=-Xss2M
if [%FOUND_BATCH%] == [1] (
set EXTRA_JVMARGS=!EXTRA_JVMARGS! -client
)
endlocal & set "EXTRA_JVMARGS=%EXTRA_JVMARGS%"
set "SDK_DIR=%SCRIPTPATH%\..\..\build\%DART_CONFIGURATION%\dart-sdk"
java %EXTRA_JVMARGS% %DART_JVMARGS% -ea -jar "%DART_ANALYZER_LIBS%\dartanalyzer.jar" %DART_SDK% %*
set "JAR_DIR=%SCRIPTPATH%\..\..\build\%DART_CONFIGURATION%\dartanalyzer"
set "JAR_FILE=%JAR_DIR%\dartanalyzer.jar"
java -jar "%JAR_FILE%" --dart-sdk "%SDK_DIR%" %arguments%

View file

@ -350,7 +350,7 @@ class AnalyzerCompilerConfiguration extends CompilerConfiguration {
String computeCompilerPath(String buildDir) {
String suffix = executableScriptSuffix;
return 'sdk/bin/dartanalyzer_developer$suffix';
return 'sdk/bin/dartanalyzer_java$suffix';
}
CommandArtifact computeCompilationArtifact(
@ -402,10 +402,7 @@ class DartBasedAnalyzerCompilerConfiguration
// The script dartanalyzer_developer is not included in the
// shipped SDK, that is the script is not installed in
// "$buildDir/dart-sdk/bin/"
// TODO(paulberry): the script dartanalyzer_developer currently
// points to the wrong place (the Java-based analyzer). Once
// this is fixed, we should run dartanalyzer_developer when in
// isHostChecked mode.
return '$prefix/dartanalyzer_developer$suffix';
}
if (useSdk) {
prefix = '$buildDir/dart-sdk/bin';