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, bool hotRe load}) |
Cutch
2016/07/01 18:21:09
80 columns here and elsewhere
rmacnak
2016/07/01 18:27:40
Done.
| |
154 : super._subclass( | 158 : super._subclass( |
155 isDebug: isDebug, | 159 isDebug: isDebug, |
156 isChecked: isChecked, | 160 isChecked: isChecked, |
157 isHostChecked: isHostChecked, | 161 isHostChecked: isHostChecked, |
158 useSdk: useSdk); | 162 useSdk: useSdk), |
163 this.hotReload = hotReload; | |
159 | 164 |
160 bool get hasCompiler => false; | 165 bool get hasCompiler => false; |
161 | 166 |
162 List<String> computeRuntimeArguments( | 167 List<String> computeRuntimeArguments( |
163 RuntimeConfiguration runtimeConfiguration, | 168 RuntimeConfiguration runtimeConfiguration, |
164 String buildDir, | 169 String buildDir, |
165 TestInformation info, | 170 TestInformation info, |
166 List<String> vmOptions, | 171 List<String> vmOptions, |
167 List<String> sharedOptions, | 172 List<String> sharedOptions, |
168 List<String> originalArguments, | 173 List<String> originalArguments, |
169 CommandArtifact artifact) { | 174 CommandArtifact artifact) { |
170 List<String> args = []; | 175 List<String> args = []; |
171 if (isChecked) { | 176 if (isChecked) { |
172 args.add('--enable_asserts'); | 177 args.add('--enable_asserts'); |
173 args.add('--enable_type_checks'); | 178 args.add('--enable_type_checks'); |
174 } | 179 } |
180 if (hotReload) { | |
181 args.add('--identity-reload'); | |
182 args.add('--reload-every=100000'); | |
183 args.add('--no-background-compilation'); | |
184 args.add('--no-osr'); | |
185 } | |
175 return args | 186 return args |
176 ..addAll(vmOptions) | 187 ..addAll(vmOptions) |
177 ..addAll(sharedOptions) | 188 ..addAll(sharedOptions) |
178 ..addAll(originalArguments); | 189 ..addAll(originalArguments); |
179 } | 190 } |
180 } | 191 } |
181 | 192 |
182 /// Common configuration for dart2js-based tools, such as, dart2js | 193 /// Common configuration for dart2js-based tools, such as, dart2js |
183 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 194 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
184 final String moniker; | 195 final String moniker; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
639 RuntimeConfiguration runtimeConfiguration, | 650 RuntimeConfiguration runtimeConfiguration, |
640 String buildDir, | 651 String buildDir, |
641 TestInformation info, | 652 TestInformation info, |
642 List<String> vmOptions, | 653 List<String> vmOptions, |
643 List<String> sharedOptions, | 654 List<String> sharedOptions, |
644 List<String> originalArguments, | 655 List<String> originalArguments, |
645 CommandArtifact artifact) { | 656 CommandArtifact artifact) { |
646 return <String>[]; | 657 return <String>[]; |
647 } | 658 } |
648 } | 659 } |
OLD | NEW |