| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool useBlobs = configuration['use_blobs']; |
| 56 bool hotReload = configuration['hot_reload']; |
| 56 | 57 |
| 57 switch (compiler) { | 58 switch (compiler) { |
| 58 case 'dart2analyzer': | 59 case 'dart2analyzer': |
| 59 return new AnalyzerCompilerConfiguration( | 60 return new AnalyzerCompilerConfiguration( |
| 60 isDebug: isDebug, | 61 isDebug: isDebug, |
| 61 isChecked: isChecked, | 62 isChecked: isChecked, |
| 62 isHostChecked: isHostChecked, | 63 isHostChecked: isHostChecked, |
| 63 useSdk: useSdk); | 64 useSdk: useSdk); |
| 64 case 'dart2js': | 65 case 'dart2js': |
| 65 return new Dart2jsCompilerConfiguration( | 66 return new Dart2jsCompilerConfiguration( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 82 isDebug: isDebug, | 83 isDebug: isDebug, |
| 83 isChecked: isChecked, | 84 isChecked: isChecked, |
| 84 arch: configuration['arch'], | 85 arch: configuration['arch'], |
| 85 useBlobs: useBlobs, | 86 useBlobs: useBlobs, |
| 86 isAndroid: configuration['system'] == 'android'); | 87 isAndroid: configuration['system'] == 'android'); |
| 87 case 'none': | 88 case 'none': |
| 88 return new NoneCompilerConfiguration( | 89 return new NoneCompilerConfiguration( |
| 89 isDebug: isDebug, | 90 isDebug: isDebug, |
| 90 isChecked: isChecked, | 91 isChecked: isChecked, |
| 91 isHostChecked: isHostChecked, | 92 isHostChecked: isHostChecked, |
| 92 useSdk: useSdk); | 93 useSdk: useSdk, |
| 94 hotReload: hotReload); |
| 93 default: | 95 default: |
| 94 throw "Unknown compiler '$compiler'"; | 96 throw "Unknown compiler '$compiler'"; |
| 95 } | 97 } |
| 96 } | 98 } |
| 97 | 99 |
| 98 CompilerConfiguration._subclass( | 100 CompilerConfiguration._subclass( |
| 99 {this.isDebug: false, | 101 {this.isDebug: false, |
| 100 this.isChecked: false, | 102 this.isChecked: false, |
| 101 this.isHostChecked: false, | 103 this.isHostChecked: false, |
| 102 this.useSdk: false}); | 104 this.useSdk: false}); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 List<String> vmOptions, | 144 List<String> vmOptions, |
| 143 List<String> sharedOptions, | 145 List<String> sharedOptions, |
| 144 List<String> originalArguments, | 146 List<String> originalArguments, |
| 145 CommandArtifact artifact) { | 147 CommandArtifact artifact) { |
| 146 return <String>[artifact.filename]; | 148 return <String>[artifact.filename]; |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 | 151 |
| 150 /// The "none" compiler. | 152 /// The "none" compiler. |
| 151 class NoneCompilerConfiguration extends CompilerConfiguration { | 153 class NoneCompilerConfiguration extends CompilerConfiguration { |
| 154 final bool hotReload; |
| 155 |
| 152 NoneCompilerConfiguration( | 156 NoneCompilerConfiguration( |
| 153 {bool isDebug, bool isChecked, bool isHostChecked, bool useSdk}) | 157 {bool isDebug, bool isChecked, bool isHostChecked, bool useSdk, |
| 158 bool hotReload}) |
| 154 : super._subclass( | 159 : super._subclass( |
| 155 isDebug: isDebug, | 160 isDebug: isDebug, |
| 156 isChecked: isChecked, | 161 isChecked: isChecked, |
| 157 isHostChecked: isHostChecked, | 162 isHostChecked: isHostChecked, |
| 158 useSdk: useSdk); | 163 useSdk: useSdk), |
| 164 this.hotReload = hotReload; |
| 159 | 165 |
| 160 bool get hasCompiler => false; | 166 bool get hasCompiler => false; |
| 161 | 167 |
| 162 List<String> computeRuntimeArguments( | 168 List<String> computeRuntimeArguments( |
| 163 RuntimeConfiguration runtimeConfiguration, | 169 RuntimeConfiguration runtimeConfiguration, |
| 164 String buildDir, | 170 String buildDir, |
| 165 TestInformation info, | 171 TestInformation info, |
| 166 List<String> vmOptions, | 172 List<String> vmOptions, |
| 167 List<String> sharedOptions, | 173 List<String> sharedOptions, |
| 168 List<String> originalArguments, | 174 List<String> originalArguments, |
| 169 CommandArtifact artifact) { | 175 CommandArtifact artifact) { |
| 170 List<String> args = []; | 176 List<String> args = []; |
| 171 if (isChecked) { | 177 if (isChecked) { |
| 172 args.add('--enable_asserts'); | 178 args.add('--enable_asserts'); |
| 173 args.add('--enable_type_checks'); | 179 args.add('--enable_type_checks'); |
| 174 } | 180 } |
| 181 if (hotReload) { |
| 182 args.add('--identity-reload'); |
| 183 args.add('--reload-every=100000'); |
| 184 args.add('--no-background-compilation'); |
| 185 args.add('--no-osr'); |
| 186 } |
| 175 return args | 187 return args |
| 176 ..addAll(vmOptions) | 188 ..addAll(vmOptions) |
| 177 ..addAll(sharedOptions) | 189 ..addAll(sharedOptions) |
| 178 ..addAll(originalArguments); | 190 ..addAll(originalArguments); |
| 179 } | 191 } |
| 180 } | 192 } |
| 181 | 193 |
| 182 /// Common configuration for dart2js-based tools, such as, dart2js | 194 /// Common configuration for dart2js-based tools, such as, dart2js |
| 183 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 195 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
| 184 final String moniker; | 196 final String moniker; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 RuntimeConfiguration runtimeConfiguration, | 651 RuntimeConfiguration runtimeConfiguration, |
| 640 String buildDir, | 652 String buildDir, |
| 641 TestInformation info, | 653 TestInformation info, |
| 642 List<String> vmOptions, | 654 List<String> vmOptions, |
| 643 List<String> sharedOptions, | 655 List<String> sharedOptions, |
| 644 List<String> originalArguments, | 656 List<String> originalArguments, |
| 645 CommandArtifact artifact) { | 657 CommandArtifact artifact) { |
| 646 return <String>[]; | 658 return <String>[]; |
| 647 } | 659 } |
| 648 } | 660 } |
| OLD | NEW |