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

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

Issue 1528523003: Clean up the semantics of package descriptions. (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/system_cache.dart ('k') | test/get/git/require_pubspec_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
11 import '../entrypoint.dart'; 11 import '../entrypoint.dart';
12 import '../log.dart' as log; 12 import '../log.dart' as log;
13 import '../package.dart'; 13 import '../package.dart';
14 import '../source/hosted.dart';
14 import '../validator.dart'; 15 import '../validator.dart';
15 16
16 /// The range of all pub versions that don't support `^` version constraints. 17 /// The range of all pub versions that don't support `^` version constraints.
17 /// 18 ///
18 /// This is the actual range of pub versions, whereas [_postCaretPubVersions] is 19 /// This is the actual range of pub versions, whereas [_postCaretPubVersions] is
19 /// the nicer-looking range that doesn't include a prerelease tag. 20 /// the nicer-looking range that doesn't include a prerelease tag.
20 final _preCaretPubVersions = new VersionConstraint.parse("<1.8.0-dev.3.0"); 21 final _preCaretPubVersions = new VersionConstraint.parse("<1.8.0-dev.3.0");
21 22
22 /// The range of all pub versions that do support `^` version constraints. 23 /// The range of all pub versions that do support `^` version constraints.
23 /// 24 ///
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 if (caretDeps.isNotEmpty && !_caretAllowed) { 62 if (caretDeps.isNotEmpty && !_caretAllowed) {
62 _errorAboutCaretConstraints(caretDeps); 63 _errorAboutCaretConstraints(caretDeps);
63 } 64 }
64 } 65 }
65 66
66 /// Warn that dependencies should use the hosted source. 67 /// Warn that dependencies should use the hosted source.
67 Future _warnAboutSource(PackageDep dep) async { 68 Future _warnAboutSource(PackageDep dep) async {
68 var versions; 69 var versions;
69 try { 70 try {
70 var ref = new PackageRef(dep.name, 'hosted', dep.name); 71 var ids = await entrypoint.cache.sources['hosted']
71 var ids = await entrypoint.cache.sources['hosted'].getVersions(ref); 72 .getVersions(HostedSource.refFor(dep.name));
72 versions = ids.map((id) => id.version).toList(); 73 versions = ids.map((id) => id.version).toList();
73 } catch (error) { 74 } catch (error) {
74 versions = []; 75 versions = [];
75 } 76 }
76 77
77 var constraint; 78 var constraint;
78 var primary = Version.primary(versions); 79 var primary = Version.primary(versions);
79 if (primary != null) { 80 if (primary != null) {
80 constraint = _constraintForVersion(primary); 81 constraint = _constraintForVersion(primary);
81 } else { 82 } else {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 errors.add(buffer.toString().trim()); 209 errors.add(buffer.toString().trim());
209 } 210 }
210 211
211 /// Returns the suggested version constraint for a dependency that was tested 212 /// Returns the suggested version constraint for a dependency that was tested
212 /// against [version]. 213 /// against [version].
213 String _constraintForVersion(Version version) { 214 String _constraintForVersion(Version version) {
214 if (_caretAllowed) return "^$version"; 215 if (_caretAllowed) return "^$version";
215 return '">=$version <${version.nextBreaking}"'; 216 return '">=$version <${version.nextBreaking}"';
216 } 217 }
217 } 218 }
OLDNEW
« no previous file with comments | « lib/src/system_cache.dart ('k') | test/get/git/require_pubspec_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698