Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: tools/testing/dart/compiler_configuration.dart

Issue 2947473002: Basic support for dev_compiler in test.dart. (Closed)
Patch Set: Merge branch 'master' into ddc-chrome-tests Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/testing/dart/compiler_configuration.dart
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 1be5f2bcbe1d9d44e7ce110c6d339dfd76799c28..2ebe4bab7bb207846dd98a6eb662840e9a0228b9 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -6,6 +6,7 @@ import 'dart:io';
import 'command.dart';
import 'configuration.dart';
+import 'path.dart';
import 'runtime_configuration.dart';
import 'test_suite.dart';
import 'utils.dart';
@@ -73,6 +74,13 @@ abstract class CompilerConfiguration {
useKernel: configuration.useDart2JSWithKernel,
extraDart2jsOptions: configuration.dart2jsOptions);
+ case Compiler.dartdevc:
+ return new DartdevcCompilerConfiguration(
+ isDebug: configuration.mode.isDebug,
+ isChecked: configuration.isChecked,
+ isHostChecked: configuration.isHostChecked);
+ break;
+
case Compiler.appJit:
return new AppJitCompilerConfiguration(
isDebug: configuration.mode.isDebug,
@@ -480,11 +488,11 @@ class Dart2xCompilerConfiguration extends CompilerConfiguration {
return Command.compilation(
moniker,
outputFileName,
- !useSdk,
bootstrapDependencies(buildDir),
computeCompilerPath(buildDir),
arguments,
- environmentOverrides);
+ environmentOverrides,
+ alwaysCompile: !useSdk);
}
List<Uri> bootstrapDependencies(String buildDir) {
@@ -556,6 +564,55 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
}
}
+/// Configuration for dart2js compiler.
+class DartdevcCompilerConfiguration extends CompilerConfiguration {
+ DartdevcCompilerConfiguration(
+ {bool isDebug, bool isChecked, bool isHostChecked})
+ : super._subclass(
+ isDebug: isDebug,
+ isChecked: isChecked,
+ isHostChecked: isHostChecked,
+ useSdk: true);
+
+ String computeCompilerPath(String buildDir) {
+ var dir = useSdk ? "$buildDir/dart-sdk" : "sdk";
Bill Hesse 2017/06/21 16:33:20 This is not currently reachable (the non-sdk case)
Bob Nystrom 2017/06/21 20:18:28 Good catch. I think I wrote this before I required
+ return "$dir/bin/dartdevc$executableScriptSuffix";
+ }
+
+ CommandArtifact computeCompilationArtifact(String buildDir, String tempDir,
+ List<String> arguments, Map<String, String> environmentOverrides) {
+ // TODO(rnystrom): There is a lot of overlap between this code and
+ // _dartdevcCompileCommand() in test_suite.dart. This code path is only hit
+ // when the test is expected to have a compile error. Consider refactoring
+ // to unify the two (and likewise for dart2js).
+
+ // TODO(rnystrom): Are there other arguments here that we need to keep?
+ // What about arguments specified in the test itself?
+ var inputFile = arguments.last;
+
+ var compilerArguments = [
+ "--dart-sdk",
+ "$buildDir/dart-sdk",
+ "--library-root",
+ new Path(inputFile).directoryPath.toString(),
+ "-o",
+ "$tempDir/out.js",
+ inputFile
+ ];
+
+ var command = Command.compilation(
+ Compiler.dartdevc.name,
+ "$tempDir/out.js",
+ bootstrapDependencies(buildDir),
+ computeCompilerPath(buildDir),
+ compilerArguments,
+ environmentOverrides);
+
+ return new CommandArtifact(
+ [command], "$tempDir/out.js", "application/javascript");
+ }
+}
+
class PrecompilerCompilerConfiguration extends CompilerConfiguration {
final Architecture arch;
final bool useBlobs;
@@ -622,8 +679,9 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
}
args.addAll(arguments);
- return Command.compilation('precompiler', tempDir, !useSdk,
- bootstrapDependencies(buildDir), exec, args, environmentOverrides);
+ return Command.compilation('precompiler', tempDir,
+ bootstrapDependencies(buildDir), exec, args, environmentOverrides,
+ alwaysCompile: !useSdk);
}
Command computeAssembleCommand(String tempDir, String buildDir,
@@ -689,8 +747,9 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
args.add('$tempDir/out.aotsnapshot');
args.add('$tempDir/out.S');
- return Command.compilation('assemble', tempDir, !useSdk,
- bootstrapDependencies(buildDir), exec, args, environmentOverrides);
+ return Command.compilation('assemble', tempDir,
+ bootstrapDependencies(buildDir), exec, args, environmentOverrides,
+ alwaysCompile: !useSdk);
}
// This step reduces the amount of space needed to run the precompilation
@@ -700,8 +759,9 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
var exec = 'rm';
var args = ['$tempDir/out.S'];
- return Command.compilation('remove_assembly', tempDir, !useSdk,
- bootstrapDependencies(buildDir), exec, args, environmentOverrides);
+ return Command.compilation('remove_assembly', tempDir,
+ bootstrapDependencies(buildDir), exec, args, environmentOverrides,
+ alwaysCompile: !useSdk);
}
List<String> filterVmOptions(List<String> vmOptions) {
@@ -783,8 +843,9 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
var args = ["--snapshot=$snapshot", "--snapshot-kind=app-jit"];
args.addAll(arguments);
- return Command.compilation('app_jit', tempDir, !useSdk,
- bootstrapDependencies(buildDir), exec, args, environmentOverrides);
+ return Command.compilation('app_jit', tempDir,
+ bootstrapDependencies(buildDir), exec, args, environmentOverrides,
+ alwaysCompile: !useSdk);
}
List<String> computeCompilerArguments(

Powered by Google App Engine
This is Rietveld 408576698