aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2015-05-06 13:41:02 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-05-07 14:03:43 +0000
commit5a449cbb4aafbf3d75ce22966f8be9e761f8ab6d (patch)
tree875d8394195ef5a7ef39792f391e29958427a332 /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
parent2181bc445fa2d43caf192f4bf0d3513095e34dca (diff)
Track BUILD file changes on new_ repositories
I noticed, while writing http://bazel.io/docs/cpp.html#including-external-libraries-an-example, that the BUILD file didn't get reparsed when it changed. This fixes that. -- MOS_MIGRATED_REVID=92921670
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.java19
1 files changed, 17 insertions, 2 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 15025b8f3d..3866da7c03 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
@@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.cmdline.LabelValidator;
import com.google.devtools.build.lib.packages.BuildFileContainsErrorsException;
@@ -155,8 +156,22 @@ class PackageLookupFunction implements SkyFunction {
throw new PackageLookupFunctionException(new BuildFileContainsErrorsException(
PackageFunction.EXTERNAL_PACKAGE_NAME, e.getMessage()), Transience.PERSISTENT);
}
-
- return getPackageLookupValue(env, repositoryValue.getPath(), id.getPackageFragment());
+ PathFragment buildFileFragment = id.getPackageFragment().getChild("BUILD");
+ RootedPath buildFileRootedPath = RootedPath.toRootedPath(repositoryValue.getPath(),
+ buildFileFragment);
+ FileValue fileValue = getFileValue(buildFileRootedPath, env);
+ if (fileValue == null) {
+ return null;
+ }
+ Optional<FileValue> overlaidBuildFile = repositoryValue.getOverlaidBuildFile();
+ if (fileValue.isFile()) {
+ if (overlaidBuildFile.isPresent()) {
+ return PackageLookupValue.overlaidBuildFile(repositoryValue.getPath(), overlaidBuildFile);
+ } else {
+ return PackageLookupValue.success(repositoryValue.getPath());
+ }
+ }
+ return PackageLookupValue.noBuildFile();
}
/**