Skip to content

Commit

Permalink
Override dependencies of locked packages
Browse files Browse the repository at this point in the history
Partially addresses #1853
  • Loading branch information
nex3 committed Mar 30, 2018
1 parent bc2b5ff commit 26f9aea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/solver/package_lister.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class PackageLister {
return incompatibilities;
} else {
return pubspec.dependencies.values
.where((range) => !_overriddenPackages.contains(range.name))
.map((range) => _dependency(depender, range))
.toList();
}
Expand Down
25 changes: 25 additions & 0 deletions test/version_solver_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,31 @@ void override() {

await expectResolves(result: {'foo': '0.0.0'});
});

// Regression test for #1853
test("overrides a locked package's dependency", () async {
await servePackages((builder) {
builder.serve("foo", "1.2.3", deps: {"bar": "1.2.3"});
builder.serve("bar", "1.2.3");
builder.serve("bar", "0.0.1");
});

await d.appDir({"foo": "any"}).create();

await expectResolves(result: {'foo': '1.2.3', 'bar': '1.2.3'});

await d.dir(appPath, [
d.pubspec({
"name": "myapp",
"dependencies": {"foo": "any"},
"dependency_overrides": {
"bar": '0.0.1'
}
})
]).create();

await expectResolves(result: {'foo': '1.2.3', 'bar': '0.0.1'});
});
}

void downgrade() {
Expand Down

0 comments on commit 26f9aea

Please sign in to comment.