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

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

Issue 2165423002: Add support for Flutter SDK constraints. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 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
« no previous file with comments | « lib/src/validator/dependency.dart ('k') | test/lock_file_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) 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import '../entrypoint.dart'; 7 import '../entrypoint.dart';
8 import '../validator.dart'; 8 import '../validator.dart';
9 9
10 /// A validator that validates that a package's SDK constraint doesn't use the 10 /// A validator that validates that a package's SDK constraint doesn't use the
11 /// "^" syntax. 11 /// "^" syntax.
12 class SdkConstraintValidator extends Validator { 12 class SdkConstraintValidator extends Validator {
13 SdkConstraintValidator(Entrypoint entrypoint) 13 SdkConstraintValidator(Entrypoint entrypoint)
14 : super(entrypoint); 14 : super(entrypoint);
15 15
16 Future validate() async { 16 Future validate() async {
17 var constraint = entrypoint.root.pubspec.environment.sdkVersion; 17 var constraint = entrypoint.root.pubspec.dartSdkConstraint;
18 if (!constraint.toString().startsWith("^")) return; 18 if (!constraint.toString().startsWith("^")) return;
19 19
20 errors.add( 20 errors.add(
21 "^ version constraints aren't allowed for SDK constraints since " 21 "^ version constraints aren't allowed for SDK constraints since "
22 "older versions of pub don't support them.\n" 22 "older versions of pub don't support them.\n"
23 "Expand it manually instead:\n" 23 "Expand it manually instead:\n"
24 "\n" 24 "\n"
25 "environment:\n" 25 "environment:\n"
26 " sdk: \">=${constraint.min} <${constraint.max}\""); 26 " sdk: \">=${constraint.min} <${constraint.max}\"");
27 } 27 }
28 } 28 }
OLDNEW
« no previous file with comments | « lib/src/validator/dependency.dart ('k') | test/lock_file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698