| 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 | 7 import 'compiler_configuration.dart' show |
| 8 CommandArtifact; | 8 CommandArtifact; |
| 9 | 9 |
| 10 // TODO(ahe): Remove this import, we can precompute all the values required | 10 // TODO(ahe): Remove this import, we can precompute all the values required |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 case 'd8': | 46 case 'd8': |
| 47 return new D8RuntimeConfiguration(); | 47 return new D8RuntimeConfiguration(); |
| 48 | 48 |
| 49 case 'none': | 49 case 'none': |
| 50 return new NoneRuntimeConfiguration(); | 50 return new NoneRuntimeConfiguration(); |
| 51 | 51 |
| 52 case 'vm': | 52 case 'vm': |
| 53 return new StandaloneDartRuntimeConfiguration(); | 53 return new StandaloneDartRuntimeConfiguration(); |
| 54 | 54 |
| 55 case 'dart_precompiled': |
| 56 return new DartPrecompiledRuntimeConfiguration(); |
| 57 |
| 55 case 'drt': | 58 case 'drt': |
| 56 return new DrtRuntimeConfiguration(); | 59 return new DrtRuntimeConfiguration(); |
| 57 | 60 |
| 58 default: | 61 default: |
| 59 throw "Unknown runtime '$runtime'"; | 62 throw "Unknown runtime '$runtime'"; |
| 60 } | 63 } |
| 61 } | 64 } |
| 62 | 65 |
| 63 RuntimeConfiguration._subclass(); | 66 RuntimeConfiguration._subclass(); |
| 64 | 67 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 String script = artifact.filename; | 214 String script = artifact.filename; |
| 212 String type = artifact.mimeType; | 215 String type = artifact.mimeType; |
| 213 if (script != null && type != 'application/dart') { | 216 if (script != null && type != 'application/dart') { |
| 214 throw "Dart VM cannot run files of type '$type'."; | 217 throw "Dart VM cannot run files of type '$type'."; |
| 215 } | 218 } |
| 216 return <Command>[commandBuilder.getVmCommand( | 219 return <Command>[commandBuilder.getVmCommand( |
| 217 suite.dartVmBinaryFileName, arguments, environmentOverrides)]; | 220 suite.dartVmBinaryFileName, arguments, environmentOverrides)]; |
| 218 } | 221 } |
| 219 } | 222 } |
| 220 | 223 |
| 224 |
| 225 class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 226 List<Command> computeRuntimeCommands( |
| 227 TestSuite suite, |
| 228 CommandBuilder commandBuilder, |
| 229 CommandArtifact artifact, |
| 230 List<String> arguments, |
| 231 Map<String, String> environmentOverrides) { |
| 232 String script = artifact.filename; |
| 233 String type = artifact.mimeType; |
| 234 if (script != null && type != 'application/dart-precompiled') { |
| 235 throw "dart_precompiled cannot run files of type '$type'."; |
| 236 } |
| 237 |
| 238 var augmentedArgs = new List(); |
| 239 augmentedArgs.add("--run-precompiled-snapshot=${artifact.filename}"); |
| 240 augmentedArgs.addAll(arguments); |
| 241 |
| 242 var augmentedEnv = new Map.from(environmentOverrides); |
| 243 augmentedEnv['LD_LIBRARY_PATH'] = artifact.filename; |
| 244 |
| 245 return <Command>[commandBuilder.getVmCommand( |
| 246 suite.dartPrecompiledBinaryFileName, augmentedArgs, augmentedEnv)]; |
| 247 } |
| 248 } |
| 249 |
| 221 /// Temporary runtime configuration for browser runtimes that haven't been | 250 /// Temporary runtime configuration for browser runtimes that haven't been |
| 222 /// migrated yet. | 251 /// migrated yet. |
| 223 // TODO(ahe): Remove this class. | 252 // TODO(ahe): Remove this class. |
| 224 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { | 253 class DummyRuntimeConfiguration extends DartVmRuntimeConfiguration { |
| 225 List<Command> computeRuntimeCommands( | 254 List<Command> computeRuntimeCommands( |
| 226 TestSuite suite, | 255 TestSuite suite, |
| 227 CommandBuilder commandBuilder, | 256 CommandBuilder commandBuilder, |
| 228 CommandArtifact artifact, | 257 CommandArtifact artifact, |
| 229 List<String> arguments, | 258 List<String> arguments, |
| 230 Map<String, String> environmentOverrides) { | 259 Map<String, String> environmentOverrides) { |
| 231 throw "Unimplemented runtime '$runtimeType'"; | 260 throw "Unimplemented runtime '$runtimeType'"; |
| 232 } | 261 } |
| 233 } | 262 } |
| OLD | NEW |