From bf56eebc8687854a87350c50dd8b9d356e512ece Mon Sep 17 00:00:00 2001 From: "ricow@google.com" Date: Tue, 12 Mar 2013 17:42:15 +0000 Subject: [PATCH] Create "binaries" for calling the new analyzer. This make the testing script look much nicer, and it allows for easier calling the analyzer instead of using java -jar Review URL: https://codereview.chromium.org//12335133 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19882 260f80e4-7a28-3924-810f-c04153c831b5 --- sdk/bin/analyzer | 39 +++++++++++++++++++++++++++++++++++++++ sdk/bin/analyzer.bat | 25 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100755 sdk/bin/analyzer create mode 100644 sdk/bin/analyzer.bat diff --git a/sdk/bin/analyzer b/sdk/bin/analyzer new file mode 100755 index 00000000000..2fb8648251a --- /dev/null +++ b/sdk/bin/analyzer @@ -0,0 +1,39 @@ +#!/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 + +function follow_links() { + while [ -h "$1" ]; do + # On Mac OS, readlink -f doesn't work. + 1="$(readlink "$1")" + done + echo "$1" +} + +# Unlike $0, $BASH_SOURCE points to the absolute path of this file. +PROG_NAME="$(follow_links "$BASH_SOURCE")" + +# Handle the case where the binary dir has been symlinked to. +CUR_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" + +if [ -z "$DART_CONFIGURATION" ]; +then + DART_CONFIGURATION="ReleaseIA32" +fi + +if [[ `uname` == 'Darwin' ]]; +then + JAR_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION/new_analyzer +else + JAR_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION/new_analyzer +fi + +JAR_FILE="$JAR_DIR/new_analyzer.jar" + +exec java -jar $JAR_FILE "$@" diff --git a/sdk/bin/analyzer.bat b/sdk/bin/analyzer.bat new file mode 100644 index 00000000000..7c5d0c35941 --- /dev/null +++ b/sdk/bin/analyzer.bat @@ -0,0 +1,25 @@ +@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 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 "JAR_DIR=%SCRIPTPATH%\..\..\build\%DART_CONFIGURATION%\new_analyzer" + +set "JAR_FILE=%JAR_DIR%\new_analyzer.jar" + +java -jar %JAR_FILE% %arguments%"