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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/solver/backtracking_solver.dart

Issue 887223007: Revert "Use native async/await support in pub." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/lib/src/solver/backtracking_solver.dart
diff --git a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart b/sdk/lib/_internal/pub_generated/lib/src/solver/backtracking_solver.dart
similarity index 93%
copy from sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
copy to sdk/lib/_internal/pub_generated/lib/src/solver/backtracking_solver.dart
index a9b84e37184be33f42ba2b6ab18c6a423324693d..a5bac0f8ef66d369a5b2da8cee7d8dad908acbc5 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/solver/backtracking_solver.dart
@@ -109,7 +109,7 @@ class BacktrackingSolver {
var _attemptedSolutions = 1;
BacktrackingSolver(SolveType type, SourceRegistry sources, this.root,
- this.lockFile, List<String> useLatest)
+ this.lockFile, List<String> useLatest)
: type = type,
sources = sources,
cache = new PubspecCache(type, sources) {
@@ -146,22 +146,33 @@ class BacktrackingSolver {
_validateSdkConstraint(root.pubspec);
return _traverseSolution();
}).then((packages) {
- var pubspecs = new Map.fromIterable(packages,
+ var pubspecs = new Map.fromIterable(
+ packages,
key: (id) => id.name,
value: (id) => cache.getCachedPubspec(id));
return Future.wait(
- packages.map((id) => sources[id.source].resolveId(id)))
- .then((packages) {
- return new SolveResult.success(sources, root, lockFile, packages,
- overrides, pubspecs, _getAvailableVersions(packages),
+ packages.map((id) => sources[id.source].resolveId(id))).then((packages) {
+ return new SolveResult.success(
+ sources,
+ root,
+ lockFile,
+ packages,
+ overrides,
+ pubspecs,
+ _getAvailableVersions(packages),
attemptedSolutions);
});
}).catchError((error) {
if (error is! SolveFailure) throw error;
// Wrap a failure in a result so we can attach some other data.
- return new SolveResult.failure(sources, root, lockFile, overrides,
- error, attemptedSolutions);
+ return new SolveResult.failure(
+ sources,
+ root,
+ lockFile,
+ overrides,
+ error,
+ attemptedSolutions);
}).whenComplete(() {
// Gather some solving metrics.
var buffer = new StringBuffer();
@@ -527,7 +538,8 @@ class Traverser {
// Make sure the package doesn't have any bad dependencies.
for (var dep in deps) {
if (!dep.isRoot && _solver.sources[dep.source] is UnknownSource) {
- throw new UnknownSourceException(id.name,
+ throw new UnknownSourceException(
+ id.name,
[new Dependency(id.name, id.version, dep)]);
}
}
@@ -576,11 +588,9 @@ class Traverser {
// See if it's possible for a package to match that constraint.
if (constraint.isEmpty) {
- var constraints = dependencies
- .map((dep) => " ${dep.dep.constraint} from ${dep.depender}")
- .join('\n');
- _solver.logSolve(
- 'disjoint constraints on ${dep.name}:\n$constraints');
+ var constraints = dependencies.map(
+ (dep) => " ${dep.dep.constraint} from ${dep.depender}").join('\n');
+ _solver.logSolve('disjoint constraints on ${dep.name}:\n$constraints');
throw new DisjointConstraintException(dep.name, dependencies);
}
@@ -611,7 +621,10 @@ class Traverser {
if (allowed.isEmpty) {
_solver.logSolve('no versions for ${dep.name} match $constraint');
- throw new NoVersionException(dep.name, null, constraint,
+ throw new NoVersionException(
+ dep.name,
+ null,
+ constraint,
_getDependencies(dep.name));
}
@@ -630,7 +643,9 @@ class Traverser {
if (error is PackageNotFoundException) {
// Show the user why the package was being requested.
throw new DependencyNotFoundException(
- dep.name, error, _getDependencies(dep.name));
+ dep.name,
+ error,
+ _getDependencies(dep.name));
}
throw error;
@@ -651,16 +666,17 @@ class Traverser {
// Make sure all of the existing sources match the new reference.
if (required.dep.source != dep.source) {
- _solver.logSolve('source mismatch on ${dep.name}: ${required.dep.source} '
- '!= ${dep.source}');
+ _solver.logSolve(
+ 'source mismatch on ${dep.name}: ${required.dep.source} ' '!= ${dep.source}');
throw new SourceMismatchException(dep.name, [required, dependency]);
}
// Make sure all of the existing descriptions match the new reference.
var source = _solver.sources[dep.source];
if (!source.descriptionsEqual(dep.description, required.dep.description)) {
- _solver.logSolve('description mismatch on ${dep.name}: '
- '${required.dep.description} != ${dep.description}');
+ _solver.logSolve(
+ 'description mismatch on ${dep.name}: '
+ '${required.dep.description} != ${dep.description}');
throw new DescriptionMismatchException(dep.name, [required, dependency]);
}
}
@@ -678,8 +694,11 @@ class Traverser {
// Make sure it meets the constraint.
if (!dep.constraint.allows(selected.version)) {
_solver.logSolve('selection $selected does not match $constraint');
- throw new NoVersionException(dep.name, selected.version, constraint,
- _getDependencies(dep.name));
+ throw new NoVersionException(
+ dep.name,
+ selected.version,
+ constraint,
+ _getDependencies(dep.name));
}
return selected;
@@ -695,8 +714,8 @@ class Traverser {
return Future.wait(barback.pubConstraints.keys.map((depName) {
var constraint = barback.pubConstraints[depName];
- _solver.logSolve('add implicit $constraint pub dependency on '
- '$depName');
+ _solver.logSolve(
+ 'add implicit $constraint pub dependency on ' '$depName');
var override = _solver._overrides[depName];
@@ -731,16 +750,17 @@ class Traverser {
/// can have a bunch of dependencies back onto the root package as long as
/// they all agree with each other.
Dependency _getRequired(String name) {
- return _getDependencies(name)
- .firstWhere((dep) => !dep.dep.isRoot, orElse: () => null);
+ return _getDependencies(
+ name).firstWhere((dep) => !dep.dep.isRoot, orElse: () => null);
}
/// Gets the combined [VersionConstraint] currently being placed on package
/// [name].
VersionConstraint _getConstraint(String name) {
- var constraint = _getDependencies(name)
- .map((dep) => dep.dep.constraint)
- .fold(VersionConstraint.any, (a, b) => a.intersect(b));
+ var constraint = _getDependencies(
+ name).map(
+ (dep) =>
+ dep.dep.constraint).fold(VersionConstraint.any, (a, b) => a.intersect(b));
return constraint;
}
@@ -768,7 +788,8 @@ class Traverser {
var source = _solver.sources[package.source];
if (!source.descriptionsEqual(
- package.description, required.dep.description)) return null;
+ package.description,
+ required.dep.description)) return null;
}
return package;
@@ -782,8 +803,8 @@ class Traverser {
void _validateSdkConstraint(Pubspec pubspec) {
if (pubspec.environment.sdkVersion.allows(sdk.version)) return;
- throw new BadSdkVersionException(pubspec.name,
+ throw new BadSdkVersionException(
+ pubspec.name,
'Package ${pubspec.name} requires SDK version '
- '${pubspec.environment.sdkVersion} but the current SDK is '
- '${sdk.version}.');
+ '${pubspec.environment.sdkVersion} but the current SDK is ' '${sdk.version}.');
}
« no previous file with comments | « sdk/lib/_internal/pub_generated/lib/src/sdk.dart ('k') | sdk/lib/_internal/pub_generated/lib/src/solver/dependency_queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698