| 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 context.directory.manager; | 5 library context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 | 383 |
| 384 /** | 384 /** |
| 385 * Compute the appropriate package URI resolver for [folder], and store | 385 * Compute the appropriate package URI resolver for [folder], and store |
| 386 * dependency information in [info]. Return `null` if no package map can | 386 * dependency information in [info]. Return `null` if no package map can |
| 387 * be computed. | 387 * be computed. |
| 388 */ | 388 */ |
| 389 UriResolver _computePackageUriResolver(Folder folder, _ContextInfo info) { | 389 UriResolver _computePackageUriResolver(Folder folder, _ContextInfo info) { |
| 390 if (info.packageRoot != null) { | 390 if (info.packageRoot != null) { |
| 391 info.packageMapInfo = null; | 391 info.packageMapInfo = null; |
| 392 Resource res = resourceProvider.getResource(info.packageRoot); |
| 393 if (res is Folder) { |
| 394 Map<String, List<Folder>> packageMap = new Map<String, List<Folder>>(); |
| 395 for (Folder folder in res.getChildren()) { |
| 396 packageMap[folder.shortName] = <Folder>[folder]; |
| 397 } |
| 398 return new PackageMapUriResolver(resourceProvider, packageMap); |
| 399 } |
| 400 //TODO(danrubel) remove this if it will never be called |
| 392 return new PackageUriResolver([new JavaFile(info.packageRoot)]); | 401 return new PackageUriResolver([new JavaFile(info.packageRoot)]); |
| 393 } else { | 402 } else { |
| 394 beginComputePackageMap(); | 403 beginComputePackageMap(); |
| 395 OptimizingPubPackageMapInfo packageMapInfo; | 404 OptimizingPubPackageMapInfo packageMapInfo; |
| 396 ServerPerformanceStatistics.pub.makeCurrentWhile(() { | 405 ServerPerformanceStatistics.pub.makeCurrentWhile(() { |
| 397 packageMapInfo = | 406 packageMapInfo = |
| 398 _packageMapProvider.computePackageMap(folder, info.packageMapInfo); | 407 _packageMapProvider.computePackageMap(folder, info.packageMapInfo); |
| 399 }); | 408 }); |
| 400 endComputePackageMap(); | 409 endComputePackageMap(); |
| 401 info.packageMapInfo = packageMapInfo; | 410 info.packageMapInfo = packageMapInfo; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 return excludes(resource.path); | 789 return excludes(resource.path); |
| 781 } | 790 } |
| 782 | 791 |
| 783 /** | 792 /** |
| 784 * Returns `true` if [path] is the pubspec file of this context. | 793 * Returns `true` if [path] is the pubspec file of this context. |
| 785 */ | 794 */ |
| 786 bool isPubspec(String path) { | 795 bool isPubspec(String path) { |
| 787 return path == pubspecPath; | 796 return path == pubspecPath; |
| 788 } | 797 } |
| 789 } | 798 } |
| OLD | NEW |