Chromium Code Reviews| 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( |