OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library runtime_configuration; | 5 library runtime_configuration; |
6 | 6 |
7 import 'compiler_configuration.dart' show CommandArtifact; | 7 import 'compiler_configuration.dart' show CommandArtifact; |
8 | 8 |
9 // TODO(ahe): Remove this import, we can precompute all the values required | 9 // TODO(ahe): Remove this import, we can precompute all the values required |
10 // from TestSuite once the refactoring is complete. | 10 // from TestSuite once the refactoring is complete. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 case 'none': | 47 case 'none': |
48 return new NoneRuntimeConfiguration(); | 48 return new NoneRuntimeConfiguration(); |
49 | 49 |
50 case 'vm': | 50 case 'vm': |
51 return new StandaloneDartRuntimeConfiguration(); | 51 return new StandaloneDartRuntimeConfiguration(); |
52 | 52 |
53 case 'dart_product': | 53 case 'dart_product': |
54 return new DartProductRuntimeConfiguration(); | 54 return new DartProductRuntimeConfiguration(); |
55 | 55 |
56 case 'dart_precompiled': | 56 case 'dart_precompiled': |
| 57 if (configuration['system'] == 'android') { |
| 58 return new DartPrecompiledAdbRuntimeConfiguration(useBlobs: useBlobs); |
| 59 } |
57 return new DartPrecompiledRuntimeConfiguration(useBlobs: useBlobs); | 60 return new DartPrecompiledRuntimeConfiguration(useBlobs: useBlobs); |
58 | 61 |
59 case 'drt': | 62 case 'drt': |
60 return new DrtRuntimeConfiguration(); | 63 return new DrtRuntimeConfiguration(); |
61 | 64 |
62 default: | 65 default: |
63 throw "Unknown runtime '$runtime'"; | 66 throw "Unknown runtime '$runtime'"; |
64 } | 67 } |
65 } | 68 } |
66 | 69 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 271 } |
269 augmentedArgs.addAll(arguments); | 272 augmentedArgs.addAll(arguments); |
270 | 273 |
271 return <Command>[ | 274 return <Command>[ |
272 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, | 275 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, |
273 augmentedArgs, environmentOverrides) | 276 augmentedArgs, environmentOverrides) |
274 ]; | 277 ]; |
275 } | 278 } |
276 } | 279 } |
277 | 280 |
| 281 class DartPrecompiledAdbRuntimeConfiguration |
| 282 extends DartVmRuntimeConfiguration { |
| 283 final bool useBlobs; |
| 284 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
| 285 |
| 286 List<Command> computeRuntimeCommands( |
| 287 TestSuite suite, |
| 288 CommandBuilder commandBuilder, |
| 289 CommandArtifact artifact, |
| 290 List<String> arguments, |
| 291 Map<String, String> environmentOverrides) { |
| 292 String script = artifact.filename; |
| 293 String type = artifact.mimeType; |
| 294 if (script != null && type != 'application/dart-precompiled') { |
| 295 throw "dart_precompiled cannot run files of type '$type'."; |
| 296 } |
| 297 |
| 298 String precompiledRunner = suite.dartPrecompiledBinaryFileName; |
| 299 return <Command>[ |
| 300 commandBuilder.getAdbPrecompiledCommand(precompiledRunner, |
| 301 artifact.filename, |
| 302 useBlobs) |
| 303 ]; |
| 304 } |
| 305 } |
| 306 |
278 /// Temporary runtime configuration for browser runtimes that haven't been | 307 /// Temporary runtime configuration for browser runtimes that haven't been |
279 /// migrated yet. | 308 /// migrated yet. |
280 // TODO(ahe): Remove this class. | 309 // TODO(ahe): Remove this class. |
281 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 310 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
282 List<Command> computeRuntimeCommands( | 311 List<Command> computeRuntimeCommands( |
283 TestSuite suite, | 312 TestSuite suite, |
284 CommandBuilder commandBuilder, | 313 CommandBuilder commandBuilder, |
285 CommandArtifact artifact, | 314 CommandArtifact artifact, |
286 List<String> arguments, | 315 List<String> arguments, |
287 Map<String, String> environmentOverrides) { | 316 Map<String, String> environmentOverrides) { |
288 throw "Unimplemented runtime '$runtimeType'"; | 317 throw "Unimplemented runtime '$runtimeType'"; |
289 } | 318 } |
290 } | 319 } |
OLD | NEW |