OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.src.context.context_builder; | 5 library analyzer.src.context.context_builder; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return context; | 140 return context; |
141 } | 141 } |
142 | 142 |
143 Map<String, List<Folder>> convertPackagesToMap(Packages packages) { | 143 Map<String, List<Folder>> convertPackagesToMap(Packages packages) { |
144 if (packages == null || packages == Packages.noPackages) { | 144 if (packages == null || packages == Packages.noPackages) { |
145 return null; | 145 return null; |
146 } | 146 } |
147 Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>(); | 147 Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>(); |
148 packages.asMap().forEach((String packagePath, Uri uri) { | 148 packages.asMap().forEach((String packagePath, Uri uri) { |
149 String path = resourceProvider.pathContext.fromUri(uri); | 149 String path = resourceProvider.pathContext.fromUri(uri); |
| 150 if (path.endsWith(resourceProvider.pathContext.separator)) { |
| 151 path = path.substring(0, path.length - 1); |
| 152 } |
150 folderMap[packagePath] = [resourceProvider.getFolder(path)]; | 153 folderMap[packagePath] = [resourceProvider.getFolder(path)]; |
151 }); | 154 }); |
152 return folderMap; | 155 return folderMap; |
153 } | 156 } |
154 | 157 |
155 // void _processAnalysisOptions( | 158 // void _processAnalysisOptions( |
156 // AnalysisContext context, Map<String, YamlNode> optionMap) { | 159 // AnalysisContext context, Map<String, YamlNode> optionMap) { |
157 // List<OptionsProcessor> optionsProcessors = | 160 // List<OptionsProcessor> optionsProcessors = |
158 // AnalysisEngine.instance.optionsPlugin.optionsProcessors; | 161 // AnalysisEngine.instance.optionsPlugin.optionsProcessors; |
159 // try { | 162 // try { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 SdkDescription description = new SdkDescription(paths, options); | 280 SdkDescription description = new SdkDescription(paths, options); |
278 DartSdk dartSdk = sdkManager.getSdk(description, () { | 281 DartSdk dartSdk = sdkManager.getSdk(description, () { |
279 if (extFilePaths.isNotEmpty) { | 282 if (extFilePaths.isNotEmpty) { |
280 embedderSdk.addExtensions(extResolver.urlMappings); | 283 embedderSdk.addExtensions(extResolver.urlMappings); |
281 } | 284 } |
282 embedderSdk.analysisOptions = options; | 285 embedderSdk.analysisOptions = options; |
283 embedderSdk.useSummary = sdkManager.canUseSummaries; | 286 embedderSdk.useSummary = sdkManager.canUseSummaries; |
284 return embedderSdk; | 287 return embedderSdk; |
285 }); | 288 }); |
286 return dartSdk; | 289 return dartSdk; |
287 } else if (extFilePaths != null) { | 290 } else if (extFilePaths != null && extFilePaths.isNotEmpty) { |
288 // | 291 // |
289 // We have an extension file, but no embedder file. | 292 // We have an extension file, but no embedder file. |
290 // | 293 // |
291 String sdkPath = sdkManager.defaultSdkDirectory; | 294 String sdkPath = sdkManager.defaultSdkDirectory; |
292 List<String> paths = <String>[sdkPath]; | 295 List<String> paths = <String>[sdkPath]; |
293 paths.addAll(extFilePaths); | 296 paths.addAll(extFilePaths); |
294 SdkDescription description = new SdkDescription(paths, options); | 297 SdkDescription description = new SdkDescription(paths, options); |
295 return sdkManager.getSdk(description, () { | 298 return sdkManager.getSdk(description, () { |
296 DirectoryBasedDartSdk sdk = | 299 DirectoryBasedDartSdk sdk = |
297 new DirectoryBasedDartSdk(new JavaFile(sdkPath)); | 300 new DirectoryBasedDartSdk(new JavaFile(sdkPath)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 350 } |
348 file = folder | 351 file = folder |
349 .getChildAssumingFile(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); | 352 .getChildAssumingFile(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); |
350 if (file.exists) { | 353 if (file.exists) { |
351 return file; | 354 return file; |
352 } | 355 } |
353 } | 356 } |
354 return null; | 357 return null; |
355 } | 358 } |
356 } | 359 } |
OLD | NEW |