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

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

Issue 2044253003: Refactor Source and SourceRegistry. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Rename LiveSource to BoundSource. Created 4 years, 6 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
« no previous file with comments | « lib/src/command/lish.dart ('k') | lib/src/command/uploader.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'package:path/path.dart' as p; 5 import 'package:path/path.dart' as p;
6 6
7 import '../command.dart'; 7 import '../command.dart';
8 import '../io.dart'; 8 import '../io.dart';
9 import '../log.dart' as log; 9 import '../log.dart' as log;
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 16 matching lines...) Expand all
27 log.json.enabled = true; 27 log.json.enabled = true;
28 28
29 if (!fileExists(entrypoint.lockFilePath)) { 29 if (!fileExists(entrypoint.lockFilePath)) {
30 dataError('Package "myapp" has no lockfile. Please run "pub get" first.'); 30 dataError('Package "myapp" has no lockfile. Please run "pub get" first.');
31 } 31 }
32 32
33 var output = {}; 33 var output = {};
34 34
35 // Include the local paths to all locked packages. 35 // Include the local paths to all locked packages.
36 var packages = mapMap(entrypoint.lockFile.packages, value: (name, package) { 36 var packages = mapMap(entrypoint.lockFile.packages, value: (name, package) {
37 var source = entrypoint.cache.sources[package.source]; 37 var source = entrypoint.cache.source(package.source);
38 var packageDir = source.getDirectory(package); 38 var packageDir = source.getDirectory(package);
39 // Normalize paths and make them absolute for backwards compatibility 39 // Normalize paths and make them absolute for backwards compatibility
40 // with the protocol used by the analyzer. 40 // with the protocol used by the analyzer.
41 return p.normalize(p.absolute(p.join(packageDir, "lib"))); 41 return p.normalize(p.absolute(p.join(packageDir, "lib")));
42 }); 42 });
43 43
44 // Include the self link. 44 // Include the self link.
45 packages[entrypoint.root.name] = 45 packages[entrypoint.root.name] =
46 p.normalize(p.absolute(entrypoint.root.path("lib"))); 46 p.normalize(p.absolute(entrypoint.root.path("lib")));
47 47
48 output["packages"] = packages; 48 output["packages"] = packages;
49 49
50 // Include the file(s) which when modified will affect the results. For pub, 50 // Include the file(s) which when modified will affect the results. For pub,
51 // that's just the pubspec and lockfile. 51 // that's just the pubspec and lockfile.
52 output["input_files"] = [ 52 output["input_files"] = [
53 p.normalize(p.absolute(entrypoint.lockFilePath)), 53 p.normalize(p.absolute(entrypoint.lockFilePath)),
54 p.normalize(p.absolute(entrypoint.pubspecPath)) 54 p.normalize(p.absolute(entrypoint.pubspecPath))
55 ]; 55 ];
56 56
57 log.json.message(output); 57 log.json.message(output);
58 } 58 }
59 } 59 }
60 60
OLDNEW
« no previous file with comments | « lib/src/command/lish.dart ('k') | lib/src/command/uploader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698