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']; |
64 | 65 |
65 switch (compiler) { | 66 switch (compiler) { |
66 case 'dartanalyzer': | 67 case 'dartanalyzer': |
67 return new AnalyzerCompilerConfiguration( | 68 return new AnalyzerCompilerConfiguration( |
68 'dartanalyzer', isDebug: isDebug, isChecked: isChecked, | 69 'dartanalyzer', isDebug: isDebug, isChecked: isChecked, |
69 isHostChecked: isHostChecked, useSdk: useSdk); | 70 isHostChecked: isHostChecked, useSdk: useSdk); |
70 case 'dart2analyzer': | 71 case 'dart2analyzer': |
71 return new DartBasedAnalyzerCompilerConfiguration( | 72 return new DartBasedAnalyzerCompilerConfiguration( |
72 isDebug: isDebug, isChecked: isChecked, | 73 isDebug: isDebug, isChecked: isChecked, |
73 isHostChecked: isHostChecked, useSdk: useSdk); | 74 isHostChecked: isHostChecked, useSdk: useSdk); |
74 case 'dart2js': | 75 case 'dart2js': |
75 return new Dart2jsCompilerConfiguration( | 76 return new Dart2jsCompilerConfiguration( |
76 isDebug: isDebug, isChecked: isChecked, | 77 isDebug: isDebug, isChecked: isChecked, |
77 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, | 78 isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk, |
78 isCsp: isCsp, extraDart2jsOptions: | 79 isCsp: isCsp, extraDart2jsOptions: |
79 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 80 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
80 case 'none': | 81 case 'none': |
81 return new NoneCompilerConfiguration( | 82 return new NoneCompilerConfiguration( |
82 isDebug: isDebug, isChecked: isChecked, | 83 isDebug: isDebug, isChecked: isChecked, |
83 isHostChecked: isHostChecked, useSdk: useSdk); | 84 isHostChecked: isHostChecked, useSdk: useSdk, useNoopt: useNoopt); |
84 default: | 85 default: |
85 throw "Unknown compiler '$compiler'"; | 86 throw "Unknown compiler '$compiler'"; |
86 } | 87 } |
87 } | 88 } |
88 | 89 |
89 CompilerConfiguration._subclass({ | 90 CompilerConfiguration._subclass({ |
90 this.isDebug: false, | 91 this.isDebug: false, |
91 this.isChecked: false, | 92 this.isChecked: false, |
92 this.isHostChecked: false, | 93 this.isHostChecked: false, |
93 this.useSdk: false}); | 94 this.useSdk: false}); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 List<String> vmOptions, | 130 List<String> vmOptions, |
130 List<String> sharedOptions, | 131 List<String> sharedOptions, |
131 List<String> originalArguments, | 132 List<String> originalArguments, |
132 CommandArtifact artifact) { | 133 CommandArtifact artifact) { |
133 return <String>[artifact.filename]; | 134 return <String>[artifact.filename]; |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 /// The "none" compiler. | 138 /// The "none" compiler. |
138 class NoneCompilerConfiguration extends CompilerConfiguration { | 139 class NoneCompilerConfiguration extends CompilerConfiguration { |
| 140 final bool useNoopt; |
| 141 |
139 NoneCompilerConfiguration({ | 142 NoneCompilerConfiguration({ |
140 bool isDebug, | 143 bool isDebug, |
141 bool isChecked, | 144 bool isChecked, |
142 bool isHostChecked, | 145 bool isHostChecked, |
143 bool useSdk}) | 146 bool useSdk, |
| 147 bool useNoopt}) |
144 : super._subclass( | 148 : super._subclass( |
145 isDebug: isDebug, isChecked: isChecked, | 149 isDebug: isDebug, isChecked: isChecked, |
146 isHostChecked: isHostChecked, useSdk: useSdk); | 150 isHostChecked: isHostChecked, useSdk: useSdk), useNoopt = useNoopt; |
147 | 151 |
148 bool get hasCompiler => false; | 152 bool get hasCompiler => false; |
149 | 153 |
150 List<String> computeRuntimeArguments( | 154 List<String> computeRuntimeArguments( |
151 RuntimeConfiguration runtimeConfiguration, | 155 RuntimeConfiguration runtimeConfiguration, |
152 String buildDir, | 156 String buildDir, |
153 TestInformation info, | 157 TestInformation info, |
154 List<String> vmOptions, | 158 List<String> vmOptions, |
155 List<String> sharedOptions, | 159 List<String> sharedOptions, |
156 List<String> originalArguments, | 160 List<String> originalArguments, |
157 CommandArtifact artifact) { | 161 CommandArtifact artifact) { |
158 List<String> args = []; | 162 List<String> args = []; |
159 if (isChecked) { | 163 if (isChecked) { |
160 args.add('--enable_asserts'); | 164 args.add('--enable_asserts'); |
161 args.add('--enable_type_checks'); | 165 args.add('--enable_type_checks'); |
162 } | 166 } |
| 167 if (useNoopt) { |
| 168 args.add('--noopt'); |
| 169 } |
163 return args | 170 return args |
164 ..addAll(vmOptions) | 171 ..addAll(vmOptions) |
165 ..addAll(sharedOptions) | 172 ..addAll(sharedOptions) |
166 ..addAll(originalArguments); | 173 ..addAll(originalArguments); |
167 } | 174 } |
168 } | 175 } |
169 | 176 |
170 /// Common configuration for dart2js-based tools, such as, dart2js | 177 /// Common configuration for dart2js-based tools, such as, dart2js |
171 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 178 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
172 final String moniker; | 179 final String moniker; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // shipped SDK, that is the script is not installed in | 375 // shipped SDK, that is the script is not installed in |
369 // "$buildDir/dart-sdk/bin/" | 376 // "$buildDir/dart-sdk/bin/" |
370 return '$prefix/dartanalyzer_developer$suffix'; | 377 return '$prefix/dartanalyzer_developer$suffix'; |
371 } | 378 } |
372 if (useSdk) { | 379 if (useSdk) { |
373 prefix = '$buildDir/dart-sdk/bin'; | 380 prefix = '$buildDir/dart-sdk/bin'; |
374 } | 381 } |
375 return '$prefix/dartanalyzer$suffix'; | 382 return '$prefix/dartanalyzer$suffix'; |
376 } | 383 } |
377 } | 384 } |
OLD | NEW |