mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 23:31:42 +00:00
Renamed the 'dartc' launch script to 'dart_analyzer' and adds it to dart-sdk
Some now unused scripts and files were also removed. Review URL: https://chromiumcodereview.appspot.com//9950019 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6629 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
43ff9be2fa
commit
f209ea4140
|
@ -9,11 +9,11 @@
|
|||
],
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'dartc',
|
||||
'target_name': 'dart_analyzer',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'build_dartc',
|
||||
'action_name': 'build_dart_analyzer',
|
||||
'inputs': [
|
||||
'sources.gypi',
|
||||
'test_sources.gypi',
|
||||
|
@ -21,10 +21,9 @@
|
|||
'<@(java_resources)',
|
||||
'<@(javatests_sources)',
|
||||
'<@(javatests_resources)',
|
||||
'dartc.xml',
|
||||
'scripts/dartc.sh',
|
||||
'scripts/dartc_run.sh',
|
||||
'scripts/dartc_metrics.sh',
|
||||
'dart_analyzer.xml',
|
||||
'scripts/dart_analyzer.sh',
|
||||
'scripts/analyzer_metrics.sh',
|
||||
'../third_party/args4j/2.0.12/args4j-2.0.12.jar',
|
||||
'../third_party/guava/r09/guava-r09.jar',
|
||||
'../third_party/hamcrest/v1_3/hamcrest-core-1.3.0RC2.jar',
|
||||
|
@ -34,37 +33,28 @@
|
|||
],
|
||||
'outputs': [
|
||||
'<(INTERMEDIATE_DIR)/<(_target_name)/tests.jar',
|
||||
'<(PRODUCT_DIR)/compiler/bin/dartc',
|
||||
'<(PRODUCT_DIR)/compiler/lib/args4j/2.0.12/args4j-2.0.12.jar',
|
||||
'<(PRODUCT_DIR)/compiler/lib/dartc.jar',
|
||||
'<(PRODUCT_DIR)/compiler/lib/guava/r09/guava-r09.jar',
|
||||
'<(PRODUCT_DIR)/analyzer/bin/dart_analyzer',
|
||||
'<(PRODUCT_DIR)/analyzer/util/analyzer/dart_analyzer.jar',
|
||||
'<(PRODUCT_DIR)/analyzer/util/analyzer/args4j/2.0.12/args4j-2.0.12.jar',
|
||||
'<(PRODUCT_DIR)/analyzer/util/analyzer/guava/r09/guava-r09.jar',
|
||||
],
|
||||
'action' : [
|
||||
'../third_party/apache_ant/v1_7_1/bin/ant',
|
||||
'-f', 'dartc.xml',
|
||||
'-f', 'dart_analyzer.xml',
|
||||
'-Dbuild.dir=<(INTERMEDIATE_DIR)/<(_target_name)',
|
||||
'-Ddist.dir=<(PRODUCT_DIR)/compiler',
|
||||
'-Ddist.dir=<(PRODUCT_DIR)/analyzer',
|
||||
'clean',
|
||||
'dist',
|
||||
'tests.jar',
|
||||
],
|
||||
'message': 'Building dartc.',
|
||||
'message': 'Building dart_analyzer.',
|
||||
},
|
||||
{
|
||||
'action_name': 'copy_tests',
|
||||
'inputs': [ '<(INTERMEDIATE_DIR)/<(_target_name)/tests.jar' ],
|
||||
'outputs': [ '<(PRODUCT_DIR)/compiler-tests.jar' ],
|
||||
'outputs': [ '<(PRODUCT_DIR)/analyzer/dart_analyzer_tests.jar' ],
|
||||
'action': [ 'cp', '<@(_inputs)', '<@(_outputs)' ]
|
||||
},
|
||||
{
|
||||
'action_name': 'copy_dartc_wrapper',
|
||||
'inputs': [
|
||||
'<(PRODUCT_DIR)/compiler/lib/dartc.jar',
|
||||
'scripts/dartc_wrapper.py',
|
||||
],
|
||||
'outputs': [ '<(PRODUCT_DIR)/dartc' ],
|
||||
'action': [ 'cp', 'scripts/dartc_wrapper.py', '<@(_outputs)' ]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<property name="build.test.classes.dir" value="${build.dir}/test/classes"/>
|
||||
|
||||
<property name="dartc.jar" value="${build.dir}/dartc.jar"/>
|
||||
<property name="dart_analyzer.jar" value="${build.dir}/dart_analyzer.jar"/>
|
||||
|
||||
<property name="dist.dir" value="${build.dir}/dist"/>
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
|||
</target>
|
||||
|
||||
<!--
|
||||
We rely on GYP to call these targets when the dartc dependencies change, hence this
|
||||
We rely on GYP to call these targets when the dart_analyzer dependencies change, hence this
|
||||
ant file cannot be used standalone.
|
||||
-->
|
||||
<target name="compile-tests" depends="compile" description="Compiles all of the java tests and copies the resources to the test classes directory." >
|
||||
|
@ -106,55 +106,57 @@
|
|||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="dartc.jar" depends="compile" description="Creates a jar for dartc without bundling the dependencies.">
|
||||
<jar destfile="${dartc.jar}" basedir="${build.classes.dir}" manifest="dartc.mf"/>
|
||||
<target name="dart_analyzer.jar" depends="compile"
|
||||
description="Creates a jar for dart analyzer w/o bundling dependencies.">
|
||||
<jar destfile="${dart_analyzer.jar}" basedir="${build.classes.dir}"
|
||||
manifest="dart_analyzer.mf"/>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="dartc.jar" description="Creates a directory that contains a standalone distribution for dartc.">
|
||||
<target name="dist" depends="dart_analyzer.jar"
|
||||
description="Creates a directory with a standalone distribution.">
|
||||
<!--
|
||||
Ensure the necessary subdirectories exist.
|
||||
-->
|
||||
<mkdir dir="${dist.dir}/bin"/>
|
||||
<mkdir dir="${dist.dir}/lib"/>
|
||||
<mkdir dir="${dist.dir}/util"/>
|
||||
<mkdir dir="${dist.dir}/util/analyzer"/>
|
||||
|
||||
<!--
|
||||
Copy the dart jar to the lib folder.
|
||||
-->
|
||||
<copy file="${dartc.jar}" todir="${dist.dir}/lib"/>
|
||||
<copy file="${dart_analyzer.jar}" todir="${dist.dir}/util/analyzer"/>
|
||||
|
||||
<!--
|
||||
Re-root the classpaths from third_party into the lib folder of the distro.
|
||||
Re-root the classpaths from third_party into the library folder of the distro.
|
||||
-->
|
||||
<pathconvert property="dartc.classpath.runtime.unix" targetos="unix" refid="classpath.runtime">
|
||||
<regexpmapper from="${third_party.dir}/(.*)" to="$DARTC_LIBS/\1"/>
|
||||
<pathconvert property="analyzer.classpath.runtime.unix" targetos="unix" refid="classpath.runtime">
|
||||
<regexpmapper from="${third_party.dir}/(.*)" to="$DART_ANALYZER_LIBS/\1"/>
|
||||
</pathconvert>
|
||||
|
||||
<copy file="scripts/dartc.sh" tofile="${dist.dir}/bin/dartc">
|
||||
<copy file="scripts/dart_analyzer.sh" tofile="${dist.dir}/bin/dart_analyzer">
|
||||
<filterset>
|
||||
<filter token="CLASSPATH" value="$DARTC_LIBS/dartc.jar:${dartc.classpath.runtime.unix}"/>
|
||||
<filter token="CLASSPATH" value="$DART_ANALYZER_LIBS/dart_analyzer.jar:${analyzer.classpath.runtime.unix}"/>
|
||||
</filterset>
|
||||
</copy>
|
||||
<chmod file="${dist.dir}/bin/dartc" perm="a+rx"/>
|
||||
<chmod file="${dist.dir}/bin/dart_analyzer" perm="a+rx"/>
|
||||
|
||||
<!--
|
||||
TODO: The following files are not strictly due to dist, move them out.
|
||||
-->
|
||||
<copy todir="${build.dir}">
|
||||
<fileset dir="scripts">
|
||||
<include name="dartc_run.sh"/>
|
||||
<include name="dartc_metrics.sh"/>
|
||||
<include name="analyzer_metrics.sh"/>
|
||||
</fileset>
|
||||
<filterset>
|
||||
<filter token="CLASSPATH" value="$DARTC_LIBS/dartc.jar:${dartc.classpath.runtime.unix}"/>
|
||||
<filter token="CLASSPATH" value="$DART_ANALYZER_LIBS/dart_analyzer.jar:${analyzer.classpath.runtime.unix}"/>
|
||||
</filterset>
|
||||
</copy>
|
||||
<chmod file="${build.dir}/dartc_run.sh" perm="a+rx"/>
|
||||
<chmod file="${build.dir}/dartc_metrics.sh" perm="a+rx"/>
|
||||
<chmod file="${build.dir}/analyzer_metrics.sh" perm="a+rx"/>
|
||||
|
||||
<!--
|
||||
Copy of all of the dartc dependencies to the lib folder.
|
||||
Copy of all of the dart anayzer dependencies to the library folder.
|
||||
-->
|
||||
<copy todir="${dist.dir}/lib">
|
||||
<copy todir="${dist.dir}/util/analyzer">
|
||||
<path refid="classpath.runtime"/>
|
||||
<regexpmapper from="${third_party.dir}/(.*)" to="\1"/>
|
||||
</copy>
|
0
compiler/scripts/compiler_compare.sh → compiler/scripts/analyzer_compare.sh
Executable file → Normal file
0
compiler/scripts/compiler_compare.sh → compiler/scripts/analyzer_compare.sh
Executable file → Normal file
18
compiler/scripts/compiler_metrics.sh → compiler/scripts/analyzer_metrics.sh
Executable file → Normal file
18
compiler/scripts/compiler_metrics.sh → compiler/scripts/analyzer_metrics.sh
Executable file → Normal file
|
@ -13,7 +13,7 @@
|
|||
DART_PARAMS="--metrics "
|
||||
RUNS=3
|
||||
ONE_DELTA=""
|
||||
DARTC=$(which dartc)
|
||||
DART_ANALYZER=$(which dart_analyzer)
|
||||
SAMPLE_DIR="."
|
||||
PREFIX="sample"
|
||||
SCRIPT_DIR=$(dirname $0)
|
||||
|
@ -30,7 +30,7 @@ function printHelp() {
|
|||
echo " -r=, --runs= Set the number of compile samples to be executed. Defaults to $RUNS"
|
||||
echo " -d=, --one-delta= The filename, relative to DART_APP, to touch in order to trigger a one-delta compile."
|
||||
echo " -o=, --output= Directory location of sample storage"
|
||||
echo " --dartc= Override PATH location for dartc script"
|
||||
echo " --analyzer= Override PATH location for analyzer script"
|
||||
echo " -p, --stats-prefix= Adds prefix to each output file (default: sample-[full|incri-[one|zero]]).txt)"
|
||||
echo " -h, --help What you see is what you get."
|
||||
echo " DART_APP Path to dart .app file to compile (depricated)"
|
||||
|
@ -48,8 +48,8 @@ do
|
|||
RUNS=${i#*=};;
|
||||
--one-delta=*|-d=*)
|
||||
ONE_DELTA=${i#*=};;
|
||||
--dartc=*)
|
||||
DARTC=${i#*=};;
|
||||
--analyzer=*)
|
||||
ANALYZER=${i#*=};;
|
||||
--output=*|-o=*)
|
||||
SAMPLE_DIR=${i#*=};;
|
||||
--stats-prefix=*|-p=*)
|
||||
|
@ -70,8 +70,8 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
if [ "" = "$DARTC" ] || [ ! -x $DARTC ]; then
|
||||
echo "Error: Location of 'dartc' not found."
|
||||
if [ "" = "$ANALYZER" ] || [ ! -x $ANALYZER ]; then
|
||||
echo "Error: Location of 'dart_analyzer' not found."
|
||||
printHelp 1
|
||||
fi
|
||||
|
||||
|
@ -110,11 +110,11 @@ rm -Rf $SAMPLE_FULL $SAMPLE_INCR_ZERO $SAMPLE_INCR_ONE
|
|||
for ((i=0;i<$RUNS;i++)) do
|
||||
echo "Run $i"
|
||||
rm -Rf $OUT_DIR
|
||||
$DARTC $DART_PARAMS $APP >> $SAMPLE_FULL
|
||||
$DARTC $DART_PARAMS $APP >> $SAMPLE_INCR_ZERO
|
||||
$DART_ANALYZER $DART_PARAMS $APP >> $SAMPLE_FULL
|
||||
$DART_ANALYZER $DART_PARAMS $APP >> $SAMPLE_INCR_ZERO
|
||||
if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then
|
||||
touch $ONE_DELTA
|
||||
$DARTC $DART_PARAMS $APP >> $SAMPLE_INCR_ONE
|
||||
$DART_ANALYZER $DART_PARAMS $APP >> $SAMPLE_INCR_ONE
|
||||
fi
|
||||
done
|
||||
|
12
compiler/scripts/compiler_series_test.sh → compiler/scripts/analyzer_series_test.sh
Executable file → Normal file
12
compiler/scripts/compiler_series_test.sh → compiler/scripts/analyzer_series_test.sh
Executable file → Normal file
|
@ -158,8 +158,8 @@ function failStats() {
|
|||
|
||||
function compileRevision() {
|
||||
REVISION=$1
|
||||
PREBUILT_DIR=$ROOT_OF_REPO/compiler/revs/$REVISION/prebuilt
|
||||
PREBUILT_BIN=$PREBUILT_DIR/compiler/bin/dartc
|
||||
PREBUILT_DIR=$ROOT_OF_REPO/analyzer/revs/$REVISION/prebuilt
|
||||
PREBUILT_BIN=$PREBUILT_DIR/analyzer/bin/dart_analyzer
|
||||
if [ ! -x $PREBUILT_BIN ]; then
|
||||
echo "No prebuilt, building and caching"
|
||||
echo "Checking out clean version of $REVISION; will take some time. Look at $LOG_FILE for progress"
|
||||
|
@ -170,7 +170,7 @@ function compileRevision() {
|
|||
echo "Run hooks"
|
||||
gclient runhooks >> $LOG_FILE 2>&1
|
||||
|
||||
echo "Compiling clean version of dartc; may take some time"
|
||||
echo "Compiling clean version of dart_analyzer; may take some time"
|
||||
date
|
||||
cd compiler
|
||||
../tools/build.py --mode release >> $LOG_FILE 2>&1
|
||||
|
@ -198,10 +198,10 @@ function compileRevision() {
|
|||
fi
|
||||
|
||||
# Do the second test
|
||||
echo "Running test with dartc $REVISION!"
|
||||
echo "Running test with dart_analyzer $REVISION!"
|
||||
date
|
||||
echo $SCRIPT_PATH/compiler_metrics.sh --stats-prefix=$REVISION --dartc=$PREBUILT_DIR/compiler/bin/dartc $COMPARE_OPTIONS >> $LOG_FILE 2>&1
|
||||
$SCRIPT_PATH/compiler_metrics.sh --stats-prefix=$REVISION --dartc=$PREBUILT_DIR/compiler/bin/dartc $COMPARE_OPTIONS > $STAT1
|
||||
echo $SCRIPT_PATH/compiler_metrics.sh --stats-prefix=$REVISION --analyzer=$PREBUILT_DIR/analyzer/bin/dart_analyzer $COMPARE_OPTIONS >> $LOG_FILE 2>&1
|
||||
$SCRIPT_PATH/dart_analyzer.sh --stats-prefix=$REVISION --analyzer=$PREBUILT_DIR/analyzer/bin/dart_analyzer $COMPARE_OPTIONS > $STAT1
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo "error sampling"
|
||||
failStats $REVISION
|
|
@ -1,49 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Produce a build of dartc that can be used to measure its performance over
|
||||
# time. This script needs to be backwards compatible with earlier
|
||||
# revisions.
|
||||
#
|
||||
# TODO: Still need to handle revisions between r2694 and r2764.
|
||||
#
|
||||
DARTC_REVISION=$1
|
||||
USERNAME=$2
|
||||
PASSWORD=$3
|
||||
|
||||
# Checkout the depot tools
|
||||
svn checkout --quiet http://src.chromium.org/svn/trunk/tools/depot_tools depot_tools
|
||||
GCLIENT_CMD=./depot_tools/gclient
|
||||
|
||||
# Make a gclient with the compiler deps only
|
||||
$GCLIENT_CMD config https://dart.googlecode.com/svn/branches/bleeding_edge/deps/compiler.deps
|
||||
|
||||
# Make sure that we have access
|
||||
svn ls --username $USERNAME --password "$PASSWORD" https://dart.googlecode.com/svn/
|
||||
|
||||
# Try to sync to a particular revision transitively; muffle the output
|
||||
$GCLIENT_CMD sync -r $DARTC_REVISION -t > gclient.sync.txt
|
||||
|
||||
# Build dartc
|
||||
cd compiler
|
||||
../tools/build.py --mode release
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
# Give the metrics system a backwards compatible way of getting to the
|
||||
# artifacts that it needs.
|
||||
cd ..
|
||||
mkdir -p prebuilt
|
||||
cd prebuilt
|
||||
COMPILER_OUTDIR=../compiler/out/Release_ia32
|
||||
cp -r $COMPILER_OUTDIR/compiler ./compiler
|
||||
GENERATED_SCRIPT_DIR=obj.target/geni/dartc
|
||||
PATH_TO_METRICS_SCRIPT=$COMPILER_OUTDIR/$GENERATED_SCRIPT_DIR
|
||||
cp -r $PATH_TO_METRICS_SCRIPT/dartc_run.sh .
|
||||
cp -r $PATH_TO_METRICS_SCRIPT/dartc_size.sh .
|
||||
cp $COMPILER_OUTDIR/d8 .
|
||||
if [ -e $PATH_TO_METRICS_SCRIPT/dartc_metrics.sh ]; then
|
||||
cp $PATH_TO_METRICS_SCRIPT/dartc_metrics.sh .
|
||||
fi
|
||||
|
51
compiler/scripts/dartc.sh → compiler/scripts/dart_analyzer.sh
Executable file → Normal file
51
compiler/scripts/dartc.sh → compiler/scripts/dart_analyzer.sh
Executable file → Normal file
|
@ -1,14 +1,44 @@
|
|||
#!/bin/bash --posix
|
||||
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
||||
# Copyright (c) 2012, 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
|
||||
|
||||
SCRIPT_DIR=$(dirname $0)
|
||||
DARTC_HOME=$(dirname $SCRIPT_DIR)
|
||||
DARTC_LIBS=$DARTC_HOME/lib
|
||||
DARTC_SDK=$(dirname $DARTC_HOME)/dart-sdk
|
||||
DART_ANALYZER_HOME=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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_runtime.dart ] ; then
|
||||
DART_SDK="--dart-sdk $DART_ANALYZER_HOME"
|
||||
else
|
||||
DART_ANALYZER_HOME=$(dirname $DART_ANALYZER_HOME)/dart-sdk
|
||||
if [ -d $DART_ANALYZER_HOME ] ; then
|
||||
DART_SDK="--dart-sdk $DART_ANALYZER_HOME"
|
||||
else
|
||||
echo "Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/analyzer
|
||||
|
||||
if [ -x /usr/libexec/java_home ]; then
|
||||
export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+')
|
||||
|
@ -26,21 +56,10 @@ 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
|
||||
FOUND_BATCH=0
|
||||
for ARG in "$@"
|
||||
do
|
||||
case $ARG in
|
||||
-batch|--batch)
|
||||
FOUND_BATCH=1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $FOUND_BATCH = 0 ] ; then
|
||||
EXTRA_JVMARGS+=" -client "
|
||||
fi
|
||||
fi
|
||||
|
||||
exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -classpath "@CLASSPATH@" \
|
||||
com.google.dart.compiler.DartCompiler --dart-sdk ${DARTC_SDK} $@
|
||||
com.google.dart.compiler.DartCompiler ${DART_SDK} $@
|
|
@ -1,55 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011, 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.
|
||||
|
||||
"""Wrapper around dartc for use from GYP."""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
from os import path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def _BuildOptions():
|
||||
op = optparse.OptionParser(usage='usage: %prog [options] FILE')
|
||||
op.add_option('--out')
|
||||
op.add_option('--dartc')
|
||||
op.add_option('--dartc-option', action='append', dest='dartc_options',
|
||||
default=[])
|
||||
op.add_option('--incremental', action='store_false',
|
||||
default=os.getenv('DARTC_INCREMENTAL', default=False))
|
||||
return op
|
||||
|
||||
|
||||
def _ParseOptions(cmd_line):
|
||||
op = _BuildOptions()
|
||||
(options, args) = op.parse_args(args=cmd_line)
|
||||
if not options.out:
|
||||
op.error('Flag "--out" not provided')
|
||||
if not options.dartc:
|
||||
op.error('Flag "--dartc" not provided')
|
||||
return (options, args)
|
||||
|
||||
|
||||
def main():
|
||||
(options, args) = _ParseOptions(sys.argv[1:])
|
||||
if path.exists(options.out):
|
||||
is_out_of_date = path.getmtime(options.dartc) > path.getmtime(options.out)
|
||||
if is_out_of_date or not options.incremental:
|
||||
print 'Deleting %r.' % options.out
|
||||
shutil.rmtree(options.out)
|
||||
command_array = [options.dartc]
|
||||
command_array.extend(['-out', options.out])
|
||||
command_array.extend(options.dartc_options)
|
||||
command_array.extend(args)
|
||||
print ' '.join([repr(a) for a in command_array])
|
||||
proc = subprocess.Popen(command_array)
|
||||
proc.communicate()
|
||||
sys.exit(proc.wait())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/bash --posix
|
||||
#
|
||||
# Copyright (c) 2011, 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.
|
||||
|
||||
# Compiles either TotalDart or Thump based on benchmark and reports
|
||||
# the metrics back to the collector.
|
||||
# Removes 'out' directory if one exists.
|
||||
|
||||
# Determine where the libs are
|
||||
DARTC_HOME=`readlink -f .`
|
||||
DIST_DIR=$DARTC_HOME/compiler
|
||||
DARTC_BIN=$DIST_DIR/bin/dartc
|
||||
|
||||
# A word about directories
|
||||
# The project directories are now copied before this script runs and we just have to change
|
||||
# in to the correct sub-directory to compile. We'll send the output of compiles and metrics
|
||||
# to the script directory instead of poluting the cache.
|
||||
LAST_ARG=`readlink -f ${!#}`
|
||||
BENCH_DIR=`dirname $LAST_ARG`
|
||||
|
||||
# Big hack. We assume that the benchmark argument in the list:
|
||||
# x/y/dart/BenchmarkName.dart
|
||||
BENCH_NAME=`basename $LAST_ARG .dart`
|
||||
|
||||
# Currently we only benchmark the compilation of two applications;
|
||||
# Redpill's Thump and Dart's Total.
|
||||
if [ $BENCH_NAME == "Total" ]; then
|
||||
cd $BENCH_DIR/samples/total/src/
|
||||
APP_FILE=Total.dart
|
||||
DART_MAIN_FILE=Total.dart
|
||||
else
|
||||
if [ $BENCH_NAME == "Thump" ]; then
|
||||
cd $BENCH_DIR/samples/swarm
|
||||
APP_FILE=swarm.dart
|
||||
DART_MAIN_FILE=SwarmApp.dart
|
||||
else
|
||||
echo "ERROR: Compilation failed - benchmark ${BENCH_NAME} != Total | Thump" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DARTC_FLAGS="--metrics --out $DARTC_HOME/out "
|
||||
|
||||
# Warmup period, run the compiler a few times to warm up the os/filesystem/etc
|
||||
# before collecting metrics
|
||||
$DARTC_BIN $DARTC_FLAGS -noincremental $APP_FILE > /dev/null 2>&1
|
||||
rm -Rf $DARTC_HOME/out
|
||||
|
||||
# Full compile metrics
|
||||
$DARTC_BIN $DARTC_FLAGS -noincremental $APP_FILE > $DARTC_HOME/build.full.txt
|
||||
|
||||
# Single file delta incremental metrics
|
||||
touch $DART_MAIN_FILE
|
||||
$DARTC_BIN $DARTC_FLAGS $APP_FILE > $DARTC_HOME/build.incr.txt
|
||||
|
||||
# Generate output for the metrics collection
|
||||
SED_FULL_CMD="s/^[^#].*/${BENCH_NAME}-full-&/p"
|
||||
SED_INCR_CMD="s/^[^#].*/${BENCH_NAME}-incr-&/p"
|
||||
sed -ne $SED_FULL_CMD $DARTC_HOME/build.full.txt
|
||||
sed -ne $SED_INCR_CMD $DARTC_HOME/build.incr.txt
|
||||
|
||||
# Cleanup compiled output and metrics captures
|
||||
rm -rf $DARTC_HOME/out $DARTC_HOME/build.full.txt $DARTC_HOME/build.incr.txt
|
||||
|
||||
if [ ! "$? " = "0 " ]; then
|
||||
echo "ERROR: Compilation failed." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
#!/bin/bash --posix
|
||||
#
|
||||
# Copyright (c) 2012, 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.
|
||||
|
||||
|
||||
# Prevent problems where the caller has exported CLASSPATH, causing our
|
||||
# computed value to be copied into the environment and double-counted
|
||||
# against the argv limit.
|
||||
unset CLASSPATH
|
||||
|
||||
# Figure out where the dartc home is
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
DARTC_HOME=`cd $SCRIPT_DIR; pwd`
|
||||
DARTC_LIBS=$DIST_DIR/lib
|
||||
DIST_DIR=$DARTC_HOME/compiler
|
||||
|
||||
DARTC_FLAGS=""
|
||||
|
||||
# Make it easy to insert 'set -x' or similar commands when debugging problems with this script.
|
||||
eval "$JAVA_STUB_DEBUG"
|
||||
|
||||
JVM_FLAGS_CMDLINE=""
|
||||
|
||||
while [ ! -z "$1" ]; do
|
||||
case "$1" in
|
||||
--prof)
|
||||
# Ensure the preset -optimize flag is gone when profiling.
|
||||
DARTC_FLAGS="--prof"
|
||||
shift ;;
|
||||
--debug)
|
||||
JVM_DEBUG_PORT=${DEFAULT_JVM_DEBUG_PORT:-"5005"}
|
||||
shift ;;
|
||||
--debug=*)
|
||||
JVM_DEBUG_PORT=${1/--debug=/}
|
||||
shift ;;
|
||||
--jvm_flags=*)
|
||||
JVM_FLAGS_CMDLINE="$JVM_FLAGS_CMDLINE ${1/--jvm_flags=/}"
|
||||
shift ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$JVM_DEBUG_PORT" != "" ]; then
|
||||
JVM_DEBUG_SUSPEND=${DEFAULT_JVM_DEBUG_SUSPEND:-"y"}
|
||||
JVM_DEBUG_FLAGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=${JVM_DEBUG_SUSPEND},address=${JVM_DEBUG_PORT}"
|
||||
fi
|
||||
|
||||
shopt -s execfail # Return control to this script if exec fails.
|
||||
exec $JAVABIN -ea -classpath @CLASSPATH@ \
|
||||
${JVM_DEBUG_FLAGS} \
|
||||
${JVM_FLAGS} \
|
||||
${JVM_FLAGS_CMDLINE} \
|
||||
com.google.dart.compiler.DartCompiler \
|
||||
$DARTC_FLAGS \
|
||||
"$@"
|
||||
|
||||
echo "ERROR: couldn't exec ${JAVABIN}." 1>&2
|
||||
|
||||
exit 1
|
|
@ -1,20 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2012, 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.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def Main():
|
||||
script_name = os.path.basename(sys.argv[0])
|
||||
script_dir = os.path.dirname(sys.argv[0])
|
||||
dartc_script = os.path.join(script_dir, 'compiler', 'bin', 'dartc')
|
||||
os.putenv("DART_SCRIPT_NAME", script_name)
|
||||
|
||||
return os.execv(dartc_script, [dartc_script] + sys.argv[1:])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(Main())
|
|
@ -30,9 +30,6 @@ def Main():
|
|||
if exit_code:
|
||||
return exit_code
|
||||
|
||||
if exit_code:
|
||||
return exit_code
|
||||
|
||||
if '--no-gyp' in sys.argv:
|
||||
print '--no-gyp is deprecated.'
|
||||
|
||||
|
|
3
dart.gyp
3
dart.gyp
|
@ -12,7 +12,7 @@
|
|||
'target_name': 'compiler',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'compiler/dart-compiler.gyp:dartc',
|
||||
'compiler/dart-compiler.gyp:dart_analyzer',
|
||||
],
|
||||
'actions': []
|
||||
},
|
||||
|
@ -30,6 +30,7 @@
|
|||
'type': 'none',
|
||||
'dependencies': [
|
||||
'runtime',
|
||||
'compiler',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
||||
# Copyright (c) 2012, 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.
|
||||
#
|
||||
|
@ -16,6 +16,7 @@
|
|||
# ......dart or dart.exe (executable)
|
||||
# ......frogc.dart
|
||||
# ......frogsh (coming later)
|
||||
# ......dart_analyzer
|
||||
# ....lib/
|
||||
# ......builtin/
|
||||
# ........builtin_runtime.dart
|
||||
|
@ -47,6 +48,9 @@
|
|||
# ......utf/
|
||||
# ......(more will come here)
|
||||
# ....util/
|
||||
# .......analyzer/
|
||||
# .........dart_analyzer.jar
|
||||
# .........(third-party libraries for dart_analyzer)
|
||||
# ......(more will come here)
|
||||
|
||||
|
||||
|
@ -114,9 +118,11 @@ def Main(argv):
|
|||
build_dir = os.path.dirname(argv[1])
|
||||
frogc_file_extension = ''
|
||||
dart_file_extension = ''
|
||||
analyzer_file_extension = ''
|
||||
if utils.GuessOS() == 'win32':
|
||||
dart_file_extension = '.exe'
|
||||
frogc_file_extension = '.bat'
|
||||
analyzer_file_extension = '.sh' # TODO(zundel): never tested on Windows
|
||||
dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
|
||||
dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
|
||||
frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap',
|
||||
|
@ -126,6 +132,12 @@ def Main(argv):
|
|||
copymode(dart_src_binary, dart_dest_binary)
|
||||
copyfile(frogc_src_binary, frogc_dest_binary)
|
||||
copymode(frogc_src_binary, frogc_dest_binary)
|
||||
ANALYZER_HOME = join(HOME, build_dir, 'analyzer')
|
||||
dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer')
|
||||
dart_analyzer_dest_binary = join(BIN,
|
||||
'dart_analyzer' + analyzer_file_extension)
|
||||
copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary)
|
||||
copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary)
|
||||
|
||||
# Create sdk/bin/frogc.dart, and hack as needed.
|
||||
frog_src_dir = join(HOME, 'frog')
|
||||
|
@ -416,8 +428,28 @@ def Main(argv):
|
|||
UTIL = join(SDK_tmp, 'util')
|
||||
os.makedirs(UTIL)
|
||||
|
||||
# Create and copy Analyzer library.
|
||||
|
||||
ANALYZER_DEST = join(UTIL, 'analyzer')
|
||||
os.makedirs(ANALYZER_DEST)
|
||||
|
||||
darta_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 'dart_analyzer.jar')
|
||||
darta_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar')
|
||||
copyfile(darta_src_jar, darta_dest_jar)
|
||||
|
||||
jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"),
|
||||
join("guava", "r09", "guava-r09.jar"),
|
||||
join("json", "r2_20080312", "json.jar") ]
|
||||
for jarToCopy in jarsToCopy:
|
||||
dest_dir = join (ANALYZER_DEST, os.path.dirname(jarToCopy))
|
||||
os.makedirs(dest_dir)
|
||||
dest_file = join (ANALYZER_DEST, jarToCopy)
|
||||
src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy)
|
||||
copyfile(src_file, dest_file)
|
||||
|
||||
|
||||
# Copy import maps
|
||||
|
||||
PLATFORMS = ['any', 'vm', 'dartium', 'dart2js', 'frog' ]
|
||||
os.makedirs(join(LIB, 'config'))
|
||||
for platform in PLATFORMS:
|
||||
|
|
|
@ -1171,9 +1171,8 @@ class JUnitTestSuite implements TestSuite {
|
|||
|
||||
void computeClassPath() {
|
||||
classPath = Strings.join(
|
||||
['$buildDir/compiler/lib/dartc.jar',
|
||||
'$buildDir/compiler-tests.jar',
|
||||
'$buildDir/closure_out/compiler.jar',
|
||||
['$buildDir/analyzer/util/analyzer/dart_analyzer.jar',
|
||||
'$buildDir/analyzer/dart_analyzer_tests.jar',
|
||||
// Third party libraries.
|
||||
'$dartDir/third_party/args4j/2.0.12/args4j-2.0.12.jar',
|
||||
'$dartDir/third_party/guava/r09/guava-r09.jar',
|
||||
|
@ -1237,7 +1236,7 @@ class TestUtils {
|
|||
case 'none':
|
||||
return 'dart$suffix';
|
||||
case 'dartc':
|
||||
return 'compiler/bin/dartc$suffix';
|
||||
return 'analyzer/bin/dart_analyzer$suffix';
|
||||
case 'frog':
|
||||
case 'dart2js':
|
||||
return 'frog/bin/frog$suffix';
|
||||
|
@ -1252,7 +1251,7 @@ class TestUtils {
|
|||
String suffix = executableSuffix(configuration['compiler']);
|
||||
switch (configuration['compiler']) {
|
||||
case 'dartc':
|
||||
return 'compiler/bin/dartc$suffix';
|
||||
return 'analyzer/bin/dart_analyzer$suffix';
|
||||
case 'frog':
|
||||
case 'dart2js':
|
||||
return 'frog/bin/frog$suffix';
|
||||
|
|
Loading…
Reference in a new issue