Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2076)

Unified Diff: lib/src/command/list_package_dirs.dart

Issue 1276673006: Make Source.getDirectory synchronous. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/command/cache_add.dart ('k') | lib/src/entrypoint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/command/list_package_dirs.dart
diff --git a/lib/src/command/list_package_dirs.dart b/lib/src/command/list_package_dirs.dart
index fe3627258846ab8e2ba1f6b2adc40edf4a9cff43..34d695273701d45ac1338937ec0d0b844c2216aa 100644
--- a/lib/src/command/list_package_dirs.dart
+++ b/lib/src/command/list_package_dirs.dart
@@ -4,8 +4,6 @@
library pub.command.list_package_dirs;
-import 'dart:async';
-
import 'package:path/path.dart' as p;
import '../command.dart';
@@ -26,7 +24,7 @@ class ListPackageDirsCommand extends PubCommand {
allowed: ["json"]);
}
- Future run() {
+ void run() {
log.json.enabled = true;
if (!entrypoint.lockFileExists) {
@@ -36,23 +34,20 @@ class ListPackageDirsCommand extends PubCommand {
var output = {};
// Include the local paths to all locked packages.
- var packages = {};
- var futures = [];
- entrypoint.lockFile.packages.forEach((name, package) {
+ var packages = mapMap(entrypoint.lockFile.packages, value: (name, package) {
var source = entrypoint.cache.sources[package.source];
- futures.add(source.getDirectory(package).then((packageDir) {
- // Normalize paths and make them absolute for backwards compatibility
- // with the protocol used by the analyzer.
- packages[name] = p.normalize(p.absolute(p.join(packageDir, "lib")));
- }));
+ var packageDir = source.getDirectory(package);
+ // Normalize paths and make them absolute for backwards compatibility
+ // with the protocol used by the analyzer.
+ return p.normalize(p.absolute(p.join(packageDir, "lib")));
});
- output["packages"] = packages;
-
// Include the self link.
packages[entrypoint.root.name] =
p.normalize(p.absolute(entrypoint.root.path("lib")));
+ output["packages"] = packages;
+
// Include the file(s) which when modified will affect the results. For pub,
// that's just the pubspec and lockfile.
output["input_files"] = [
@@ -60,9 +55,7 @@ class ListPackageDirsCommand extends PubCommand {
p.normalize(p.absolute(entrypoint.pubspecPath))
];
- return Future.wait(futures).then((_) {
- log.json.message(output);
- });
+ log.json.message(output);
}
}
« no previous file with comments | « lib/src/command/cache_add.dart ('k') | lib/src/entrypoint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698