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

Side by Side Diff: pkg/analyzer/lib/source/pub_package_map_provider.dart

Issue 952333002: Don't do folder existence checks when parsing pub list results. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 source.pub_package_map_provider; 5 library source.pub_package_map_provider;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // "path/to/myapp/pubspec.lock" 88 // "path/to/myapp/pubspec.lock"
89 // ] 89 // ]
90 // } 90 // }
91 Map<String, List<Folder>> packageMap = new HashMap<String, List<Folder>>(); 91 Map<String, List<Folder>> packageMap = new HashMap<String, List<Folder>>();
92 Map obj = JSON.decode(jsonText); 92 Map obj = JSON.decode(jsonText);
93 Map packages = obj['packages']; 93 Map packages = obj['packages'];
94 processPaths(String packageName, List paths) { 94 processPaths(String packageName, List paths) {
95 List<Folder> folders = <Folder>[]; 95 List<Folder> folders = <Folder>[];
96 for (var path in paths) { 96 for (var path in paths) {
97 if (path is String) { 97 if (path is String) {
98 Resource resource = folder.getChild(path); 98 Resource resource = folder.getChildAssumingFolder(path);
99 if (resource is Folder) { 99 if (resource is Folder) {
100 folders.add(resource); 100 folders.add(resource);
101 } 101 }
102 } 102 }
103 } 103 }
104 if (folders.isNotEmpty) { 104 if (folders.isNotEmpty) {
105 packageMap[packageName] = folders; 105 packageMap[packageName] = folders;
106 } 106 }
107 } 107 }
108 packages.forEach((key, value) { 108 packages.forEach((key, value) {
(...skipping 20 matching lines...) Expand all
129 */ 129 */
130 PackageMapInfo _error(Folder folder) { 130 PackageMapInfo _error(Folder folder) {
131 // Even if an error occurs, we still need to know the dependencies, so that 131 // Even if an error occurs, we still need to know the dependencies, so that
132 // we'll know when to try running "pub list-package-dirs" again. 132 // we'll know when to try running "pub list-package-dirs" again.
133 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when 133 // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when
134 // an error occurs, so just assume there is one dependency, "pubspec.lock". 134 // an error occurs, so just assume there is one dependency, "pubspec.lock".
135 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)]; 135 List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)];
136 return new PackageMapInfo(null, dependencies.toSet()); 136 return new PackageMapInfo(null, dependencies.toSet());
137 } 137 }
138 } 138 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/physical_file_system.dart ('k') | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698