Chromium Code Reviews| 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 | 7 import 'dart:io' show |
| 8 Platform; | 8 Platform; |
| 9 | 9 |
| 10 import 'runtime_configuration.dart' show | 10 import 'runtime_configuration.dart' show |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 case 'dart2analyzer': | 66 case 'dart2analyzer': |
| 67 return new AnalyzerCompilerConfiguration( | 67 return new AnalyzerCompilerConfiguration( |
| 68 isDebug: isDebug, isChecked: isChecked, | 68 isDebug: isDebug, isChecked: isChecked, |
| 69 isHostChecked: isHostChecked, useSdk: useSdk); | 69 isHostChecked: isHostChecked, useSdk: useSdk); |
| 70 case 'dart2js': | 70 case 'dart2js': |
| 71 return new Dart2jsCompilerConfiguration( | 71 return new Dart2jsCompilerConfiguration( |
| 72 isDebug: isDebug, isChecked: isChecked, | 72 isDebug: isDebug, isChecked: isChecked, |
| 73 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, | 73 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, |
| 74 isCsp: isCsp, extraDart2jsOptions: | 74 isCsp: isCsp, extraDart2jsOptions: |
| 75 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 75 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
| 76 case 'dart2snapshot': | |
|
siva
2016/02/09 18:59:50
As discussed offline maybe dartproduction or dartd
| |
| 77 return new Dart2SnapshotCompilerConfiguration( | |
| 78 isDebug: isDebug, isChecked: isChecked); | |
| 76 case 'precompiler': | 79 case 'precompiler': |
| 77 return new PrecompilerCompilerConfiguration( | 80 return new PrecompilerCompilerConfiguration( |
| 78 isDebug: isDebug, isChecked: isChecked); | 81 isDebug: isDebug, isChecked: isChecked); |
| 79 case 'none': | 82 case 'none': |
| 80 return new NoneCompilerConfiguration( | 83 return new NoneCompilerConfiguration( |
| 81 isDebug: isDebug, isChecked: isChecked, | 84 isDebug: isDebug, isChecked: isChecked, |
| 82 isHostChecked: isHostChecked, useSdk: useSdk); | 85 isHostChecked: isHostChecked, useSdk: useSdk); |
| 83 default: | 86 default: |
| 84 throw "Unknown compiler '$compiler'"; | 87 throw "Unknown compiler '$compiler'"; |
| 85 } | 88 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 args.add('--enable_type_checks'); | 390 args.add('--enable_type_checks'); |
| 388 } | 391 } |
| 389 return args | 392 return args |
| 390 ..addAll(vmOptions) | 393 ..addAll(vmOptions) |
| 391 ..addAll(sharedOptions) | 394 ..addAll(sharedOptions) |
| 392 ..addAll(originalArguments); | 395 ..addAll(originalArguments); |
| 393 } | 396 } |
| 394 } | 397 } |
| 395 | 398 |
| 396 | 399 |
| 400 class Dart2SnapshotCompilerConfiguration extends CompilerConfiguration { | |
| 401 Dart2SnapshotCompilerConfiguration({ | |
| 402 bool isDebug, | |
| 403 bool isChecked}) | |
| 404 : super._subclass(isDebug: isDebug, isChecked: isChecked); | |
| 405 | |
| 406 int computeTimeoutMultiplier() { | |
| 407 int multiplier = 2; | |
| 408 if (isDebug) multiplier *= 4; | |
| 409 if (isChecked) multiplier *= 2; | |
| 410 return multiplier; | |
| 411 } | |
| 412 | |
| 413 CommandArtifact computeCompilationArtifact( | |
| 414 String buildDir, | |
| 415 String tempDir, | |
| 416 CommandBuilder commandBuilder, | |
| 417 List arguments, | |
| 418 Map<String, String> environmentOverrides) { | |
| 419 return new CommandArtifact( | |
| 420 <Command>[ | |
| 421 this.computeCompilationCommand( | |
| 422 tempDir, | |
| 423 buildDir, | |
| 424 CommandBuilder.instance, | |
| 425 arguments, | |
| 426 environmentOverrides)], | |
| 427 computeOutputName(tempDir), | |
| 428 'application/dart-snapshot'); | |
| 429 } | |
| 430 | |
| 431 String computeOutputName(String tempDir) { | |
| 432 return '$tempDir/test.snapshot'; | |
| 433 } | |
| 434 | |
| 435 CompilationCommand computeCompilationCommand( | |
| 436 String tempDir, | |
| 437 String buildDir, | |
| 438 CommandBuilder commandBuilder, | |
| 439 List arguments, | |
| 440 Map<String, String> environmentOverrides) { | |
| 441 var exec = "$buildDir/dart_no_snapshot"; | |
| 442 var args = new List(); | |
| 443 args.add("--full-snapshot-after-run=${computeOutputName(tempDir)}"); | |
| 444 args.addAll(arguments); | |
| 445 | |
| 446 return commandBuilder.getCompilationCommand( | |
| 447 'dart2snapshot', computeOutputName(tempDir), !useSdk, | |
| 448 bootstrapDependencies(buildDir), | |
| 449 exec, args, environmentOverrides); | |
| 450 } | |
| 451 | |
| 452 List<String> computeCompilerArguments(vmOptions, | |
| 453 sharedOptions, | |
| 454 originalArguments) { | |
| 455 List<String> args = []; | |
| 456 if (isChecked) { | |
| 457 args.add('--enable_asserts'); | |
| 458 args.add('--enable_type_checks'); | |
| 459 } | |
| 460 return args | |
| 461 ..addAll(vmOptions) | |
| 462 ..addAll(sharedOptions) | |
| 463 ..addAll(originalArguments); | |
| 464 } | |
| 465 | |
| 466 List<String> computeRuntimeArguments( | |
| 467 RuntimeConfiguration runtimeConfiguration, | |
| 468 String buildDir, | |
| 469 TestInformation info, | |
| 470 List<String> vmOptions, | |
| 471 List<String> sharedOptions, | |
| 472 List<String> originalArguments, | |
| 473 CommandArtifact artifact) { | |
| 474 List<String> args = []; | |
| 475 if (isChecked) { | |
| 476 args.add('--enable_asserts'); | |
| 477 args.add('--enable_type_checks'); | |
| 478 } | |
| 479 return args | |
| 480 ..addAll(vmOptions) | |
| 481 ..addAll(sharedOptions) | |
| 482 ..addAll(originalArguments); | |
| 483 } | |
| 484 } | |
| 485 | |
| 486 | |
| 397 class AnalyzerCompilerConfiguration extends CompilerConfiguration { | 487 class AnalyzerCompilerConfiguration extends CompilerConfiguration { |
| 398 AnalyzerCompilerConfiguration( | 488 AnalyzerCompilerConfiguration( |
| 399 {bool isDebug, | 489 {bool isDebug, |
| 400 bool isChecked, | 490 bool isChecked, |
| 401 bool isHostChecked, | 491 bool isHostChecked, |
| 402 bool useSdk}) | 492 bool useSdk}) |
| 403 : super._subclass( | 493 : super._subclass( |
| 404 isDebug: isDebug, isChecked: isChecked, | 494 isDebug: isDebug, isChecked: isChecked, |
| 405 isHostChecked: isHostChecked, useSdk: useSdk); | 495 isHostChecked: isHostChecked, useSdk: useSdk); |
| 406 | 496 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 RuntimeConfiguration runtimeConfiguration, | 540 RuntimeConfiguration runtimeConfiguration, |
| 451 String buildDir, | 541 String buildDir, |
| 452 TestInformation info, | 542 TestInformation info, |
| 453 List<String> vmOptions, | 543 List<String> vmOptions, |
| 454 List<String> sharedOptions, | 544 List<String> sharedOptions, |
| 455 List<String> originalArguments, | 545 List<String> originalArguments, |
| 456 CommandArtifact artifact) { | 546 CommandArtifact artifact) { |
| 457 return <String>[]; | 547 return <String>[]; |
| 458 } | 548 } |
| 459 } | 549 } |
| OLD | NEW |