| 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 compiler_configuration; | 5 library compiler_configuration; |
| 6 | 6 |
| 7 import 'dart:io' show Platform; | 7 import 'dart:io' show Platform; |
| 8 | 8 |
| 9 import 'runtime_configuration.dart' show RuntimeConfiguration; | 9 import 'runtime_configuration.dart' show RuntimeConfiguration; |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // TODO(ahe): Move these booleans into a struction configuration object | 46 // TODO(ahe): Move these booleans into a struction configuration object |
| 47 // which can eventually completely replace the Map-based configuration | 47 // which can eventually completely replace the Map-based configuration |
| 48 // object. | 48 // object. |
| 49 bool isDebug = configuration['mode'] == 'debug'; | 49 bool isDebug = configuration['mode'] == 'debug'; |
| 50 bool isChecked = configuration['checked']; | 50 bool isChecked = configuration['checked']; |
| 51 bool isHostChecked = configuration['host_checked']; | 51 bool isHostChecked = configuration['host_checked']; |
| 52 bool useSdk = configuration['use_sdk']; | 52 bool useSdk = configuration['use_sdk']; |
| 53 bool isCsp = configuration['csp']; | 53 bool isCsp = configuration['csp']; |
| 54 bool useCps = configuration['cps_ir']; | 54 bool useCps = configuration['cps_ir']; |
| 55 bool useBlobs = configuration['use_blobs']; |
| 55 | 56 |
| 56 switch (compiler) { | 57 switch (compiler) { |
| 57 case 'dart2analyzer': | 58 case 'dart2analyzer': |
| 58 return new AnalyzerCompilerConfiguration( | 59 return new AnalyzerCompilerConfiguration( |
| 59 isDebug: isDebug, | 60 isDebug: isDebug, |
| 60 isChecked: isChecked, | 61 isChecked: isChecked, |
| 61 isHostChecked: isHostChecked, | 62 isHostChecked: isHostChecked, |
| 62 useSdk: useSdk); | 63 useSdk: useSdk); |
| 63 case 'dart2js': | 64 case 'dart2js': |
| 64 return new Dart2jsCompilerConfiguration( | 65 return new Dart2jsCompilerConfiguration( |
| 65 isDebug: isDebug, | 66 isDebug: isDebug, |
| 66 isChecked: isChecked, | 67 isChecked: isChecked, |
| 67 isHostChecked: isHostChecked, | 68 isHostChecked: isHostChecked, |
| 68 useCps: useCps, | 69 useCps: useCps, |
| 69 useSdk: useSdk, | 70 useSdk: useSdk, |
| 70 isCsp: isCsp, | 71 isCsp: isCsp, |
| 71 extraDart2jsOptions: | 72 extraDart2jsOptions: |
| 72 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 73 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
| 73 case 'dart2app': | 74 case 'dart2app': |
| 74 return new Dart2AppSnapshotCompilerConfiguration( | 75 return new Dart2AppSnapshotCompilerConfiguration( |
| 75 isDebug: isDebug, isChecked: isChecked); | 76 isDebug: isDebug, isChecked: isChecked); |
| 76 case 'precompiler': | 77 case 'precompiler': |
| 77 return new PrecompilerCompilerConfiguration( | 78 return new PrecompilerCompilerConfiguration( |
| 78 isDebug: isDebug, | 79 isDebug: isDebug, |
| 79 isChecked: isChecked, | 80 isChecked: isChecked, |
| 80 arch: configuration['arch']); | 81 arch: configuration['arch'], |
| 82 useBlobs: useBlobs); |
| 81 case 'none': | 83 case 'none': |
| 82 return new NoneCompilerConfiguration( | 84 return new NoneCompilerConfiguration( |
| 83 isDebug: isDebug, | 85 isDebug: isDebug, |
| 84 isChecked: isChecked, | 86 isChecked: isChecked, |
| 85 isHostChecked: isHostChecked, | 87 isHostChecked: isHostChecked, |
| 86 useSdk: useSdk); | 88 useSdk: useSdk); |
| 87 default: | 89 default: |
| 88 throw "Unknown compiler '$compiler'"; | 90 throw "Unknown compiler '$compiler'"; |
| 89 } | 91 } |
| 90 } | 92 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 : nativeDirectoryToUri(TestUtils.dartDir.toNativePath()) | 294 : nativeDirectoryToUri(TestUtils.dartDir.toNativePath()) |
| 293 .resolve('sdk/'); | 295 .resolve('sdk/'); |
| 294 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/'); | 296 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/'); |
| 295 return runtimeConfiguration.dart2jsPreambles(preambleDir) | 297 return runtimeConfiguration.dart2jsPreambles(preambleDir) |
| 296 ..add(artifact.filename); | 298 ..add(artifact.filename); |
| 297 } | 299 } |
| 298 } | 300 } |
| 299 | 301 |
| 300 class PrecompilerCompilerConfiguration extends CompilerConfiguration { | 302 class PrecompilerCompilerConfiguration extends CompilerConfiguration { |
| 301 final String arch; | 303 final String arch; |
| 304 final bool useBlobs; |
| 302 | 305 |
| 303 PrecompilerCompilerConfiguration({bool isDebug, bool isChecked, String arch}) | 306 PrecompilerCompilerConfiguration({bool isDebug, bool isChecked, String arch, b
ool useBlobs}) |
| 304 : super._subclass(isDebug: isDebug, isChecked: isChecked), | 307 : super._subclass(isDebug: isDebug, isChecked: isChecked), |
| 305 arch = arch; | 308 arch = arch, |
| 309 useBlobs = useBlobs; |
| 306 | 310 |
| 307 int computeTimeoutMultiplier() { | 311 int computeTimeoutMultiplier() { |
| 308 int multiplier = 2; | 312 int multiplier = 2; |
| 309 if (isDebug) multiplier *= 4; | 313 if (isDebug) multiplier *= 4; |
| 310 if (isChecked) multiplier *= 2; | 314 if (isChecked) multiplier *= 2; |
| 311 return multiplier; | 315 return multiplier; |
| 312 } | 316 } |
| 313 | 317 |
| 314 CommandArtifact computeCompilationArtifact( | 318 CommandArtifact computeCompilationArtifact( |
| 315 String buildDir, | 319 String buildDir, |
| 316 String tempDir, | 320 String tempDir, |
| 317 CommandBuilder commandBuilder, | 321 CommandBuilder commandBuilder, |
| 318 List arguments, | 322 List arguments, |
| 319 Map<String, String> environmentOverrides) { | 323 Map<String, String> environmentOverrides) { |
| 320 return new CommandArtifact(<Command>[ | 324 var commands = new List<Command>(); |
| 321 this.computeCompilationCommand(tempDir, buildDir, CommandBuilder.instance, | 325 commands.add(this.computeCompilationCommand(tempDir, buildDir, CommandBuilde
r.instance, |
| 322 arguments, environmentOverrides), | 326 arguments, environmentOverrides)); |
| 323 this.computeAssembleCommand(tempDir, buildDir, CommandBuilder.instance, | 327 if (!useBlobs) { |
| 324 arguments, environmentOverrides), | 328 commands.add(this.computeAssembleCommand(tempDir, buildDir, CommandBuilder
.instance, |
| 325 this.computeRemoveAssemblyCommand(tempDir, buildDir, | 329 arguments, environmentOverrides)); |
| 326 CommandBuilder.instance, arguments, environmentOverrides) | 330 commands.add(this.computeRemoveAssemblyCommand(tempDir, buildDir, |
| 327 ], '$tempDir', 'application/dart-precompiled'); | 331 CommandBuilder.instance, arguments, environmentOverrides)); |
| 332 } |
| 333 return new CommandArtifact(commands, '$tempDir', 'application/dart-precompil
ed'); |
| 328 } | 334 } |
| 329 | 335 |
| 330 CompilationCommand computeCompilationCommand( | 336 CompilationCommand computeCompilationCommand( |
| 331 String tempDir, | 337 String tempDir, |
| 332 String buildDir, | 338 String buildDir, |
| 333 CommandBuilder commandBuilder, | 339 CommandBuilder commandBuilder, |
| 334 List arguments, | 340 List arguments, |
| 335 Map<String, String> environmentOverrides) { | 341 Map<String, String> environmentOverrides) { |
| 336 var exec = "$buildDir/dart_bootstrap"; | 342 var exec = "$buildDir/dart_bootstrap"; |
| 337 var args = new List(); | 343 var args = new List(); |
| 338 args.add("--gen-precompiled-snapshot=$tempDir"); | 344 args.add("--gen-precompiled-snapshot=$tempDir"); |
| 345 if (useBlobs) { |
| 346 args.add("--use_blobs"); |
| 347 } |
| 339 args.addAll(arguments); | 348 args.addAll(arguments); |
| 340 | 349 |
| 341 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk, | 350 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk, |
| 342 bootstrapDependencies(buildDir), exec, args, environmentOverrides); | 351 bootstrapDependencies(buildDir), exec, args, environmentOverrides); |
| 343 } | 352 } |
| 344 | 353 |
| 345 CompilationCommand computeAssembleCommand( | 354 CompilationCommand computeAssembleCommand( |
| 346 String tempDir, | 355 String tempDir, |
| 347 String buildDir, | 356 String buildDir, |
| 348 CommandBuilder commandBuilder, | 357 CommandBuilder commandBuilder, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 RuntimeConfiguration runtimeConfiguration, | 598 RuntimeConfiguration runtimeConfiguration, |
| 590 String buildDir, | 599 String buildDir, |
| 591 TestInformation info, | 600 TestInformation info, |
| 592 List<String> vmOptions, | 601 List<String> vmOptions, |
| 593 List<String> sharedOptions, | 602 List<String> sharedOptions, |
| 594 List<String> originalArguments, | 603 List<String> originalArguments, |
| 595 CommandArtifact artifact) { | 604 CommandArtifact artifact) { |
| 596 return <String>[]; | 605 return <String>[]; |
| 597 } | 606 } |
| 598 } | 607 } |
| OLD | NEW |