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 // 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 import 'package:args/args.dart' show ArgParser, ArgResults; | 5 import 'package:args/args.dart' show ArgParser, ArgResults; |
6 import 'package:analyzer/file_system/file_system.dart' | 6 import 'package:analyzer/file_system/file_system.dart' |
7 show ResourceProvider, ResourceUriResolver; | 7 show ResourceProvider, ResourceUriResolver; |
8 import 'package:analyzer/file_system/physical_file_system.dart' | 8 import 'package:analyzer/file_system/physical_file_system.dart' |
9 show PhysicalResourceProvider; | 9 show PhysicalResourceProvider; |
10 import 'package:analyzer/source/custom_resolver.dart'; | 10 import 'package:analyzer/source/custom_resolver.dart'; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 | 44 |
45 /// Path to the dart-sdk summary. If this is set, it will be used in favor | 45 /// Path to the dart-sdk summary. If this is set, it will be used in favor |
46 /// of the unsummarized one. | 46 /// of the unsummarized one. |
47 final String dartSdkSummaryPath; | 47 final String dartSdkSummaryPath; |
48 | 48 |
49 AnalyzerOptions( | 49 AnalyzerOptions( |
50 {this.summaryPaths: const [], | 50 {this.summaryPaths: const [], |
51 String dartSdkPath, | 51 String dartSdkPath, |
52 this.dartSdkSummaryPath, | 52 this.dartSdkSummaryPath, |
53 this.customUrlMappings: const {}, | 53 this.customUrlMappings: const {}, |
54 this.packageRoot: null, | |
Jennifer Messerly
2016/09/28 17:49:05
style nit: ": null" part is not needed.
you do ne
| |
54 this.packagePaths: const []}) | 55 this.packagePaths: const []}) |
55 : dartSdkPath = dartSdkPath ?? getSdkDir().path; | 56 : dartSdkPath = dartSdkPath ?? getSdkDir().path; |
56 | 57 |
57 AnalyzerOptions.fromArguments(ArgResults args) | 58 AnalyzerOptions.fromArguments(ArgResults args) |
58 : summaryPaths = args['summary'] as List<String>, | 59 : summaryPaths = args['summary'] as List<String>, |
59 dartSdkPath = args['dart-sdk'] ?? getSdkDir().path, | 60 dartSdkPath = args['dart-sdk'] ?? getSdkDir().path, |
60 dartSdkSummaryPath = args['dart-sdk-summary'], | 61 dartSdkSummaryPath = args['dart-sdk-summary'], |
61 customUrlMappings = _parseUrlMappings(args['url-mapping']), | 62 customUrlMappings = _parseUrlMappings(args['url-mapping']), |
62 packageRoot = args['package-root'], | 63 packageRoot = args['package-root'], |
63 packagePaths = (args['package-paths'] as String)?.split(',') ?? []; | 64 packagePaths = (args['package-paths'] as String)?.split(',') ?? []; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 return sdk; | 164 return sdk; |
164 } | 165 } |
165 | 166 |
166 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. | 167 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. |
167 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { | 168 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { |
168 var sdk = (sdkSummaryPath != null) | 169 var sdk = (sdkSummaryPath != null) |
169 ? new SummaryBasedDartSdk(sdkSummaryPath, true) | 170 ? new SummaryBasedDartSdk(sdkSummaryPath, true) |
170 : _createFolderBasedDartSdk(sdkPath); | 171 : _createFolderBasedDartSdk(sdkPath); |
171 return new DartUriResolver(sdk); | 172 return new DartUriResolver(sdk); |
172 } | 173 } |
OLD | NEW |