| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 ..addAll(vmOptions) | 162 ..addAll(vmOptions) |
| 163 ..addAll(sharedOptions) | 163 ..addAll(sharedOptions) |
| 164 ..addAll(originalArguments); | 164 ..addAll(originalArguments); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 /// Common configuration for dart2js-based tools, such as, dart2js and | 168 /// Common configuration for dart2js-based tools, such as, dart2js and |
| 169 /// dart2dart. | 169 /// dart2dart. |
| 170 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 170 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
| 171 final String moniker; | 171 final String moniker; |
| 172 static Map<String, List<Uri>> _bootstrapDependenciesCache = |
| 173 new Map<String, List<Uri>>(); |
| 172 | 174 |
| 173 Dart2xCompilerConfiguration( | 175 Dart2xCompilerConfiguration( |
| 174 this.moniker, | 176 this.moniker, |
| 175 {bool isDebug, | 177 {bool isDebug, |
| 176 bool isChecked, | 178 bool isChecked, |
| 177 bool isHostChecked, | 179 bool isHostChecked, |
| 178 bool useSdk}) | 180 bool useSdk}) |
| 179 : super._subclass( | 181 : super._subclass( |
| 180 isDebug: isDebug, isChecked: isChecked, | 182 isDebug: isDebug, isChecked: isChecked, |
| 181 isHostChecked: isHostChecked, useSdk: useSdk); | 183 isHostChecked: isHostChecked, useSdk: useSdk); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 207 | 209 |
| 208 return commandBuilder.getCompilationCommand( | 210 return commandBuilder.getCompilationCommand( |
| 209 moniker, outputFileName, !useSdk, | 211 moniker, outputFileName, !useSdk, |
| 210 bootstrapDependencies(buildDir), | 212 bootstrapDependencies(buildDir), |
| 211 computeCompilerPath(buildDir), | 213 computeCompilerPath(buildDir), |
| 212 arguments, environmentOverrides); | 214 arguments, environmentOverrides); |
| 213 } | 215 } |
| 214 | 216 |
| 215 List<Uri> bootstrapDependencies(String buildDir) { | 217 List<Uri> bootstrapDependencies(String buildDir) { |
| 216 if (!useSdk) return const <Uri>[]; | 218 if (!useSdk) return const <Uri>[]; |
| 217 | 219 return _bootstrapDependenciesCache.putIfAbsent(buildDir, () => |
| 218 Uri absoluteBuildDir = Uri.base.resolveUri(nativeDirectoryToUri(buildDir)); | 220 [Uri.base.resolveUri(nativeDirectoryToUri(buildDir)) |
| 219 return [absoluteBuildDir.resolve( | 221 .resolve('dart-sdk/bin/snapshots/dart2js.dart.snapshot')]); |
| 220 'dart-sdk/bin/snapshots/dart2js.dart.snapshot')]; | |
| 221 } | 222 } |
| 222 } | 223 } |
| 223 | 224 |
| 224 /// Configuration for dart2js compiler. | 225 /// Configuration for dart2js compiler. |
| 225 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { | 226 class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration { |
| 226 final bool isCsp; | 227 final bool isCsp; |
| 227 final List<String> extraDart2jsOptions; | 228 final List<String> extraDart2jsOptions; |
| 228 | 229 |
| 229 Dart2jsCompilerConfiguration({ | 230 Dart2jsCompilerConfiguration({ |
| 230 bool isDebug, | 231 bool isDebug, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 bool isDebug, | 387 bool isDebug, |
| 387 bool isChecked, | 388 bool isChecked, |
| 388 bool isHostChecked, | 389 bool isHostChecked, |
| 389 bool useSdk}) | 390 bool useSdk}) |
| 390 : super( | 391 : super( |
| 391 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, | 392 'dart2analyzer', isDebug: isDebug, isChecked: isChecked, |
| 392 isHostChecked: isHostChecked, useSdk: useSdk); | 393 isHostChecked: isHostChecked, useSdk: useSdk); |
| 393 | 394 |
| 394 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; | 395 String computeCompilerPath(String buildDir) => 'editor/tools/analyzer'; |
| 395 } | 396 } |
| OLD | NEW |