aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2016-12-12 17:01:03 +0000
committerGravatar John Cater <jcater@google.com>2016-12-12 20:35:32 +0000
commitfcc0801601f238858bc335eb3f25f66a4eee1909 (patch)
tree0b1c481f076b23d73ec41d9b0dc4340791168498 /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
parent022748861e12268441f8519ed63a4a31e79b5e4a (diff)
Fixed PackageLookupFunction to check for all possible build file names when loading external repositories.
Fixes #2198. -- Change-Id: Ife0232f8e4652a90bc3b7dceec6e67312a142879 Reviewed-on: https://cr.bazel.build/7691 PiperOrigin-RevId: 141771126 MOS_MIGRATED_REVID=141771126
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
index f96ca84d57..2723c6aa21 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
@@ -291,7 +291,7 @@ public class PackageLookupFunction implements SkyFunction {
* <p>To do this, it looks up the "external" package and finds a path mapping for the repository
* name.
*/
- private static PackageLookupValue computeExternalPackageLookupValue(
+ private PackageLookupValue computeExternalPackageLookupValue(
SkyKey skyKey, Environment env, PackageIdentifier packageIdentifier)
throws PackageLookupFunctionException, InterruptedException {
PackageIdentifier id = (PackageIdentifier) skyKey.argument();
@@ -307,17 +307,21 @@ public class PackageLookupFunction implements SkyFunction {
throw new PackageLookupFunctionException(new BuildFileNotFoundException(id, e.getMessage()),
Transience.PERSISTENT);
}
- BuildFileName buildFileName = BuildFileName.BUILD;
- PathFragment buildFileFragment = id.getPackageFragment().getChild(buildFileName.getFilename());
- RootedPath buildFileRootedPath = RootedPath.toRootedPath(repositoryValue.getPath(),
- buildFileFragment);
- FileValue fileValue = getFileValue(buildFileRootedPath, env, packageIdentifier);
- if (fileValue == null) {
- return null;
- }
- if (fileValue.isFile()) {
- return PackageLookupValue.success(repositoryValue.getPath(), buildFileName);
+ // This checks for the build file names in the correct precedence order.
+ for (BuildFileName buildFileName : buildFilesByPriority) {
+ PathFragment buildFileFragment =
+ id.getPackageFragment().getChild(buildFileName.getFilename());
+ RootedPath buildFileRootedPath =
+ RootedPath.toRootedPath(repositoryValue.getPath(), buildFileFragment);
+ FileValue fileValue = getFileValue(buildFileRootedPath, env, packageIdentifier);
+ if (fileValue == null) {
+ return null;
+ }
+
+ if (fileValue.isFile()) {
+ return PackageLookupValue.success(repositoryValue.getPath(), buildFileName);
+ }
}
return PackageLookupValue.NO_BUILD_FILE_VALUE;