Fix an edge case in dependency freshness checking.
If a path dependency had a dependency back on the root package, it
would be detected as always stale because the root package isn't in the
lockfile. This changes the check to always consider that fresh, since
all dependencies on the root package are satisfied.
Closes #1416
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//1985063004 .
diff --git a/lib/src/entrypoint.dart b/lib/src/entrypoint.dart
index e0c6774..0152926 100644
--- a/lib/src/entrypoint.dart
+++ b/lib/src/entrypoint.dart
@@ -536,6 +536,8 @@
/// Returns whether the locked version of [dep] matches the dependency.
bool _isDependencyUpToDate(PackageDep dep) {
+ if (dep.name == root.name) return true;
+
var locked = lockFile.packages[dep.name];
if (locked == null) return false;
diff --git a/test/must_pub_get_test.dart b/test/must_pub_get_test.dart
index 3ef5035..e1f71eb 100644
--- a/test/must_pub_get_test.dart
+++ b/test/must_pub_get_test.dart
@@ -339,6 +339,25 @@
_runsSuccessfully();
});
+ // Regression test for #1416
+ group("a path dependency has a dependency on the root package", () {
+ setUp(() {
+ d.dir("foo", [
+ d.libPubspec("foo", "1.0.0", deps: {"myapp": "any"})
+ ]).create();
+
+ d.dir(appPath, [
+ d.appPubspec({"foo": {"path": "../foo"}})
+ ]).create();
+
+ pubGet();
+
+ _touch("pubspec.lock");
+ });
+
+ _runsSuccessfully();
+ });
+
group("the lockfile is newer than .packages, but they're up-to-date", () {
setUp(() {
d.dir(appPath, [