mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:19:49 +00:00
Add the new dart analyzer to the SDK.
Review URL: https://codereview.chromium.org//14110004 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21479 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
b550a87c26
commit
15f2818c43
|
@ -7,14 +7,15 @@ Here's a brief guide to what's in here:
|
|||
bin/ Binaries/scripts to compile, run, and manage Dart applications.
|
||||
dart Dart virtual machine
|
||||
dart2js Dart-to-JavaScript compiler
|
||||
dart_analyzer Dart static analyzer
|
||||
dartanalyzer Dart static analyzer
|
||||
dart_analyzer The older, deprecated Dart static analyzer
|
||||
dartdoc Dart documentation generator
|
||||
pub Pub, the Dart package manager
|
||||
|
||||
lib/ Libraries that are shipped with the Dart runtime. More
|
||||
information is available at api.dartlang.org.
|
||||
|
||||
pkg/ Additional packages that are shipped outside of the Dart
|
||||
packages/ Additional packages that are shipped outside of the Dart
|
||||
runtime. More information is available at api.dartlang.org.
|
||||
|
||||
version The version number of the SDK (ex. 0.1.2.0_r1234).
|
||||
|
|
79
sdk/bin/dartanalyzer
Executable file
79
sdk/bin/dartanalyzer
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/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
|
||||
|
||||
# Setting SCRIPT_DIR this way is ugly, but is needed to handle the case where
|
||||
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
|
||||
# with this case.
|
||||
SCRIPT_DIR="$(cd "${0%/*}" ; 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 = 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+=" -Xmx256M -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 = 0 ] ; then
|
||||
EXTRA_JVMARGS+=" -client "
|
||||
fi
|
||||
fi
|
||||
|
||||
exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -jar \
|
||||
"$DART_ANALYZER_LIBS/dartanalyzer.jar" ${DART_SDK} $@
|
58
sdk/bin/dartanalyzer.bat
Normal file
58
sdk/bin/dartanalyzer.bat
Normal file
|
@ -0,0 +1,58 @@
|
|||
@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.
|
||||
|
||||
set SCRIPT_DIR=%~dp0
|
||||
if %SCRIPT_DIR:~-1%==\ set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%
|
||||
|
||||
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 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
|
||||
)
|
||||
|
||||
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%"
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
set EXTRA_JVMARGS=-Xss2M
|
||||
if [%FOUND_BATCH%] == [1] (
|
||||
set EXTRA_JVMARGS=!EXTRA_JVMARGS! -client
|
||||
)
|
||||
endlocal & set "EXTRA_JVMARGS=%EXTRA_JVMARGS%"
|
||||
|
||||
java %EXTRA_JVMARGS% %DART_JVMARGS% -ea -jar \
|
||||
"%DART_ANALYZER_LIBS%\dartanalyzer.jar" %DART_SDK% %*
|
|
@ -50,11 +50,14 @@
|
|||
# ....util/
|
||||
# ......analyzer/
|
||||
# ........dart_analyzer.jar
|
||||
# ......dartanalyzer/
|
||||
# ........dartanalyzer.jar
|
||||
# ........(third-party libraries for dart_analyzer)
|
||||
# ......pub/
|
||||
# ......(more will come here)
|
||||
|
||||
|
||||
import glob
|
||||
import optparse
|
||||
import os
|
||||
import re
|
||||
|
@ -113,7 +116,7 @@ def CopyShellScript(src_file, dest_dir):
|
|||
|
||||
def CopyDartScripts(home, sdk_root):
|
||||
# TODO(dgrove) - add pub once issue 6619 is fixed
|
||||
for executable in ['dart2js', 'dartdoc']:
|
||||
for executable in ['dart2js', 'dartanalyzer', 'dartdoc']:
|
||||
CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
|
||||
os.path.join(sdk_root, 'bin'))
|
||||
|
||||
|
@ -262,6 +265,16 @@ def Main(argv):
|
|||
src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
|
||||
copyfile(src_file, dest_file)
|
||||
|
||||
# Create and copy dartanalyzer into 'util'
|
||||
DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer')
|
||||
DARTANALYZER_DEST = join(UTIL, 'dartanalyzer')
|
||||
os.makedirs(DARTANALYZER_DEST)
|
||||
|
||||
jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar'))
|
||||
|
||||
for jarFile in jarFiles:
|
||||
copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile)))
|
||||
|
||||
# Create and populate util/pub.
|
||||
copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'),
|
||||
ignore=ignore_patterns('.svn', 'sdk'))
|
||||
|
|
Loading…
Reference in a new issue