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