| 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 'dart:io' show Platform; |
| 8 |
| 7 import 'compiler_configuration.dart' show CommandArtifact; | 9 import 'compiler_configuration.dart' show CommandArtifact; |
| 8 | 10 |
| 9 // TODO(ahe): Remove this import, we can precompute all the values required | 11 // TODO(ahe): Remove this import, we can precompute all the values required |
| 10 // from TestSuite once the refactoring is complete. | 12 // from TestSuite once the refactoring is complete. |
| 11 import 'test_suite.dart' show TestSuite; | 13 import 'test_suite.dart' show TestSuite; |
| 12 | 14 |
| 13 import 'test_runner.dart' show Command, CommandBuilder; | 15 import 'test_runner.dart' show Command, CommandBuilder; |
| 14 | 16 |
| 15 // TODO(ahe): I expect this class will become abstract very soon. | 17 // TODO(ahe): I expect this class will become abstract very soon. |
| 16 class RuntimeConfiguration { | 18 class RuntimeConfiguration { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 CommandBuilder commandBuilder, | 239 CommandBuilder commandBuilder, |
| 238 CommandArtifact artifact, | 240 CommandArtifact artifact, |
| 239 List<String> arguments, | 241 List<String> arguments, |
| 240 Map<String, String> environmentOverrides) { | 242 Map<String, String> environmentOverrides) { |
| 241 String script = artifact.filename; | 243 String script = artifact.filename; |
| 242 String type = artifact.mimeType; | 244 String type = artifact.mimeType; |
| 243 if (script != null && type != 'application/dart-snapshot') { | 245 if (script != null && type != 'application/dart-snapshot') { |
| 244 throw "dart_app cannot run files of type '$type'."; | 246 throw "dart_app cannot run files of type '$type'."; |
| 245 } | 247 } |
| 246 | 248 |
| 247 var augmentedArgs = new List(); | 249 var args = new List(); |
| 248 augmentedArgs.add("--run-app-snapshot=${artifact.filename}"); | 250 args.addAll(arguments); |
| 249 if (useBlobs) { | 251 args.removeLast(); |
| 250 augmentedArgs.add("--use-blobs"); | 252 args.add("${artifact.filename}/out.jitsnapshot"); |
| 251 } | |
| 252 augmentedArgs.addAll(arguments); | |
| 253 | 253 |
| 254 return <Command>[ | 254 return <Command>[ |
| 255 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, | 255 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, |
| 256 augmentedArgs, environmentOverrides) | 256 args, environmentOverrides) |
| 257 ]; | 257 ]; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { | 261 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 262 final bool useBlobs; | 262 final bool useBlobs; |
| 263 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | 263 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
| 264 | 264 |
| 265 List<Command> computeRuntimeCommands( | 265 List<Command> computeRuntimeCommands( |
| 266 TestSuite suite, | 266 TestSuite suite, |
| 267 CommandBuilder commandBuilder, | 267 CommandBuilder commandBuilder, |
| 268 CommandArtifact artifact, | 268 CommandArtifact artifact, |
| 269 List<String> arguments, | 269 List<String> arguments, |
| 270 Map<String, String> environmentOverrides) { | 270 Map<String, String> environmentOverrides) { |
| 271 String script = artifact.filename; | 271 String script = artifact.filename; |
| 272 String type = artifact.mimeType; | 272 String type = artifact.mimeType; |
| 273 if (script != null && type != 'application/dart-precompiled') { | 273 if (script != null && type != 'application/dart-precompiled') { |
| 274 throw "dart_precompiled cannot run files of type '$type'."; | 274 throw "dart_precompiled cannot run files of type '$type'."; |
| 275 } | 275 } |
| 276 | 276 |
| 277 var augmentedArgs = new List(); | 277 var args = new List(); |
| 278 augmentedArgs.add("--run-app-snapshot=${artifact.filename}"); | 278 args.addAll(arguments); |
| 279 if (useBlobs) { | 279 args.removeLast(); |
| 280 augmentedArgs.add("--use-blobs"); | 280 args.add("${artifact.filename}/out.aotsnapshot"); |
| 281 } | |
| 282 augmentedArgs.addAll(arguments); | |
| 283 | 281 |
| 284 return <Command>[ | 282 return <Command>[ |
| 285 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, | 283 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, |
| 286 augmentedArgs, environmentOverrides) | 284 args, environmentOverrides) |
| 287 ]; | 285 ]; |
| 288 } | 286 } |
| 289 } | 287 } |
| 290 | 288 |
| 291 class DartPrecompiledAdbRuntimeConfiguration | 289 class DartPrecompiledAdbRuntimeConfiguration |
| 292 extends DartVmRuntimeConfiguration { | 290 extends DartVmRuntimeConfiguration { |
| 293 final bool useBlobs; | 291 final bool useBlobs; |
| 294 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | 292 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
| 295 | 293 |
| 296 List<Command> computeRuntimeCommands( | 294 List<Command> computeRuntimeCommands( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 321 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 319 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 322 List<Command> computeRuntimeCommands( | 320 List<Command> computeRuntimeCommands( |
| 323 TestSuite suite, | 321 TestSuite suite, |
| 324 CommandBuilder commandBuilder, | 322 CommandBuilder commandBuilder, |
| 325 CommandArtifact artifact, | 323 CommandArtifact artifact, |
| 326 List<String> arguments, | 324 List<String> arguments, |
| 327 Map<String, String> environmentOverrides) { | 325 Map<String, String> environmentOverrides) { |
| 328 throw "Unimplemented runtime '$runtimeType'"; | 326 throw "Unimplemented runtime '$runtimeType'"; |
| 329 } | 327 } |
| 330 } | 328 } |
| OLD | NEW |