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

Side by Side Diff: lib/src/validator/dependency.dart

Issue 1459733002: Move pubspec caching into each source. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 5 years 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/source/hosted.dart ('k') | test/version_solver_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.validator.dependency; 5 library pub.validator.dependency;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:pub_semver/pub_semver.dart'; 9 import 'package:pub_semver/pub_semver.dart';
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 if (caretDeps.isNotEmpty && !_caretAllowed) { 61 if (caretDeps.isNotEmpty && !_caretAllowed) {
62 _errorAboutCaretConstraints(caretDeps); 62 _errorAboutCaretConstraints(caretDeps);
63 } 63 }
64 } 64 }
65 65
66 /// Warn that dependencies should use the hosted source. 66 /// Warn that dependencies should use the hosted source.
67 Future _warnAboutSource(PackageDep dep) async { 67 Future _warnAboutSource(PackageDep dep) async {
68 var versions; 68 var versions;
69 try { 69 try {
70 var pubspecs = await entrypoint.cache.sources['hosted'] 70 var ref = new PackageRef(dep.name, 'hosted', dep.name);
71 .getVersions(dep.name, dep.name); 71 var ids = await entrypoint.cache.sources['hosted'].getVersions(ref);
72 versions = pubspecs.map((pubspec) => pubspec.version).toList(); 72 versions = ids.map((id) => id.version).toList();
73 } catch (error) { 73 } catch (error) {
74 versions = []; 74 versions = [];
75 } 75 }
76 76
77 var constraint; 77 var constraint;
78 var primary = Version.primary(versions); 78 var primary = Version.primary(versions);
79 if (primary != null) { 79 if (primary != null) {
80 constraint = _constraintForVersion(primary); 80 constraint = _constraintForVersion(primary);
81 } else { 81 } else {
82 constraint = dep.constraint.toString(); 82 constraint = dep.constraint.toString();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 errors.add(buffer.toString().trim()); 208 errors.add(buffer.toString().trim());
209 } 209 }
210 210
211 /// Returns the suggested version constraint for a dependency that was tested 211 /// Returns the suggested version constraint for a dependency that was tested
212 /// against [version]. 212 /// against [version].
213 String _constraintForVersion(Version version) { 213 String _constraintForVersion(Version version) {
214 if (_caretAllowed) return "^$version"; 214 if (_caretAllowed) return "^$version";
215 return '">=$version <${version.nextBreaking}"'; 215 return '">=$version <${version.nextBreaking}"';
216 } 216 }
217 } 217 }
OLDNEW
« no previous file with comments | « lib/src/source/hosted.dart ('k') | test/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698