Chromium Code Reviews| 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 |
| 11 RuntimeConfiguration; | 11 RuntimeConfiguration; |
| 12 | 12 |
| 13 import 'test_runner.dart' show | 13 import 'test_runner.dart' show |
| 14 Command, | 14 Command, |
| 15 CommandBuilder, | 15 CommandBuilder, |
| 16 CompilationCommand; | 16 CompilationCommand; |
| 17 | 17 |
| 18 import 'test_suite.dart' show | 18 import 'test_suite.dart' show |
| 19 TestInformation; | 19 TestInformation, |
| 20 TestUtils; | |
| 21 | |
| 22 import 'utils.dart' show | |
| 23 Path; | |
| 20 | 24 |
| 21 /// Grouping of a command with its expected result. | 25 /// Grouping of a command with its expected result. |
| 22 class CommandArtifact { | 26 class CommandArtifact { |
| 23 final List<Command> commands; | 27 final List<Command> commands; |
| 24 | 28 |
| 25 /// Expected result of running [command]. | 29 /// Expected result of running [command]. |
| 26 final String filename; | 30 final String filename; |
| 27 | 31 |
| 28 /// MIME type of [filename]. | 32 /// MIME type of [filename]. |
| 29 final String mimeType; | 33 final String mimeType; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 String buildDir, | 121 String buildDir, |
| 118 String tempDir, | 122 String tempDir, |
| 119 CommandBuilder commandBuilder, | 123 CommandBuilder commandBuilder, |
| 120 List arguments, | 124 List arguments, |
| 121 Map<String, String> environmentOverrides) { | 125 Map<String, String> environmentOverrides) { |
| 122 return new CommandArtifact([], null, null); | 126 return new CommandArtifact([], null, null); |
| 123 } | 127 } |
| 124 | 128 |
| 125 List<String> computeRuntimeArguments( | 129 List<String> computeRuntimeArguments( |
| 126 RuntimeConfiguration runtimeConfiguration, | 130 RuntimeConfiguration runtimeConfiguration, |
| 131 String buildDir, | |
| 127 TestInformation info, | 132 TestInformation info, |
| 128 List<String> vmOptions, | 133 List<String> vmOptions, |
| 129 List<String> sharedOptions, | 134 List<String> sharedOptions, |
| 130 List<String> originalArguments, | 135 List<String> originalArguments, |
| 131 CommandArtifact artifact) { | 136 CommandArtifact artifact) { |
| 132 return <String>[artifact.filename]; | 137 return <String>[artifact.filename]; |
| 133 } | 138 } |
| 134 } | 139 } |
| 135 | 140 |
| 136 /// The "none" compiler. | 141 /// The "none" compiler. |
| 137 class NoneCompilerConfiguration extends CompilerConfiguration { | 142 class NoneCompilerConfiguration extends CompilerConfiguration { |
| 138 NoneCompilerConfiguration({ | 143 NoneCompilerConfiguration({ |
| 139 bool isDebug, | 144 bool isDebug, |
| 140 bool isChecked, | 145 bool isChecked, |
| 141 bool isHostChecked, | 146 bool isHostChecked, |
| 142 bool useSdk}) | 147 bool useSdk}) |
| 143 : super._subclass( | 148 : super._subclass( |
| 144 isDebug: isDebug, isChecked: isChecked, | 149 isDebug: isDebug, isChecked: isChecked, |
| 145 isHostChecked: isHostChecked, useSdk: useSdk); | 150 isHostChecked: isHostChecked, useSdk: useSdk); |
| 146 | 151 |
| 147 bool get hasCompiler => false; | 152 bool get hasCompiler => false; |
| 148 | 153 |
| 149 List<String> computeRuntimeArguments( | 154 List<String> computeRuntimeArguments( |
| 150 RuntimeConfiguration runtimeConfiguration, | 155 RuntimeConfiguration runtimeConfiguration, |
| 156 String buildDir, | |
| 151 TestInformation info, | 157 TestInformation info, |
| 152 List<String> vmOptions, | 158 List<String> vmOptions, |
| 153 List<String> sharedOptions, | 159 List<String> sharedOptions, |
| 154 List<String> originalArguments, | 160 List<String> originalArguments, |
| 155 CommandArtifact artifact) { | 161 CommandArtifact artifact) { |
| 156 return <String>[] | 162 return <String>[] |
| 157 ..addAll(vmOptions) | 163 ..addAll(vmOptions) |
| 158 ..addAll(sharedOptions) | 164 ..addAll(sharedOptions) |
| 159 ..addAll(originalArguments); | 165 ..addAll(originalArguments); |
| 160 } | 166 } |
| 161 } | 167 } |
| 162 | 168 |
| 163 /// Common configuration for dart2js-based tools, such as, dart2js and | 169 /// Common configuration for dart2js-based tools, such as, dart2js and |
| 164 /// dart2dart. | 170 /// dart2dart. |
| 165 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 171 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
| 166 final String moniker; | 172 final String moniker; |
| 167 | 173 |
| 168 Dart2xCompilerConfiguration( | 174 Dart2xCompilerConfiguration( |
| 169 this.moniker, | 175 this.moniker, |
| 170 {bool isDebug, | 176 {bool isDebug, |
| 171 bool isChecked, | 177 bool isChecked, |
| 172 bool isHostChecked, | 178 bool isHostChecked, |
| 173 bool useSdk}) | 179 bool useSdk}) |
| 174 : super._subclass( | 180 : super._subclass( |
| 175 isDebug: isDebug, isChecked: isChecked, | 181 isDebug: isDebug, isChecked: isChecked, |
| 176 isHostChecked: isHostChecked, useSdk: useSdk); | 182 isHostChecked: isHostChecked, useSdk: useSdk); |
| 177 | 183 |
| 178 String computeCompilerPath(String buildDir) { | 184 String computeCompilerPath(String buildDir) { |
| 179 var prefix = 'sdk/bin/'; | 185 var prefix = 'sdk/bin'; |
|
Bill Hesse
2014/03/05 15:04:41
This was causing a double /.
| |
| 180 String suffix = executableScriptSuffix; | 186 String suffix = executableScriptSuffix; |
| 181 if (isHostChecked) { | 187 if (isHostChecked) { |
| 182 // The script dart2js_developer is not included in the | 188 // The script dart2js_developer is not included in the |
| 183 // shipped SDK, that is the script is not installed in | 189 // shipped SDK, that is the script is not installed in |
| 184 // "$buildDir/dart-sdk/bin/" | 190 // "$buildDir/dart-sdk/bin/" |
| 185 return '$prefix/dart2js_developer$suffix'; | 191 return '$prefix/dart2js_developer$suffix'; |
| 186 } else { | 192 } else { |
| 187 if (useSdk) { | 193 if (useSdk) { |
| 188 prefix = '$buildDir/dart-sdk/bin'; | 194 prefix = '$buildDir/dart-sdk/bin'; |
| 189 } | 195 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 CommandBuilder.instance, | 261 CommandBuilder.instance, |
| 256 arguments, | 262 arguments, |
| 257 environmentOverrides)], | 263 environmentOverrides)], |
| 258 // dart2js always produce both out.js and out.precompiled.js. To avoid | 264 // dart2js always produce both out.js and out.precompiled.js. To avoid |
| 259 // recompiling the CSP version, we always tell the CompilationCommand | 265 // recompiling the CSP version, we always tell the CompilationCommand |
| 260 // to track the timestamp of out.js, but select which one to run based | 266 // to track the timestamp of out.js, but select which one to run based |
| 261 // on CSP mode. | 267 // on CSP mode. |
| 262 isCsp ? cspOutput : normalOutput, | 268 isCsp ? cspOutput : normalOutput, |
| 263 'application/javascript'); | 269 'application/javascript'); |
| 264 } | 270 } |
| 271 | |
| 272 List<String> computeRuntimeArguments( | |
| 273 RuntimeConfiguration runtimeConfiguration, | |
| 274 String buildDir, | |
| 275 TestInformation info, | |
| 276 List<String> vmOptions, | |
| 277 List<String> sharedOptions, | |
| 278 List<String> originalArguments, | |
| 279 CommandArtifact artifact) { | |
| 280 Path sdk = useSdk ? new Path(buildDir).append('dart-sdk/'): | |
| 281 TestUtils.dartDir().append('sdk/'); | |
| 282 Path preambleDir = sdk.append('lib/_internal/lib/preambles/'); | |
| 283 return runtimeConfiguration.dart2jsPreambles(preambleDir) | |
| 284 ..add(artifact.filename); | |
| 285 } | |
| 265 } | 286 } |
| 266 | 287 |
| 267 /// Configuration for dart2dart compiler. | 288 /// Configuration for dart2dart compiler. |
| 268 class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration { | 289 class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration { |
| 269 Dart2dartCompilerConfiguration({ | 290 Dart2dartCompilerConfiguration({ |
| 270 bool isDebug, | 291 bool isDebug, |
| 271 bool isChecked, | 292 bool isChecked, |
| 272 bool isHostChecked, | 293 bool isHostChecked, |
| 273 bool useSdk}) | 294 bool useSdk}) |
| 274 : super( | 295 : super( |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 291 buildDir, | 312 buildDir, |
| 292 CommandBuilder.instance, | 313 CommandBuilder.instance, |
| 293 arguments, | 314 arguments, |
| 294 environmentOverrides)], | 315 environmentOverrides)], |
| 295 outputFileName, | 316 outputFileName, |
| 296 'application/dart'); | 317 'application/dart'); |
| 297 } | 318 } |
| 298 | 319 |
| 299 List<String> computeRuntimeArguments( | 320 List<String> computeRuntimeArguments( |
| 300 RuntimeConfiguration runtimeConfiguration, | 321 RuntimeConfiguration runtimeConfiguration, |
| 322 String buildDir, | |
| 301 TestInformation info, | 323 TestInformation info, |
| 302 List<String> vmOptions, | 324 List<String> vmOptions, |
| 303 List<String> sharedOptions, | 325 List<String> sharedOptions, |
| 304 List<String> originalArguments, | 326 List<String> originalArguments, |
| 305 CommandArtifact artifact) { | 327 CommandArtifact artifact) { |
| 306 // TODO(antonm): support checked. | 328 // TODO(antonm): support checked. |
| 307 return <String>[] | 329 return <String>[] |
| 308 ..addAll(vmOptions) | 330 ..addAll(vmOptions) |
| 309 ..add('--ignore-unrecognized-flags') | 331 ..add('--ignore-unrecognized-flags') |
| 310 ..add(artifact.filename); | 332 ..add(artifact.filename); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 commandBuilder.getAnalysisCommand( | 367 commandBuilder.getAnalysisCommand( |
| 346 moniker, computeCompilerPath(buildDir), arguments, | 368 moniker, computeCompilerPath(buildDir), arguments, |
| 347 environmentOverrides, | 369 environmentOverrides, |
| 348 flavor: moniker)], | 370 flavor: moniker)], |
| 349 null, null); // Since this is not a real compilation, no artifacts are | 371 null, null); // Since this is not a real compilation, no artifacts are |
| 350 // produced. | 372 // produced. |
| 351 } | 373 } |
| 352 | 374 |
| 353 List<String> computeRuntimeArguments( | 375 List<String> computeRuntimeArguments( |
| 354 RuntimeConfiguration runtimeConfiguration, | 376 RuntimeConfiguration runtimeConfiguration, |
| 377 String buildDir, | |
| 355 TestInformation info, | 378 TestInformation info, |
| 356 List<String> vmOptions, | 379 List<String> vmOptions, |
| 357 List<String> sharedOptions, | 380 List<String> sharedOptions, |
| 358 List<String> originalArguments, | 381 List<String> originalArguments, |
| 359 CommandArtifact artifact) { | 382 CommandArtifact artifact) { |
| 360 return <String>[]; | 383 return <String>[]; |
| 361 } | 384 } |
| 362 } | 385 } |
| 363 | 386 |
| 364 class DartBasedAnalyzerCompilerConfiguration | 387 class DartBasedAnalyzerCompilerConfiguration |
| 365 extends AnalyzerCompilerConfiguration { | 388 extends AnalyzerCompilerConfiguration { |
| 366 DartBasedAnalyzerCompilerConfiguration({ | 389 DartBasedAnalyzerCompilerConfiguration({ |
| 367 bool isDebug, | 390 bool isDebug, |
| 368 bool isChecked, | 391 bool isChecked, |
| 369 bool isHostChecked, | 392 bool isHostChecked, |
| 370 bool useSdk}) | 393 bool useSdk}) |
| 371 : super( | 394 : super( |
| 372 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, | 395 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, |
| 373 isHostChecked: isHostChecked, useSdk: useSdk); | 396 isHostChecked: isHostChecked, useSdk: useSdk); |
| 374 | 397 |
| 375 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; | 398 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; |
| 376 } | 399 } |
| OLD | NEW |