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 a30add0
Show file tree
Hide file tree
Showing 2 changed files with 42 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
41 changes: 41 additions & 0 deletions test/get/overrides_locked_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS d.file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE d.file.

import 'package:test/test.dart';

import '../descriptor.dart' as d;
import '../test_pub.dart';

main() {
// 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");
});

await d.dir('bar',
[d.libDir('bar', 'bar 0.0.1'), d.libPubspec('bar', '0.0.1')]).create();

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

await pubGet();

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

await pubGet();

await d.appPackagesFile({"foo": "1.2.3", "bar": "../bar"}).validate();
});
}

0 comments on commit a30add0

Please sign in to comment.