aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2017-09-06 21:57:46 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-09-07 09:57:44 +0200
commit45932965c08e1080f1d53cf09352bec0a24cb40f (patch)
tree56dd71a0ab334ce81c2320f3247a30bc50ba07cd /src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
parent5da5572254555704f88fd2e0061237fd35a50f9c (diff)
Update ContainingPackageLookupFunction to properly handle cases where a
path crosses into a local repository and correctly report the repository-relative package. Fixes #3553. Change-Id: Ib912e69d546fb740ef8fe4c426dba30fa7776bda PiperOrigin-RevId: 167760229
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
index 68c9ff8353..f3ca9881c6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunction.java
@@ -14,6 +14,7 @@
package com.google.devtools.build.lib.skyframe;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.skyframe.PackageLookupValue.IncorrectRepositoryReferencePackageLookupValue;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
@@ -38,6 +39,16 @@ public class ContainingPackageLookupFunction implements SkyFunction {
return ContainingPackageLookupValue.withContainingPackage(dir, pkgLookupValue.getRoot());
}
+ // Does the requested package cross into a sub-repository, which we should report via the
+ // correct package identifier?
+ if (pkgLookupValue instanceof IncorrectRepositoryReferencePackageLookupValue) {
+ IncorrectRepositoryReferencePackageLookupValue incorrectPackageLookupValue =
+ (IncorrectRepositoryReferencePackageLookupValue) pkgLookupValue;
+ PackageIdentifier correctPackageIdentifier =
+ incorrectPackageLookupValue.getCorrectedPackageIdentifier();
+ return env.getValue(ContainingPackageLookupValue.key(correctPackageIdentifier));
+ }
+
PathFragment parentDir = dir.getPackageFragment().getParentDirectory();
if (parentDir == null) {
return ContainingPackageLookupValue.NONE;