Rollback breaking change.

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@188 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
johnlenz@google.com 2011-10-07 01:16:59 +00:00
parent b5b46da81c
commit 5d45b72a3a
10 changed files with 122 additions and 86 deletions

View file

@ -4,9 +4,9 @@
package com.google.dart.compiler; package com.google.dart.compiler;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.dart.runner.DartRunner; import com.google.dart.runner.DartRunner;
import com.google.dart.runner.RunnerOptions;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
@ -42,19 +42,18 @@ public class CommandLineOptions {
usage = "Debugging: disable type optimizations") usage = "Debugging: disable type optimizations")
private boolean disableTypeOptimizations = false; private boolean disableTypeOptimizations = false;
@Option(name = "--documentation-lib", aliases = { "-documentation-lib" }, @Option(name = "-documentation-lib",
usage = "only generate documentation for the given library") usage = "only generate documentation for the given library")
private String documentationLibrary = null; private String documentationLibrary = null;
@Option(name = "--documentation-out", aliases = { "-documentation-out" }, @Option(name = "-documentation-out", usage = "directory to receive documentation output")
usage = "directory to receive documentation output")
private String documentationOutputDirectory = null; private String documentationOutputDirectory = null;
@Option(name = "--generate-documentation", aliases = { "-generate-documentation" }, @Option(name = "-generate-documentation",
usage = "generate documentation for the provided source files") usage = "generate documentation for the provided source files")
private boolean generateDocumentation = false; private boolean generateDocumentation = false;
@Option(name = "--generate-isolate-stubs", aliases = { "-generate-isolate-stubs" }, @Option(name = "-generate-isolate-stubs",
usage = "classes to generate stubs for, comma-separated") usage = "classes to generate stubs for, comma-separated")
private String generateIsolateStubs = null; private String generateIsolateStubs = null;
@ -65,63 +64,50 @@ public class CommandLineOptions {
@Option(name = "--ignore-unrecognized-flags", usage = "ignore unrecognized command line flags") @Option(name = "--ignore-unrecognized-flags", usage = "ignore unrecognized command line flags")
private boolean ignoreUnrecognizedFlags = false; private boolean ignoreUnrecognizedFlags = false;
@Option(name = "--isolate-stub-out", aliases = { "-isolate-stub-out" }, @Option(name = "-isolate-stub-out", usage = "file to receive generated stub output")
usage = "file to receive generated stub output")
private String isolateStubOutputFile = null; private String isolateStubOutputFile = null;
@Option(name = "--jvm-metrics-detail", usage = "summary or verbose (default is summary)") @Option(name = "-jvm-metrics-detail", usage = "summary or verbose (default is summary)")
private String jvmMetricDetail = "summary"; private String jvmMetricDetail = "summary";
@Option(name = "--jvm-metrics-format", usage = "tabular or pretty (default is tabular)") @Option(name = "-jvm-metrics-format", usage = "tabular or pretty (default is tabular)")
private String jvmMetricFormat = "tabular"; private String jvmMetricFormat = "tabular";
@Option(name = "--jvm-metrics-type", usage = "comma-separated list, including:\n" @Option(name = "-jvm-metrics-type", usage = "comma-separated list, including:\n"
+ " all: show all available stat types (default)\n" + " all: show all available stat types (default)\n"
+ " gc: show garbage collection stats\n" + " gc: show garbage collection stats\n"
+ " mem: show memory stats\n" + " jit: show jit stats") + " mem: show memory stats\n" + " jit: show jit stats")
private String jvmMetricType = "all"; private String jvmMetricType = "all";
@Option(name = "--noincremental", aliases = { "-noincremental" }, @Option(name = "-noincremental", usage = "disable incremental compilation")
usage = "disable incremental compilation")
private boolean noincremental = false; private boolean noincremental = false;
// see shouldOptimize() below
private boolean optimize = false; private boolean optimize = false;
/**
* Enables optimization of the generated JavaScript.
*/
@Option(name = "--optimize", aliases = { "-optimize" }, usage = "produce optimized code")
public void setOptimize(boolean optimize) {
this.optimize = optimize;
}
@Option(name = "--out", usage = "write generated JavaScript to the specified file")
private File outputFilename = null;
// TODO(zundel): -out is for backward compatibility until scripts are updated // TODO(zundel): -out is for backward compatibility until scripts are updated
@Option(name = "--work", aliases = { "-out" }, usage = "directory to receive compiler output") @Option(name = "--work", aliases = { "-out" }, usage = "directory to receive compiler output")
private File workDirectory = new File("out"); private File workDirectory = new File("out");
@Option(name = "--help", aliases = { "-?", "-help" }, usage = "prints this help message") @Option(name = "-help", usage = "prints this help message")
private boolean showHelp = false; private boolean showHelp = false;
@Option(name = "--jvm-metrics", usage = "print jvm metrics at end of compilation") @Option(name = "-jvm-metrics", usage = "print jvm metrics at end of compilation")
private boolean showJvmMetrics = false; private boolean showJvmMetrics = false;
@Option(name = "--metrics", usage = "print compilation metrics") @Option(name = "-metrics", usage = "print compilation metrics")
private boolean showMetrics = false; private boolean showMetrics = false;
@Argument
private final List<String> sourceFiles = new ArrayList<String>();
@Option(name = "--fatal-type-errors", aliases = { "-fatal-type-errors" }, @Option(name = "--fatal-type-errors", aliases = { "-fatal-type-errors" },
usage = "type errors are fatal errors (instead of warnings)") usage = "type errors are fatal errors (instead of warnings)")
private boolean typeErrorsAreFatal = false; private boolean typeErrorsAreFatal = false;
@Option(name = "--fatal-warnings", aliases = { "-Werror" }, @Option(name = "-Werror", usage = "warnings (excluding type warnings) are fatal errors")
usage = "warnings (excluding type warnings) are fatal errors")
private boolean warningsAreFatal = false; private boolean warningsAreFatal = false;
@Argument
private final List<String> sourceFiles = new ArrayList<String>();
/** /**
* Returns whether the option -check-only is provided. * Returns whether the option -check-only is provided.
*/ */
@ -194,11 +180,11 @@ public class CommandLineOptions {
/** /**
* Returns whether the compiler should attempt to incrementally recompile. * Returns whether the compiler should attempt to incrementally recompile.
*/ */
public boolean buildIncrementally() { public boolean incremental() {
return !noincremental; return !noincremental;
} }
public boolean shouldBatch() { public boolean isBatch() {
return batch; return batch;
} }
@ -210,6 +196,17 @@ public class CommandLineOptions {
return generateHumanReadableOutput; return generateHumanReadableOutput;
} }
/**
* Enables optimization of the generated JavaScript.
*/
@Option(name = "-optimize", aliases = { "--optimize" }, usage = "produce optimized code")
public void optimize(boolean optimize) {
this.optimize = optimize;
}
@Option(name = "--out", usage = "write generated JavaScript to the specified file")
private File outputFilename = null;
/** /**
* @return the path to receive compiler output. * @return the path to receive compiler output.
*/ */
@ -257,7 +254,7 @@ public class CommandLineOptions {
/** /**
* Command line options accepted by the {@link DartRunner} entry point. * Command line options accepted by the {@link DartRunner} entry point.
*/ */
public static class DartRunnerOptions extends CompilerOptions implements RunnerOptions { public static class DartRunnerOptions extends CompilerOptions {
@Option(name = "--compile-only", usage = "compile but do not execute") @Option(name = "--compile-only", usage = "compile but do not execute")
private boolean compileOnly = false; private boolean compileOnly = false;
@ -265,19 +262,18 @@ public class CommandLineOptions {
@Option(name = "--expose_core_impl", usage = "automatic import of dart:coreimpl library") @Option(name = "--expose_core_impl", usage = "automatic import of dart:coreimpl library")
private boolean exposeCoreImpl = false; private boolean exposeCoreImpl = false;
@Option(name = "--verbose", usage = "extra diagnostic output")
private boolean verbose = false;
@Option(name="--prof", usage = "enable profiling") @Option(name="--prof", usage = "enable profiling")
private boolean prof; private boolean prof;
@Option(name = "--rhino", usage = "use rhino as the JavaScript interpreter") @Option(name = "--rhino", usage = "use rhino as the JavaScript interpreter")
private boolean rhino = false; private boolean rhino = false;
@Option(name = "--verbose", usage = "extra diagnostic output")
private boolean verbose = false;
/** /**
* @return <code>true</code> if the program should compile but not execute. * @return <code>true</code> if the program should compile but not execute.
*/ */
@Override
public boolean shouldCompileOnly() { public boolean shouldCompileOnly() {
return compileOnly; return compileOnly;
} }
@ -292,7 +288,6 @@ public class CommandLineOptions {
/** /**
* Returns <code>true</code> if profiling is enabled. * Returns <code>true</code> if profiling is enabled.
*/ */
@Override
public boolean shouldProfile() { public boolean shouldProfile() {
return prof; return prof;
} }
@ -300,7 +295,6 @@ public class CommandLineOptions {
/** /**
* @return <code>true</code> if rhino should be used as the runtime (default is to invoke d8) * @return <code>true</code> if rhino should be used as the runtime (default is to invoke d8)
*/ */
@Override
public boolean useRhino() { public boolean useRhino() {
return rhino; return rhino;
} }
@ -308,7 +302,6 @@ public class CommandLineOptions {
/** /**
* @return <code>true</code> to enable diagnostic output * @return <code>true</code> to enable diagnostic output
*/ */
@Override
public boolean verbose() { public boolean verbose() {
return verbose; return verbose;
} }
@ -350,6 +343,7 @@ public class CommandLineOptions {
} }
CmdLineParser cmdLineParser = new CmdLineParser(parsedOptions); CmdLineParser cmdLineParser = new CmdLineParser(parsedOptions);
for (int i = 0, len = args.length; i < len; i++) { for (int i = 0, len = args.length; i < len; i++) {
System.out.println("Parsing: " + Joiner.on(" ").join(args));
try { try {
cmdLineParser.parseArgument(args); cmdLineParser.parseArgument(args);
} catch (CmdLineException e) { } catch (CmdLineException e) {
@ -362,7 +356,8 @@ public class CommandLineOptions {
List<String> newArgs = Lists.newArrayList(); List<String> newArgs = Lists.newArrayList();
for (String arg : args) { for (String arg : args) {
if (arg.equals(option)) { if (arg.equals(option)) {
System.out.println("(Ignoring unrecognized flag: " + arg + ")"); // TODO(zundel): remove diagnostic output
System.out.println("Ignoring unrecognized flag: " + arg);
continue; continue;
} }
newArgs.add(arg); newArgs.add(arg);

View file

@ -783,7 +783,7 @@ public class DartCompiler {
CompilerOptions topCompilerOptions = processCommandLineOptions(args); CompilerOptions topCompilerOptions = processCommandLineOptions(args);
boolean result = false; boolean result = false;
try { try {
if (topCompilerOptions.shouldBatch()) { if (topCompilerOptions.isBatch()) {
if (args.length > 1) { if (args.length > 1) {
System.err.println("(Extra arguments specified with -batch ignored.)"); System.err.println("(Extra arguments specified with -batch ignored.)");
} }
@ -791,7 +791,7 @@ public class DartCompiler {
@Override @Override
public boolean invoke(String[] args) throws Throwable { public boolean invoke(String[] args) throws Throwable {
CompilerOptions compilerOptions = processCommandLineOptions(args); CompilerOptions compilerOptions = processCommandLineOptions(args);
if (compilerOptions.shouldBatch()) { if (compilerOptions.isBatch()) {
System.err.println("-batch ignored: Already in batch mode."); System.err.println("-batch ignored: Already in batch mode.");
} }
return compilerMain(compilerOptions); return compilerMain(compilerOptions);

View file

@ -162,7 +162,7 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration {
@Override @Override
public boolean incremental() { public boolean incremental() {
return compilerOptions.buildIncrementally(); return compilerOptions.incremental();
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import com.google.common.io.CharStreams;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.google.dart.compiler.Backend; import com.google.dart.compiler.Backend;
import com.google.dart.compiler.CommandLineOptions; import com.google.dart.compiler.CommandLineOptions;
import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.dart.compiler.CommandLineOptions.DartRunnerOptions; import com.google.dart.compiler.CommandLineOptions.DartRunnerOptions;
import com.google.dart.compiler.CompilerConfiguration; import com.google.dart.compiler.CompilerConfiguration;
import com.google.dart.compiler.DartArtifactProvider; import com.google.dart.compiler.DartArtifactProvider;
@ -45,8 +46,10 @@ import java.net.URI;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class DartRunner { public class DartRunner {
@ -99,6 +102,26 @@ public class DartRunner {
LibrarySource app = new UrlLibrarySource(new File(script)); LibrarySource app = new UrlLibrarySource(new File(script));
// TODO(zundel): Replace RunnerFlag enum with DartRunnerOptions
final Set<RunnerFlag> flags = EnumSet.noneOf(RunnerFlag.class);
if (options.shouldOptimize()) {
flags.add(RunnerFlag.OPTIMIZE);
}
if (options.verbose()) {
flags.add(RunnerFlag.VERBOSE);
}
if (options.shouldProfile()) {
flags.add(RunnerFlag.PROFILE);
}
if (options.shouldCompileOnly()) {
flags.add(RunnerFlag.COMPILE_ONLY);
}
if (options.typeErrorsAreFatal()) {
flags.add(RunnerFlag.FATAL_TYPE_ERRORS);
}
if (options.useRhino()) {
flags.add(RunnerFlag.USE_RHINO);
}
if (options.shouldExposeCoreImpl()) { if (options.shouldExposeCoreImpl()) {
imports = new ArrayList<LibrarySource>(imports); imports = new ArrayList<LibrarySource>(imports);
// use a place-holder LibrarySource instance, to be replaced when embedded // use a place-holder LibrarySource instance, to be replaced when embedded
@ -119,7 +142,7 @@ public class DartRunner {
}; };
CompilationResult compiled; CompilationResult compiled;
compiled = compileApp(app, imports, options, listener); compiled = compileApp(app, imports, flags, listener);
if (listener.getProblemCount() != 0) { if (listener.getProblemCount() != 0) {
throw new RunnerError("Compilation failed."); throw new RunnerError("Compilation failed.");
@ -150,9 +173,8 @@ public class DartRunner {
} }
} }
if (!options.shouldCompileOnly()) { if (!flags.contains(RunnerFlag.COMPILE_ONLY)) {
runApp(compiled, app.getName(), options, scriptArguments.toArray(new String[0]), runApp(compiled, app.getName(), flags, scriptArguments.toArray(new String[0]), stdout, stderr);
stdout, stderr);
} }
} }
@ -269,7 +291,7 @@ public class DartRunner {
} }
public static void compileAndRunApp(LibrarySource app, public static void compileAndRunApp(LibrarySource app,
DartRunnerOptions options, Set<RunnerFlag> flags,
CompilerConfiguration config, CompilerConfiguration config,
DartCompilerListener listener, DartCompilerListener listener,
String[] dartArguments, String[] dartArguments,
@ -278,21 +300,20 @@ public class DartRunner {
throws RunnerError { throws RunnerError {
CompilationResult compiled = compileApp( CompilationResult compiled = compileApp(
app, Collections.<LibrarySource>emptyList(), config, listener); app, Collections.<LibrarySource>emptyList(), config, listener);
runApp(compiled, app.getName(), options, dartArguments, stdout, stderr); runApp(compiled, app.getName(), flags, dartArguments, stdout, stderr);
} }
private static void runApp(CompilationResult compiled, private static void runApp(CompilationResult compiled,
String sourceName, String sourceName,
DartRunnerOptions options, Set<RunnerFlag> flags,
String[] scriptArguments, String[] scriptArguments,
PrintStream stdout, PrintStream stdout,
PrintStream stderr) PrintStream stderr)
throws RunnerError { throws RunnerError {
if (flags.contains(RunnerFlag.USE_RHINO)) {
if (options.useRhino()) { new RhinoLauncher().execute(compiled.js, sourceName, scriptArguments, flags, stdout, stderr);
new RhinoLauncher().execute(compiled.js, sourceName, scriptArguments, options, stdout, stderr);
} else { } else {
new V8Launcher(compiled.mapping).execute(compiled.js, sourceName, scriptArguments, options, new V8Launcher(compiled.mapping).execute(compiled.js, sourceName, scriptArguments, flags,
stdout, stderr); stdout, stderr);
} }
} }
@ -307,15 +328,22 @@ public class DartRunner {
} }
} }
private static CompilationResult compileApp (LibrarySource app, List<LibrarySource> imports, private static CompilationResult compileApp(LibrarySource app,
final DartRunnerOptions options, DartCompilerListener listener) throws RunnerError { List<LibrarySource> imports,
final Set<RunnerFlag> flags,
DartCompilerListener listener)
throws RunnerError {
// TODO(johnlenz): create a "OptimizingCompilerConfiguration"
Backend backend; Backend backend;
if (options.shouldOptimize()) { CompilerOptions defaultOptions = new CompilerOptions();
if (flags.contains(RunnerFlag.OPTIMIZE)) {
backend = new ClosureJsBackend(); backend = new ClosureJsBackend();
defaultOptions.optimize(true);
} else { } else {
backend = new JavascriptBackend(); backend = new JavascriptBackend();
} }
CompilerConfiguration config = new DefaultCompilerConfiguration(backend, options) { CompilerConfiguration config = new DefaultCompilerConfiguration(backend, defaultOptions) {
@Override @Override
public boolean expectEntryPoint() { public boolean expectEntryPoint() {
return true; return true;
@ -323,7 +351,7 @@ public class DartRunner {
@Override @Override
public boolean typeErrorsAreFatal() { public boolean typeErrorsAreFatal() {
return options.typeErrorsAreFatal(); return flags.contains(RunnerFlag.FATAL_TYPE_ERRORS);
} }
}; };
return compileApp(app, imports, config, listener); return compileApp(app, imports, config, listener);

View file

@ -5,6 +5,7 @@
package com.google.dart.runner; package com.google.dart.runner;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Set;
/** /**
* @author floitsch@google.com (Florian Loitsch) * @author floitsch@google.com (Florian Loitsch)
@ -12,7 +13,7 @@ import java.io.PrintStream;
*/ */
interface JavaScriptLauncher { interface JavaScriptLauncher {
void execute(String jsScript, String sourceName, String[] args, RunnerOptions flags, void execute(String jsScript, String sourceName, String[] args, Set<RunnerFlag> flags,
PrintStream stdout, PrintStream stderr) PrintStream stdout, PrintStream stderr)
throws RunnerError; throws RunnerError;

View file

@ -13,6 +13,7 @@ import org.mozilla.javascript.Undefined;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.reflect.Member; import java.lang.reflect.Member;
import java.util.Set;
/** /**
* @author floitsch@google.com (Florian Loitsch) * @author floitsch@google.com (Florian Loitsch)
@ -177,7 +178,7 @@ public class RhinoLauncher implements JavaScriptLauncher {
} }
@Override @Override
public void execute(String jsScript, String sourceName, String[] args, RunnerOptions options, public void execute(String jsScript, String sourceName, String[] args, Set<RunnerFlag> flags,
PrintStream stdout, PrintStream stderr) PrintStream stdout, PrintStream stderr)
throws RunnerError { throws RunnerError {
try { try {
@ -201,7 +202,7 @@ public class RhinoLauncher implements JavaScriptLauncher {
} catch (RhinoException e) { } catch (RhinoException e) {
// TODO(jgw): This is a hack to dump the translated source when something goes wrong. It can // TODO(jgw): This is a hack to dump the translated source when something goes wrong. It can
// be removed as soon as we have a source map we can use to provide source-level errors. // be removed as soon as we have a source map we can use to provide source-level errors.
if (options.verbose()) { if (flags.contains(RunnerFlag.VERBOSE)) {
stdout.println(jsScript); stdout.println(jsScript);
stdout.flush(); stdout.flush();
} }

View file

@ -0,0 +1,17 @@
// 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.
package com.google.dart.runner;
/**
* Flags that can be given to Runners and Launchers.
*/
public enum RunnerFlag {
VERBOSE,
PROFILE,
OPTIMIZE,
COMPILE_ONLY,
USE_RHINO,
FATAL_TYPE_ERRORS;
}

View file

@ -32,7 +32,7 @@ public class TestRunner {
try { try {
boolean runBatch = false; boolean runBatch = false;
TestRunnerOptions options = processCommandLineOptions(args); TestRunnerOptions options = processCommandLineOptions(args);
if (options.shouldBatch()) { if (options.isBatch()) {
runBatch = true; runBatch = true;
if (args.length > 1) { if (args.length > 1) {
System.err.println("(Extra arguments specified with -batch ignored.)"); System.err.println("(Extra arguments specified with -batch ignored.)");

View file

@ -20,6 +20,7 @@ import java.io.StringWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author floitsch@google.com (Florian Loitsch) * @author floitsch@google.com (Florian Loitsch)
@ -69,7 +70,7 @@ public class V8Launcher implements JavaScriptLauncher {
} }
@Override @Override
public void execute(String jsScript, String sourceName, String[] args, RunnerOptions options, public void execute(String jsScript, String sourceName, String[] args, Set<RunnerFlag> flags,
PrintStream stdout, PrintStream stderr) PrintStream stdout, PrintStream stderr)
throws RunnerError { throws RunnerError {
if (!isConfigured()) { if (!isConfigured()) {
@ -85,7 +86,7 @@ public class V8Launcher implements JavaScriptLauncher {
ArrayList<String> command = new ArrayList<String>(); ArrayList<String> command = new ArrayList<String>();
command.add(v8Executable().getAbsolutePath()); command.add(v8Executable().getAbsolutePath());
command.add(sourceFile.getAbsolutePath()); command.add(sourceFile.getAbsolutePath());
if (options.shouldProfile()) { if (flags.contains(RunnerFlag.PROFILE)) {
command.add("--prof"); command.add("--prof");
} }
command.add("--"); command.add("--");
@ -132,7 +133,7 @@ public class V8Launcher implements JavaScriptLauncher {
if (exitValue != 0) { if (exitValue != 0) {
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
PrintWriter out = new PrintWriter(stringWriter); PrintWriter out = new PrintWriter(stringWriter);
if (options.verbose()) { if (flags.contains(RunnerFlag.VERBOSE)) {
out.println(jsScript); out.println(jsScript);
} }
out.println("Execution failed."); out.println("Execution failed.");

View file

@ -4,8 +4,6 @@
package com.google.dart.compiler.end2end; package com.google.dart.compiler.end2end;
import com.google.dart.compiler.CommandLineOptions;
import com.google.dart.compiler.CommandLineOptions.DartRunnerOptions;
import com.google.dart.compiler.CompilerConfiguration; import com.google.dart.compiler.CompilerConfiguration;
import com.google.dart.compiler.CompilerTestCase; import com.google.dart.compiler.CompilerTestCase;
import com.google.dart.compiler.DartCompilerListener; import com.google.dart.compiler.DartCompilerListener;
@ -19,9 +17,11 @@ import com.google.dart.compiler.backend.js.ClosureJsBackend;
import com.google.dart.compiler.backend.js.JavascriptBackend; import com.google.dart.compiler.backend.js.JavascriptBackend;
import com.google.dart.runner.DartRunner; import com.google.dart.runner.DartRunner;
import com.google.dart.runner.RunnerError; import com.google.dart.runner.RunnerError;
import com.google.dart.runner.RunnerFlag;
import org.mozilla.javascript.RhinoException; import org.mozilla.javascript.RhinoException;
import java.util.EnumSet;
import java.util.List; import java.util.List;
/** /**
@ -71,16 +71,9 @@ public abstract class End2EndTestCase extends CompilerTestCase {
protected void runTest(LibrarySource app, OptimizationLevel opLevel, protected void runTest(LibrarySource app, OptimizationLevel opLevel,
DartCompilerListener listener) { DartCompilerListener listener) {
try { try {
final CompilerConfiguration config = getCompilerConfiguration(opLevel); CompilerConfiguration config = getCompilerConfiguration(opLevel);
DartRunnerOptions verboseOptions = new CommandLineOptions.DartRunnerOptions() {
@Override
public boolean verbose() {
return true;
}
};
DartRunner.compileAndRunApp(app, DartRunner.compileAndRunApp(app,
verboseOptions, EnumSet.of(RunnerFlag.VERBOSE),
config, config,
listener, listener,
new String[0], new String[0],