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

Side by Side Diff: lib/src/command/list_package_dirs.dart

Issue 1228683003: Fix various pub issues. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 pub.command.list_package_dirs; 5 library pub.command.list_package_dirs;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as p;
10 10
11 import '../command.dart'; 11 import '../command.dart';
12 import '../log.dart' as log; 12 import '../log.dart' as log;
13 import '../utils.dart'; 13 import '../utils.dart';
14 14
15 /// Handles the `list-package-dirs` pub command. 15 /// Handles the `list-package-dirs` pub command.
16 class ListPackageDirsCommand extends PubCommand { 16 class ListPackageDirsCommand extends PubCommand {
17 String get name => "list-package-dirs"; 17 String get name => "list-package-dirs";
18 String get description => "Print local paths to dependencies."; 18 String get description => "Print local paths to dependencies.";
19 String get invocation => "pub list-package-dirs"; 19 String get invocation => "pub list-package-dirs";
(...skipping 14 matching lines...) Expand all
34 } 34 }
35 35
36 var output = {}; 36 var output = {};
37 37
38 // Include the local paths to all locked packages. 38 // Include the local paths to all locked packages.
39 var packages = {}; 39 var packages = {};
40 var futures = []; 40 var futures = [];
41 entrypoint.lockFile.packages.forEach((name, package) { 41 entrypoint.lockFile.packages.forEach((name, package) {
42 var source = entrypoint.cache.sources[package.source]; 42 var source = entrypoint.cache.sources[package.source];
43 futures.add(source.getDirectory(package).then((packageDir) { 43 futures.add(source.getDirectory(package).then((packageDir) {
44 packages[name] = path.join(packageDir, "lib"); 44 // Normalize paths and make them absolute for backwards compatibility
45 // with the protocol used by the analyzer.
46 packages[name] = p.normalize(p.absolute(p.join(packageDir, "lib")));
45 })); 47 }));
46 }); 48 });
47 49
48 output["packages"] = packages; 50 output["packages"] = packages;
49 51
50 // Include the self link. 52 // Include the self link.
51 packages[entrypoint.root.name] = entrypoint.root.path("lib"); 53 packages[entrypoint.root.name] =
54 p.normalize(p.absolute(entrypoint.root.path("lib")));
52 55
53 // Include the file(s) which when modified will affect the results. For pub, 56 // Include the file(s) which when modified will affect the results. For pub,
54 // that's just the pubspec and lockfile. 57 // that's just the pubspec and lockfile.
55 output["input_files"] = [ 58 output["input_files"] = [
56 entrypoint.lockFilePath, 59 p.normalize(p.absolute(entrypoint.lockFilePath)),
57 entrypoint.pubspecPath 60 p.normalize(p.absolute(entrypoint.pubspecPath))
58 ]; 61 ];
59 62
60 return Future.wait(futures).then((_) { 63 return Future.wait(futures).then((_) {
61 log.json.message(output); 64 log.json.message(output);
62 }); 65 });
63 } 66 }
64 } 67 }
65 68
OLDNEW
« no previous file with comments | « lib/src/barback/dart2js_transformer.dart ('k') | lib/src/dart.dart » ('j') | lib/src/dart.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698