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

Side by Side Diff: lib/src/solver/version_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/solver/backtracking_solver.dart ('k') | lib/src/validator/dependency.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 import 'dart:async'; 5 import 'dart:async';
6 import "dart:convert"; 6 import "dart:convert";
7 7
8 import 'package:pub_semver/pub_semver.dart'; 8 import 'package:pub_semver/pub_semver.dart';
9 import 'package:stack_trace/stack_trace.dart'; 9 import 'package:stack_trace/stack_trace.dart';
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 /// 72 ///
73 /// In other words, one more than the number of times it had to backtrack 73 /// In other words, one more than the number of times it had to backtrack
74 /// because it found an invalid solution. 74 /// because it found an invalid solution.
75 final int attemptedSolutions; 75 final int attemptedSolutions;
76 76
77 /// The [LockFile] representing the packages selected by this version 77 /// The [LockFile] representing the packages selected by this version
78 /// resolution. 78 /// resolution.
79 LockFile get lockFile { 79 LockFile get lockFile {
80 // Don't factor in overridden dependencies' SDK constraints, because we'll 80 // Don't factor in overridden dependencies' SDK constraints, because we'll
81 // accept those packages even if their constraints don't match. 81 // accept those packages even if their constraints don't match.
82 var sdkConstraint = new VersionConstraint.intersection(pubspecs.values 82 var nonOverrides = pubspecs.values
83 .where((pubspec) => 83 .where((pubspec) =>
84 !_root.dependencyOverrides.any((dep) => dep.name == pubspec.name)) 84 !_root.dependencyOverrides.any((dep) => dep.name == pubspec.name))
85 .map((pubspec) => pubspec.environment.sdkVersion)); 85 .toList();
86 return new LockFile(packages, sdkConstraint: sdkConstraint); 86
87 var dartMerged = new VersionConstraint.intersection(nonOverrides
88 .map((pubspec) => pubspec.dartSdkConstraint));
89
90 var flutterConstraints = nonOverrides
91 .map((pubspec) => pubspec.flutterSdkConstraint)
92 .where((constraint) => constraint != null)
93 .toList();
94 var flutterMerged = flutterConstraints.isEmpty
95 ? null
96 : new VersionConstraint.intersection(flutterConstraints);
97
98 return new LockFile(packages,
99 dartSdkConstraint: dartMerged,
100 flutterSdkConstraint: flutterMerged);
87 } 101 }
88 102
89 final SourceRegistry _sources; 103 final SourceRegistry _sources;
90 final Package _root; 104 final Package _root;
91 final LockFile _previousLockFile; 105 final LockFile _previousLockFile;
92 106
93 /// Returns the names of all packages that were changed. 107 /// Returns the names of all packages that were changed.
94 /// 108 ///
95 /// This includes packages that were added or removed. 109 /// This includes packages that were added or removed.
96 Set<String> get changedPackages { 110 Set<String> get changedPackages {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 450
437 DependencyNotFoundException(String package, this._innerException, 451 DependencyNotFoundException(String package, this._innerException,
438 Iterable<Dependency> dependencies) 452 Iterable<Dependency> dependencies)
439 : super(package, dependencies); 453 : super(package, dependencies);
440 454
441 /// The failure isn't because of the version of description of the package, 455 /// The failure isn't because of the version of description of the package,
442 /// it's the package itself that can't be found, so just show the name and no 456 /// it's the package itself that can't be found, so just show the name and no
443 /// descriptive details. 457 /// descriptive details.
444 String _describeDependency(PackageDep dep) => ""; 458 String _describeDependency(PackageDep dep) => "";
445 } 459 }
OLDNEW
« no previous file with comments | « lib/src/solver/backtracking_solver.dart ('k') | lib/src/validator/dependency.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698