| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return new AnalyzerCompilerConfiguration( | 66 return new AnalyzerCompilerConfiguration( |
| 67 'dartanalyzer', isDebug: isDebug, isChecked: isChecked, | 67 'dartanalyzer', isDebug: isDebug, isChecked: isChecked, |
| 68 isHostChecked: isHostChecked, useSdk: useSdk); | 68 isHostChecked: isHostChecked, useSdk: useSdk); |
| 69 case 'dart2analyzer': | 69 case 'dart2analyzer': |
| 70 return new DartBasedAnalyzerCompilerConfiguration( | 70 return new DartBasedAnalyzerCompilerConfiguration( |
| 71 isDebug: isDebug, isChecked: isChecked, | 71 isDebug: isDebug, isChecked: isChecked, |
| 72 isHostChecked: isHostChecked, useSdk: useSdk); | 72 isHostChecked: isHostChecked, useSdk: useSdk); |
| 73 case 'dart2js': | 73 case 'dart2js': |
| 74 return new Dart2jsCompilerConfiguration( | 74 return new Dart2jsCompilerConfiguration( |
| 75 isDebug: isDebug, isChecked: isChecked, | 75 isDebug: isDebug, isChecked: isChecked, |
| 76 isHostChecked: isHostChecked, useSdk: useSdk, isCsp: isCsp); | 76 isHostChecked: isHostChecked, useSdk: useSdk, isCsp: isCsp, |
| 77 extraDart2jsOptions: |
| 78 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
| 77 case 'dart2dart': | 79 case 'dart2dart': |
| 78 return new Dart2dartCompilerConfiguration( | 80 return new Dart2dartCompilerConfiguration( |
| 79 isDebug: isDebug, isChecked: isChecked, | 81 isDebug: isDebug, isChecked: isChecked, |
| 80 isHostChecked: isHostChecked, useSdk: useSdk); | 82 isHostChecked: isHostChecked, useSdk: useSdk); |
| 81 case 'none': | 83 case 'none': |
| 82 return new NoneCompilerConfiguration( | 84 return new NoneCompilerConfiguration( |
| 83 isDebug: isDebug, isChecked: isChecked, | 85 isDebug: isDebug, isChecked: isChecked, |
| 84 isHostChecked: isHostChecked, useSdk: useSdk); | 86 isHostChecked: isHostChecked, useSdk: useSdk); |
| 85 default: | 87 default: |
| 86 throw "Unknown compiler '$compiler'"; | 88 throw "Unknown compiler '$compiler'"; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 217 |
| 216 Uri absoluteBuildDir = Uri.base.resolveUri(nativeDirectoryToUri(buildDir)); | 218 Uri absoluteBuildDir = Uri.base.resolveUri(nativeDirectoryToUri(buildDir)); |
| 217 return [absoluteBuildDir.resolve( | 219 return [absoluteBuildDir.resolve( |
| 218 'dart-sdk/bin/snapshots/dart2js.dart.snapshot')]; | 220 'dart-sdk/bin/snapshots/dart2js.dart.snapshot')]; |
| 219 } | 221 } |
| 220 } | 222 } |
| 221 | 223 |
| 222 /// Configuration for dart2js compiler. | 224 /// Configuration for dart2js compiler. |
| 223 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { | 225 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { |
| 224 final bool isCsp; | 226 final bool isCsp; |
| 227 final List<String> extraDart2jsOptions; |
| 225 | 228 |
| 226 Dart2jsCompilerConfiguration({ | 229 Dart2jsCompilerConfiguration({ |
| 227 bool isDebug, | 230 bool isDebug, |
| 228 bool isChecked, | 231 bool isChecked, |
| 229 bool isHostChecked, | 232 bool isHostChecked, |
| 230 bool useSdk, | 233 bool useSdk, |
| 231 bool this.isCsp}) | 234 bool this.isCsp, |
| 235 this.extraDart2jsOptions}) |
| 232 : super( | 236 : super( |
| 233 'dart2js', | 237 'dart2js', |
| 234 isDebug: isDebug, isChecked: isChecked, | 238 isDebug: isDebug, isChecked: isChecked, |
| 235 isHostChecked: isHostChecked, useSdk: useSdk); | 239 isHostChecked: isHostChecked, useSdk: useSdk); |
| 236 | 240 |
| 237 int computeTimeoutMultiplier() { | 241 int computeTimeoutMultiplier() { |
| 238 int multiplier = 1; | 242 int multiplier = 1; |
| 239 if (isDebug) multiplier *= 4; | 243 if (isDebug) multiplier *= 4; |
| 240 if (isChecked) multiplier *= 2; | 244 if (isChecked) multiplier *= 2; |
| 241 if (isHostChecked) multiplier *= 16; | 245 if (isHostChecked) multiplier *= 16; |
| 242 return multiplier; | 246 return multiplier; |
| 243 } | 247 } |
| 244 | 248 |
| 245 CommandArtifact computeCompilationArtifact( | 249 CommandArtifact computeCompilationArtifact( |
| 246 String buildDir, | 250 String buildDir, |
| 247 String tempDir, | 251 String tempDir, |
| 248 CommandBuilder commandBuilder, | 252 CommandBuilder commandBuilder, |
| 249 List arguments, | 253 List arguments, |
| 250 Map<String, String> environmentOverrides) { | 254 Map<String, String> environmentOverrides) { |
| 251 return new CommandArtifact( | 255 return new CommandArtifact( |
| 252 <Command>[ | 256 <Command>[ |
| 253 this.computeCompilationCommand( | 257 this.computeCompilationCommand( |
| 254 '$tempDir/out.js', | 258 '$tempDir/out.js', |
| 255 buildDir, | 259 buildDir, |
| 256 CommandBuilder.instance, | 260 CommandBuilder.instance, |
| 257 arguments, | 261 []..addAll(arguments)..addAll(extraDart2jsOptions), |
| 258 environmentOverrides)], | 262 environmentOverrides)], |
| 259 '$tempDir/out.js', | 263 '$tempDir/out.js', |
| 260 'application/javascript'); | 264 'application/javascript'); |
| 261 } | 265 } |
| 262 | 266 |
| 263 List<String> computeRuntimeArguments( | 267 List<String> computeRuntimeArguments( |
| 264 RuntimeConfiguration runtimeConfiguration, | 268 RuntimeConfiguration runtimeConfiguration, |
| 265 String buildDir, | 269 String buildDir, |
| 266 TestInformation info, | 270 TestInformation info, |
| 267 List<String> vmOptions, | 271 List<String> vmOptions, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 bool isDebug, | 386 bool isDebug, |
| 383 bool isChecked, | 387 bool isChecked, |
| 384 bool isHostChecked, | 388 bool isHostChecked, |
| 385 bool useSdk}) | 389 bool useSdk}) |
| 386 : super( | 390 : super( |
| 387 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, | 391 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, |
| 388 isHostChecked: isHostChecked, useSdk: useSdk); | 392 isHostChecked: isHostChecked, useSdk: useSdk); |
| 389 | 393 |
| 390 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; | 394 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; |
| 391 } | 395 } |
| OLD | NEW |