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

Side by Side Diff: lib/src/solver/backtracking_solver.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/pubspec.dart ('k') | lib/src/solver/version_solver.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 /// A back-tracking depth-first solver. 5 /// A back-tracking depth-first solver.
6 /// 6 ///
7 /// Attempts to find the best solution for a root package's transitive 7 /// Attempts to find the best solution for a root package's transitive
8 /// dependency graph, where a "solution" is a set of concrete package versions. 8 /// dependency graph, where a "solution" is a set of concrete package versions.
9 /// A valid solution will select concrete versions for every package reached 9 /// A valid solution will select concrete versions for every package reached
10 /// from the root package's dependency graph, and each of those packages will 10 /// from the root package's dependency graph, and each of those packages will
(...skipping 21 matching lines...) Expand all
32 /// new in-progress solution and it tries to proceed from there. It will keep 32 /// new in-progress solution and it tries to proceed from there. It will keep
33 /// doing this, traversing and then backtracking when it meets a failure until 33 /// doing this, traversing and then backtracking when it meets a failure until
34 /// a valid solution has been found or until all possible options for all 34 /// a valid solution has been found or until all possible options for all
35 /// speculative choices have been exhausted. 35 /// speculative choices have been exhausted.
36 import 'dart:async'; 36 import 'dart:async';
37 37
38 import 'package:pub_semver/pub_semver.dart'; 38 import 'package:pub_semver/pub_semver.dart';
39 39
40 import '../barback.dart' as barback; 40 import '../barback.dart' as barback;
41 import '../exceptions.dart'; 41 import '../exceptions.dart';
42 import '../flutter.dart' as flutter;
42 import '../lock_file.dart'; 43 import '../lock_file.dart';
43 import '../log.dart' as log; 44 import '../log.dart' as log;
44 import '../package.dart'; 45 import '../package.dart';
45 import '../pubspec.dart'; 46 import '../pubspec.dart';
46 import '../sdk.dart' as sdk; 47 import '../sdk.dart' as sdk;
47 import '../source/unknown.dart'; 48 import '../source/unknown.dart';
48 import '../system_cache.dart'; 49 import '../system_cache.dart';
49 import '../utils.dart'; 50 import '../utils.dart';
50 import 'version_queue.dart'; 51 import 'version_queue.dart';
51 import 'version_selection.dart'; 52 import 'version_selection.dart';
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // Indent for the previous selections. 641 // Indent for the previous selections.
641 log.solver(prefixLines(message, prefix: '| ' * _versions.length)); 642 log.solver(prefixLines(message, prefix: '| ' * _versions.length));
642 } 643 }
643 644
644 /// Ensures that if [pubspec] has an SDK constraint, then it is compatible 645 /// Ensures that if [pubspec] has an SDK constraint, then it is compatible
645 /// with the current SDK. 646 /// with the current SDK.
646 /// 647 ///
647 /// Throws a [SolveFailure] if not. 648 /// Throws a [SolveFailure] if not.
648 void _validateSdkConstraint(Pubspec pubspec) { 649 void _validateSdkConstraint(Pubspec pubspec) {
649 if (_overrides.containsKey(pubspec.name)) return; 650 if (_overrides.containsKey(pubspec.name)) return;
650 if (pubspec.environment.sdkVersion.allows(sdk.version)) return;
651 651
652 throw new BadSdkVersionException(pubspec.name, 652 if (!pubspec.dartSdkConstraint.allows(sdk.version)) {
653 'Package ${pubspec.name} requires SDK version ' 653 throw new BadSdkVersionException(pubspec.name,
654 '${pubspec.environment.sdkVersion} but the current SDK is ' 654 'Package ${pubspec.name} requires SDK version '
655 '${sdk.version}.'); 655 '${pubspec.dartSdkConstraint} but the current SDK is '
656 '${sdk.version}.');
657 }
658
659 if (pubspec.flutterSdkConstraint != null) {
660 if (!flutter.isAvailable) {
661 throw new BadSdkVersionException(pubspec.name,
662 'Package ${pubspec.name} requires the Flutter SDK, which is not '
663 'available.');
664 }
665
666 if (!pubspec.flutterSdkConstraint.allows(flutter.version)) {
667 throw new BadSdkVersionException(pubspec.name,
668 'Package ${pubspec.name} requires Flutter SDK version '
669 '${pubspec.flutterSdkConstraint} but the current SDK is '
670 '${flutter.version}.');
671 }
672 }
656 } 673 }
657 } 674 }
OLDNEW
« no previous file with comments | « lib/src/pubspec.dart ('k') | lib/src/solver/version_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698