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; | 7 import 'dart:io' show Platform; |
8 | 8 |
9 import 'compiler_configuration.dart' show CommandArtifact; | 9 import 'compiler_configuration.dart' show CommandArtifact; |
10 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 /// The standalone Dart VM binary, "dart" or "dart.exe". | 211 /// The standalone Dart VM binary, "dart" or "dart.exe". |
212 class StandaloneDartRuntimeConfiguration extends DartVmRuntimeConfiguration { | 212 class StandaloneDartRuntimeConfiguration extends DartVmRuntimeConfiguration { |
213 List<Command> computeRuntimeCommands( | 213 List<Command> computeRuntimeCommands( |
214 TestSuite suite, | 214 TestSuite suite, |
215 CommandBuilder commandBuilder, | 215 CommandBuilder commandBuilder, |
216 CommandArtifact artifact, | 216 CommandArtifact artifact, |
217 List<String> arguments, | 217 List<String> arguments, |
218 Map<String, String> environmentOverrides) { | 218 Map<String, String> environmentOverrides) { |
219 String script = artifact.filename; | 219 String script = artifact.filename; |
220 String type = artifact.mimeType; | 220 String type = artifact.mimeType; |
221 if (script != null && type != 'application/dart') { | 221 if (script != null && |
| 222 type != 'application/dart' && |
| 223 type != 'application/dart-snapshot') { |
222 throw "Dart VM cannot run files of type '$type'."; | 224 throw "Dart VM cannot run files of type '$type'."; |
223 } | 225 } |
224 String executable = suite.configuration['noopt'] | 226 String executable = suite.configuration['noopt'] |
225 ? suite.dartVmNooptBinaryFileName | 227 ? suite.dartVmNooptBinaryFileName |
226 : suite.dartVmBinaryFileName; | 228 : suite.dartVmBinaryFileName; |
227 return <Command>[ | 229 return <Command>[ |
228 commandBuilder.getVmCommand(executable, arguments, environmentOverrides) | 230 commandBuilder.getVmCommand(executable, arguments, environmentOverrides) |
229 ]; | 231 ]; |
230 } | 232 } |
231 } | 233 } |
232 | 234 |
233 class DartAppRuntimeConfiguration extends DartVmRuntimeConfiguration { | |
234 final bool useBlobs; | |
235 DartAppRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | |
236 | |
237 List<Command> computeRuntimeCommands( | |
238 TestSuite suite, | |
239 CommandBuilder commandBuilder, | |
240 CommandArtifact artifact, | |
241 List<String> arguments, | |
242 Map<String, String> environmentOverrides) { | |
243 String script = artifact.filename; | |
244 String type = artifact.mimeType; | |
245 if (script != null && type != 'application/dart-snapshot') { | |
246 throw "dart_app cannot run files of type '$type'."; | |
247 } | |
248 | |
249 var args = new List(); | |
250 args.addAll(arguments); | |
251 for (var i = 0; i < args.length; i++) { | |
252 if (args[i].endsWith(".dart")) { | |
253 args[i] = "${artifact.filename}/out.jitsnapshot"; | |
254 } | |
255 } | |
256 | |
257 return <Command>[ | |
258 commandBuilder.getVmCommand(suite.dartVmBinaryFileName, | |
259 args, environmentOverrides) | |
260 ]; | |
261 } | |
262 } | |
263 | |
264 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { | 235 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { |
265 final bool useBlobs; | 236 final bool useBlobs; |
266 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; | 237 DartPrecompiledRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs; |
267 | 238 |
268 List<Command> computeRuntimeCommands( | 239 List<Command> computeRuntimeCommands( |
269 TestSuite suite, | 240 TestSuite suite, |
270 CommandBuilder commandBuilder, | 241 CommandBuilder commandBuilder, |
271 CommandArtifact artifact, | 242 CommandArtifact artifact, |
272 List<String> arguments, | 243 List<String> arguments, |
273 Map<String, String> environmentOverrides) { | 244 Map<String, String> environmentOverrides) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 298 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
328 List<Command> computeRuntimeCommands( | 299 List<Command> computeRuntimeCommands( |
329 TestSuite suite, | 300 TestSuite suite, |
330 CommandBuilder commandBuilder, | 301 CommandBuilder commandBuilder, |
331 CommandArtifact artifact, | 302 CommandArtifact artifact, |
332 List<String> arguments, | 303 List<String> arguments, |
333 Map<String, String> environmentOverrides) { | 304 Map<String, String> environmentOverrides) { |
334 throw "Unimplemented runtime '$runtimeType'"; | 305 throw "Unimplemented runtime '$runtimeType'"; |
335 } | 306 } |
336 } | 307 } |
OLD | NEW |