Index: sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart b/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart |
index ea5b14080c83af452d4f2ca97e7ac8c6ddd727f4..fc05630b2db2b04a808f0bc7e78ebd335022c92a 100644 |
--- a/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart |
+++ b/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart |
@@ -8,6 +8,8 @@ import 'dart:async'; |
import 'dart:io'; |
import 'dart:json' as json; |
+import 'package:path/path.dart' as path; |
+ |
import '../command.dart'; |
import '../exit_codes.dart' as exit_codes; |
import '../log.dart' as log; |
@@ -32,14 +34,26 @@ class ListPackageDirsCommand extends PubCommand { |
} |
var output = {}; |
+ |
+ // Include the local paths to all locked packages. |
+ var packages = {}; |
var futures = []; |
entrypoint.loadLockFile().packages.forEach((name, package) { |
var source = entrypoint.cache.sources[package.source]; |
futures.add(source.getDirectory(package).then((packageDir) { |
- output[name] = packageDir; |
+ packages[name] = path.join(packageDir, "lib"); |
})); |
}); |
+ output["packages"] = packages; |
+ |
+ // Include the self link. |
+ packages[entrypoint.root.name] = path.join(entrypoint.root.dir, "lib"); |
+ |
+ // Include the file(s) which when modified will affect the results. For pub, |
+ // that's just the lockfile. |
+ output["input_files"] = [entrypoint.lockFilePath]; |
+ |
return Future.wait(futures).then((_) { |
log.message(json.stringify(output)); |
}); |