Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 | 2 |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import 'package:args/args.dart' show ArgParser, ArgResults; | 6 import 'package:args/args.dart' show ArgParser, ArgResults; |
| 7 import 'package:analyzer/file_system/file_system.dart' | 7 import 'package:analyzer/file_system/file_system.dart' |
| 8 show ResourceProvider, ResourceUriResolver; | 8 show ResourceProvider, ResourceUriResolver; |
| 9 import 'package:analyzer/file_system/physical_file_system.dart' | 9 import 'package:analyzer/file_system/physical_file_system.dart' |
| 10 show PhysicalResourceProvider; | 10 show PhysicalResourceProvider; |
| 11 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl; | 11 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl; |
| 12 import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk; | |
| 12 import 'package:analyzer/src/generated/engine.dart' | 13 import 'package:analyzer/src/generated/engine.dart' |
| 13 show AnalysisContext, AnalysisEngine, AnalysisOptionsImpl; | 14 show AnalysisContext, AnalysisEngine, AnalysisOptionsImpl; |
| 14 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; | 15 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; |
| 15 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | |
| 16 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
| 17 import 'package:analyzer/src/generated/source_io.dart' | 17 import 'package:analyzer/src/generated/source_io.dart' |
| 18 show | 18 show |
| 19 CustomUriResolver, | 19 CustomUriResolver, |
| 20 DartUriResolver, | 20 DartUriResolver, |
| 21 PackageUriResolver, | 21 PackageUriResolver, |
| 22 SourceFactory, | 22 SourceFactory, |
| 23 UriResolver; | 23 UriResolver; |
| 24 import 'package:analyzer/src/summary/package_bundle_reader.dart' | 24 import 'package:analyzer/src/summary/package_bundle_reader.dart' |
| 25 show | 25 show |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 | 176 |
| 177 List<UriResolver> createFileResolvers(AnalyzerOptions options) { | 177 List<UriResolver> createFileResolvers(AnalyzerOptions options) { |
| 178 return [ | 178 return [ |
| 179 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE), | 179 new ResourceUriResolver(PhysicalResourceProvider.INSTANCE), |
| 180 options.useMultiPackage | 180 options.useMultiPackage |
| 181 ? new MultiPackageResolver(options.packagePaths) | 181 ? new MultiPackageResolver(options.packagePaths) |
| 182 : new PackageUriResolver([new JavaFile(options.packageRoot)]) | 182 : new PackageUriResolver([new JavaFile(options.packageRoot)]) |
| 183 ]; | 183 ]; |
| 184 } | 184 } |
| 185 | 185 |
| 186 DirectoryBasedDartSdk _createDirectoryBasedDartSdk(String sdkPath) { | 186 FolderBasedDartSdk _createFolderBasedDartSdk(String sdkPath) { |
|
Brian Wilkerson
2016/08/18 14:41:26
Return "DartSdk"?
vsm
2016/08/18 14:50:12
Ack - I'll leave as is since it's a private method
| |
| 187 var sdk = new DirectoryBasedDartSdk( | 187 var resourceProvider = PhysicalResourceProvider.INSTANCE; |
| 188 new JavaFile(sdkPath), /*useDart2jsPaths:*/ true); | 188 var sdk = new FolderBasedDartSdk(resourceProvider, |
| 189 resourceProvider.getFolder(sdkPath), /*useDart2jsPaths:*/ true); | |
| 189 sdk.useSummary = true; | 190 sdk.useSummary = true; |
| 190 sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true; | 191 sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true; |
| 191 return sdk; | 192 return sdk; |
| 192 } | 193 } |
| 193 | 194 |
| 194 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. | 195 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. |
| 195 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { | 196 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { |
| 196 var sdk = (sdkSummaryPath != null) | 197 var sdk = (sdkSummaryPath != null) |
| 197 ? new SummaryBasedDartSdk(sdkSummaryPath, true) | 198 ? new SummaryBasedDartSdk(sdkSummaryPath, true) |
| 198 : _createDirectoryBasedDartSdk(sdkPath); | 199 : _createFolderBasedDartSdk(sdkPath); |
| 199 return new DartUriResolver(sdk); | 200 return new DartUriResolver(sdk); |
| 200 } | 201 } |
| OLD | NEW |