| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool hotReload = configuration['hot_reload']; |
| 57 bool hotReloadRollback = configuration['hot_reload_rollback']; |
| 57 | 58 |
| 58 switch (compiler) { | 59 switch (compiler) { |
| 59 case 'dart2analyzer': | 60 case 'dart2analyzer': |
| 60 return new AnalyzerCompilerConfiguration( | 61 return new AnalyzerCompilerConfiguration( |
| 61 isDebug: isDebug, | 62 isDebug: isDebug, |
| 62 isChecked: isChecked, | 63 isChecked: isChecked, |
| 63 isHostChecked: isHostChecked, | 64 isHostChecked: isHostChecked, |
| 64 useSdk: useSdk); | 65 useSdk: useSdk); |
| 65 case 'dart2js': | 66 case 'dart2js': |
| 66 return new Dart2jsCompilerConfiguration( | 67 return new Dart2jsCompilerConfiguration( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 84 isChecked: isChecked, | 85 isChecked: isChecked, |
| 85 arch: configuration['arch'], | 86 arch: configuration['arch'], |
| 86 useBlobs: useBlobs, | 87 useBlobs: useBlobs, |
| 87 isAndroid: configuration['system'] == 'android'); | 88 isAndroid: configuration['system'] == 'android'); |
| 88 case 'none': | 89 case 'none': |
| 89 return new NoneCompilerConfiguration( | 90 return new NoneCompilerConfiguration( |
| 90 isDebug: isDebug, | 91 isDebug: isDebug, |
| 91 isChecked: isChecked, | 92 isChecked: isChecked, |
| 92 isHostChecked: isHostChecked, | 93 isHostChecked: isHostChecked, |
| 93 useSdk: useSdk, | 94 useSdk: useSdk, |
| 94 hotReload: hotReload); | 95 hotReload: hotReload, |
| 96 hotReloadRollback: hotReloadRollback); |
| 95 default: | 97 default: |
| 96 throw "Unknown compiler '$compiler'"; | 98 throw "Unknown compiler '$compiler'"; |
| 97 } | 99 } |
| 98 } | 100 } |
| 99 | 101 |
| 100 CompilerConfiguration._subclass( | 102 CompilerConfiguration._subclass( |
| 101 {this.isDebug: false, | 103 {this.isDebug: false, |
| 102 this.isChecked: false, | 104 this.isChecked: false, |
| 103 this.isHostChecked: false, | 105 this.isHostChecked: false, |
| 104 this.useSdk: false}); | 106 this.useSdk: false}); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 List<String> sharedOptions, | 147 List<String> sharedOptions, |
| 146 List<String> originalArguments, | 148 List<String> originalArguments, |
| 147 CommandArtifact artifact) { | 149 CommandArtifact artifact) { |
| 148 return <String>[artifact.filename]; | 150 return <String>[artifact.filename]; |
| 149 } | 151 } |
| 150 } | 152 } |
| 151 | 153 |
| 152 /// The "none" compiler. | 154 /// The "none" compiler. |
| 153 class NoneCompilerConfiguration extends CompilerConfiguration { | 155 class NoneCompilerConfiguration extends CompilerConfiguration { |
| 154 final bool hotReload; | 156 final bool hotReload; |
| 157 final bool hotReloadRollback; |
| 155 | 158 |
| 156 NoneCompilerConfiguration( | 159 NoneCompilerConfiguration( |
| 157 {bool isDebug, bool isChecked, bool isHostChecked, bool useSdk, | 160 {bool isDebug, bool isChecked, bool isHostChecked, bool useSdk, |
| 158 bool hotReload}) | 161 bool hotReload, |
| 162 bool hotReloadRollback}) |
| 159 : super._subclass( | 163 : super._subclass( |
| 160 isDebug: isDebug, | 164 isDebug: isDebug, |
| 161 isChecked: isChecked, | 165 isChecked: isChecked, |
| 162 isHostChecked: isHostChecked, | 166 isHostChecked: isHostChecked, |
| 163 useSdk: useSdk), | 167 useSdk: useSdk), |
| 164 this.hotReload = hotReload; | 168 this.hotReload = hotReload, |
| 169 this.hotReloadRollback = hotReloadRollback; |
| 165 | 170 |
| 166 bool get hasCompiler => false; | 171 bool get hasCompiler => false; |
| 167 | 172 |
| 168 List<String> computeRuntimeArguments( | 173 List<String> computeRuntimeArguments( |
| 169 RuntimeConfiguration runtimeConfiguration, | 174 RuntimeConfiguration runtimeConfiguration, |
| 170 String buildDir, | 175 String buildDir, |
| 171 TestInformation info, | 176 TestInformation info, |
| 172 List<String> vmOptions, | 177 List<String> vmOptions, |
| 173 List<String> sharedOptions, | 178 List<String> sharedOptions, |
| 174 List<String> originalArguments, | 179 List<String> originalArguments, |
| 175 CommandArtifact artifact) { | 180 CommandArtifact artifact) { |
| 176 List<String> args = []; | 181 List<String> args = []; |
| 177 if (isChecked) { | 182 if (isChecked) { |
| 178 args.add('--enable_asserts'); | 183 args.add('--enable_asserts'); |
| 179 args.add('--enable_type_checks'); | 184 args.add('--enable_type_checks'); |
| 180 } | 185 } |
| 181 if (hotReload) { | 186 if (hotReload) { |
| 182 args.add('--hot-reload-test-mode'); | 187 args.add('--hot-reload-test-mode'); |
| 188 } else if (hotReloadRollback) { |
| 189 args.add('--hot-reload-rollback-test-mode'); |
| 183 } | 190 } |
| 184 return args | 191 return args |
| 185 ..addAll(vmOptions) | 192 ..addAll(vmOptions) |
| 186 ..addAll(sharedOptions) | 193 ..addAll(sharedOptions) |
| 187 ..addAll(originalArguments); | 194 ..addAll(originalArguments); |
| 188 } | 195 } |
| 189 } | 196 } |
| 190 | 197 |
| 191 /// Common configuration for dart2js-based tools, such as, dart2js | 198 /// Common configuration for dart2js-based tools, such as, dart2js |
| 192 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 199 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 RuntimeConfiguration runtimeConfiguration, | 655 RuntimeConfiguration runtimeConfiguration, |
| 649 String buildDir, | 656 String buildDir, |
| 650 TestInformation info, | 657 TestInformation info, |
| 651 List<String> vmOptions, | 658 List<String> vmOptions, |
| 652 List<String> sharedOptions, | 659 List<String> sharedOptions, |
| 653 List<String> originalArguments, | 660 List<String> originalArguments, |
| 654 CommandArtifact artifact) { | 661 CommandArtifact artifact) { |
| 655 return <String>[]; | 662 return <String>[]; |
| 656 } | 663 } |
| 657 } | 664 } |
| OLD | NEW |