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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // TODO(ahe): Move these booleans into a struction configuration object | 55 // TODO(ahe): Move these booleans into a struction configuration object |
56 // which can eventually completely replace the Map-based configuration | 56 // which can eventually completely replace the Map-based configuration |
57 // object. | 57 // object. |
58 bool isDebug = configuration['mode'] == 'debug'; | 58 bool isDebug = configuration['mode'] == 'debug'; |
59 bool isChecked = configuration['checked']; | 59 bool isChecked = configuration['checked']; |
60 bool isHostChecked = configuration['host_checked']; | 60 bool isHostChecked = configuration['host_checked']; |
61 bool useSdk = configuration['use_sdk']; | 61 bool useSdk = configuration['use_sdk']; |
62 bool isCsp = configuration['csp']; | 62 bool isCsp = configuration['csp']; |
63 bool useCps = configuration['cps_ir']; | 63 bool useCps = configuration['cps_ir']; |
64 bool useNoopt = configuration['noopt']; | |
65 | 64 |
66 switch (compiler) { | 65 switch (compiler) { |
67 case 'dart2analyzer': | 66 case 'dart2analyzer': |
68 return new AnalyzerCompilerConfiguration( | 67 return new AnalyzerCompilerConfiguration( |
69 isDebug: isDebug, isChecked: isChecked, | 68 isDebug: isDebug, isChecked: isChecked, |
70 isHostChecked: isHostChecked, useSdk: useSdk); | 69 isHostChecked: isHostChecked, useSdk: useSdk); |
71 case 'dart2js': | 70 case 'dart2js': |
72 return new Dart2jsCompilerConfiguration( | 71 return new Dart2jsCompilerConfiguration( |
73 isDebug: isDebug, isChecked: isChecked, | 72 isDebug: isDebug, isChecked: isChecked, |
74 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, | 73 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, |
75 isCsp: isCsp, extraDart2jsOptions: | 74 isCsp: isCsp, extraDart2jsOptions: |
76 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 75 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
77 case 'precompiler': | 76 case 'precompiler': |
78 return new PrecompilerCompilerConfiguration( | 77 return new PrecompilerCompilerConfiguration( |
79 isDebug: isDebug, isChecked: isChecked); | 78 isDebug: isDebug, isChecked: isChecked); |
80 case 'none': | 79 case 'none': |
81 return new NoneCompilerConfiguration( | 80 return new NoneCompilerConfiguration( |
82 isDebug: isDebug, isChecked: isChecked, | 81 isDebug: isDebug, isChecked: isChecked, |
83 isHostChecked: isHostChecked, useSdk: useSdk, useNoopt: useNoopt); | 82 isHostChecked: isHostChecked, useSdk: useSdk); |
84 default: | 83 default: |
85 throw "Unknown compiler '$compiler'"; | 84 throw "Unknown compiler '$compiler'"; |
86 } | 85 } |
87 } | 86 } |
88 | 87 |
89 CompilerConfiguration._subclass({ | 88 CompilerConfiguration._subclass({ |
90 this.isDebug: false, | 89 this.isDebug: false, |
91 this.isChecked: false, | 90 this.isChecked: false, |
92 this.isHostChecked: false, | 91 this.isHostChecked: false, |
93 this.useSdk: false}); | 92 this.useSdk: false}); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 List<String> vmOptions, | 134 List<String> vmOptions, |
136 List<String> sharedOptions, | 135 List<String> sharedOptions, |
137 List<String> originalArguments, | 136 List<String> originalArguments, |
138 CommandArtifact artifact) { | 137 CommandArtifact artifact) { |
139 return <String>[artifact.filename]; | 138 return <String>[artifact.filename]; |
140 } | 139 } |
141 } | 140 } |
142 | 141 |
143 /// The "none" compiler. | 142 /// The "none" compiler. |
144 class NoneCompilerConfiguration extends CompilerConfiguration { | 143 class NoneCompilerConfiguration extends CompilerConfiguration { |
145 final bool useNoopt; | |
146 | 144 |
147 NoneCompilerConfiguration({ | 145 NoneCompilerConfiguration({ |
148 bool isDebug, | 146 bool isDebug, |
149 bool isChecked, | 147 bool isChecked, |
150 bool isHostChecked, | 148 bool isHostChecked, |
151 bool useSdk, | 149 bool useSdk}) |
152 bool useNoopt}) | |
153 : super._subclass( | 150 : super._subclass( |
154 isDebug: isDebug, isChecked: isChecked, | 151 isDebug: isDebug, isChecked: isChecked, |
155 isHostChecked: isHostChecked, useSdk: useSdk), useNoopt = useNoopt; | 152 isHostChecked: isHostChecked, useSdk: useSdk); |
156 | 153 |
157 bool get hasCompiler => false; | 154 bool get hasCompiler => false; |
158 | 155 |
159 List<String> computeRuntimeArguments( | 156 List<String> computeRuntimeArguments( |
160 RuntimeConfiguration runtimeConfiguration, | 157 RuntimeConfiguration runtimeConfiguration, |
161 String buildDir, | 158 String buildDir, |
162 TestInformation info, | 159 TestInformation info, |
163 List<String> vmOptions, | 160 List<String> vmOptions, |
164 List<String> sharedOptions, | 161 List<String> sharedOptions, |
165 List<String> originalArguments, | 162 List<String> originalArguments, |
166 CommandArtifact artifact) { | 163 CommandArtifact artifact) { |
167 List<String> args = []; | 164 List<String> args = []; |
168 if (isChecked) { | 165 if (isChecked) { |
169 args.add('--enable_asserts'); | 166 args.add('--enable_asserts'); |
170 args.add('--enable_type_checks'); | 167 args.add('--enable_type_checks'); |
171 } | 168 } |
172 if (useNoopt) { | |
173 args.add('--noopt'); | |
174 } | |
175 return args | 169 return args |
176 ..addAll(vmOptions) | 170 ..addAll(vmOptions) |
177 ..addAll(sharedOptions) | 171 ..addAll(sharedOptions) |
178 ..addAll(originalArguments); | 172 ..addAll(originalArguments); |
179 } | 173 } |
180 } | 174 } |
181 | 175 |
182 /// Common configuration for dart2js-based tools, such as, dart2js | 176 /// Common configuration for dart2js-based tools, such as, dart2js |
183 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 177 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
184 final String moniker; | 178 final String moniker; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 RuntimeConfiguration runtimeConfiguration, | 439 RuntimeConfiguration runtimeConfiguration, |
446 String buildDir, | 440 String buildDir, |
447 TestInformation info, | 441 TestInformation info, |
448 List<String> vmOptions, | 442 List<String> vmOptions, |
449 List<String> sharedOptions, | 443 List<String> sharedOptions, |
450 List<String> originalArguments, | 444 List<String> originalArguments, |
451 CommandArtifact artifact) { | 445 CommandArtifact artifact) { |
452 return <String>[]; | 446 return <String>[]; |
453 } | 447 } |
454 } | 448 } |
OLD | NEW |