| Index: pkg/analyzer/lib/source/pub_package_map_provider.dart
|
| diff --git a/pkg/analyzer/lib/source/pub_package_map_provider.dart b/pkg/analyzer/lib/source/pub_package_map_provider.dart
|
| index 07fdba7264defe96391118995ccf5c915e8ce6b4..5daf61d6ed8e58634bdd44cf1880d691f7c47ef6 100644
|
| --- a/pkg/analyzer/lib/source/pub_package_map_provider.dart
|
| +++ b/pkg/analyzer/lib/source/pub_package_map_provider.dart
|
| @@ -59,6 +59,13 @@ class PubPackageMapProvider implements PackageMapProvider {
|
|
|
| @override
|
| PackageMapInfo computePackageMap(Folder folder) {
|
| + // If the pubspec.lock file does not exist, no need to run anything.
|
| + {
|
| + String lockPath = getPubspecLockPath(folder);
|
| + if (!resourceProvider.getFile(lockPath).exists) {
|
| + return computePackageMapError(folder);
|
| + }
|
| + }
|
| // TODO(paulberry) make this asynchronous so that we can (a) do other
|
| // analysis while it's in progress, and (b) time out if it takes too long
|
| // to respond.
|
| @@ -96,13 +103,18 @@ class PubPackageMapProvider implements PackageMapProvider {
|
| // we'll know when to try running "pub list-package-dirs" again.
|
| // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when
|
| // an error occurs, so just assume there is one dependency, "pubspec.lock".
|
| - List<String> dependencies = <String>[
|
| - resourceProvider.pathContext.join(folder.path, PUBSPEC_LOCK_NAME)
|
| - ];
|
| + String lockPath = getPubspecLockPath(folder);
|
| + List<String> dependencies = <String>[lockPath];
|
| return new PackageMapInfo(null, dependencies.toSet());
|
| }
|
|
|
| /**
|
| + * Return the path to the `pubspec.lock` file in the given [folder].
|
| + */
|
| + String getPubspecLockPath(Folder folder) =>
|
| + resourceProvider.pathContext.join(folder.path, PUBSPEC_LOCK_NAME);
|
| +
|
| + /**
|
| * Decode the JSON output from pub into a package map. Paths in the
|
| * output are considered relative to [folder].
|
| */
|
|
|