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 for (var i = 0; i < args.length; i++) { |
250 augmentedArgs.add("--use-blobs"); | 252 if (args[i].endsWith(".dart")) { |
| 253 args[i] = "${artifact.filename}/out.jitsnapshot"; |
| 254 } |
251 } | 255 } |
252 augmentedArgs.addAll(arguments); | |
253 | 256 |
254 return <Command>[ | 257 return <Command>[ |
255 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, | 258 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, |
256 augmentedArgs, environmentOverrides) | 259 args, environmentOverrides) |
257 ]; | 260 ]; |
258 } | 261 } |
259 } | 262 } |
260 | 263 |
261 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { | 264 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { |
262 final bool useBlobs; | 265 final bool useBlobs; |
263 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | 266 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
264 | 267 |
265 List<Command> computeRuntimeCommands( | 268 List<Command> computeRuntimeCommands( |
266 TestSuite suite, | 269 TestSuite suite, |
267 CommandBuilder commandBuilder, | 270 CommandBuilder commandBuilder, |
268 CommandArtifact artifact, | 271 CommandArtifact artifact, |
269 List<String> arguments, | 272 List<String> arguments, |
270 Map<String, String> environmentOverrides) { | 273 Map<String, String> environmentOverrides) { |
271 String script = artifact.filename; | 274 String script = artifact.filename; |
272 String type = artifact.mimeType; | 275 String type = artifact.mimeType; |
273 if (script != null && type != 'application/dart-precompiled') { | 276 if (script != null && type != 'application/dart-precompiled') { |
274 throw "dart_precompiled cannot run files of type '$type'."; | 277 throw "dart_precompiled cannot run files of type '$type'."; |
275 } | 278 } |
276 | 279 |
277 var augmentedArgs = new List(); | 280 var args = new List(); |
278 augmentedArgs.add("--run-app-snapshot=${artifact.filename}"); | 281 args.addAll(arguments); |
279 if (useBlobs) { | 282 for (var i = 0; i < args.length; i++) { |
280 augmentedArgs.add("--use-blobs"); | 283 if (args[i].endsWith(".dart")) { |
| 284 args[i] = "${artifact.filename}/out.aotsnapshot"; |
| 285 } |
281 } | 286 } |
282 augmentedArgs.addAll(arguments); | |
283 | 287 |
284 return <Command>[ | 288 return <Command>[ |
285 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, | 289 commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName, |
286 augmentedArgs, environmentOverrides) | 290 args, environmentOverrides) |
287 ]; | 291 ]; |
288 } | 292 } |
289 } | 293 } |
290 | 294 |
291 class DartPrecompiledAdbRuntimeConfiguration | 295 class DartPrecompiledAdbRuntimeConfiguration |
292 extends DartVmRuntimeConfiguration { | 296 extends DartVmRuntimeConfiguration { |
293 final bool useBlobs; | 297 final bool useBlobs; |
294 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | 298 DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
295 | 299 |
296 List<Command> computeRuntimeCommands( | 300 List<Command> computeRuntimeCommands( |
(...skipping 24 matching lines...) Expand all Loading... |
321 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 325 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
322 List<Command> computeRuntimeCommands( | 326 List<Command> computeRuntimeCommands( |
323 TestSuite suite, | 327 TestSuite suite, |
324 CommandBuilder commandBuilder, | 328 CommandBuilder commandBuilder, |
325 CommandArtifact artifact, | 329 CommandArtifact artifact, |
326 List<String> arguments, | 330 List<String> arguments, |
327 Map<String, String> environmentOverrides) { | 331 Map<String, String> environmentOverrides) { |
328 throw "Unimplemented runtime '$runtimeType'"; | 332 throw "Unimplemented runtime '$runtimeType'"; |
329 } | 333 } |
330 } | 334 } |
OLD | NEW |