aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2017-11-28 20:47:41 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-28 20:49:17 -0800
commite0d1d0ef7e1d53f232a457ac66496a5d8d9b82e3 (patch)
treed3637b0bf3f2020638665335841bf0ba752c7a1e /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
parent55a4b9ae3f4ac5c453e7d944c5113f7fe9baf24b (diff)
Update PathPackageLocator to take a list of potential build file names,
instead of assuming BUILD. - Default the list to the same value as PackageLookupFunction: BUILD.bazel, BUILD. - Move BuildFileNames to the packages package, so it is more generally available. Part of #4056. Change-Id: Ie12512b492cd7d47a9e56ec3bc209f829feaf4b5 PiperOrigin-RevId: 177261295
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java50
1 files changed, 1 insertions, 49 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
index c82ea7688e..50bccd5343 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.skyframe;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.packages.BuildFileName;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
@@ -36,55 +37,6 @@ import com.google.devtools.build.skyframe.SkyValue;
*/
public abstract class PackageLookupValue implements SkyValue {
- /**
- * The file (BUILD, WORKSPACE, etc.) that defines this package, referred to as the "build file".
- */
- public enum BuildFileName {
-
- WORKSPACE("WORKSPACE") {
- @Override
- public PathFragment getBuildFileFragment(PackageIdentifier packageIdentifier) {
- return getFilenameFragment();
- }
- },
- BUILD("BUILD") {
- @Override
- public PathFragment getBuildFileFragment(PackageIdentifier packageIdentifier) {
- return packageIdentifier.getPackageFragment().getRelative(getFilenameFragment());
- }
- },
- BUILD_DOT_BAZEL("BUILD.bazel") {
- @Override
- public PathFragment getBuildFileFragment(PackageIdentifier packageIdentifier) {
- return packageIdentifier.getPackageFragment().getRelative(getFilenameFragment());
- }
- };
-
- private static final BuildFileName[] VALUES = BuildFileName.values();
-
- private final PathFragment filenameFragment;
-
- private BuildFileName(String filename) {
- this.filenameFragment = PathFragment.create(filename);
- }
-
- public PathFragment getFilenameFragment() {
- return filenameFragment;
- }
-
- /**
- * Returns a {@link PathFragment} to the build file that defines the package.
- *
- * @param packageIdentifier the identifier for this package, which the caller should already
- * know (since it was in the {@link SkyKey} used to get the {@link PackageLookupValue}.
- */
- public abstract PathFragment getBuildFileFragment(PackageIdentifier packageIdentifier);
-
- public static BuildFileName lookupByOrdinal(int ordinal) {
- return VALUES[ordinal];
- }
- }
-
public static final NoBuildFilePackageLookupValue NO_BUILD_FILE_VALUE =
new NoBuildFilePackageLookupValue();
public static final DeletedPackageLookupValue DELETED_PACKAGE_VALUE =