From 84e0304b2eee9ffb800c524e46d6781f2b691d8c Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 6 Jun 2024 14:03:42 -0700 Subject: [PATCH] Remove duplicated precomputed value key from VendorFileFunction. PiperOrigin-RevId: 641013801 Change-Id: Ia74b7b79a870d74b9055f32e4a4a77418fd3f555 --- .../build/lib/bazel/BazelRepositoryModule.java | 1 - .../build/lib/bazel/bzlmod/VendorFileFunction.java | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java b/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java index 81bbf1c016ce30..149b532f202821 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java @@ -606,7 +606,6 @@ public ImmutableList getPrecomputedValues() { PrecomputedValue.injected(BazelLockFileFunction.LOCKFILE_MODE, bazelLockfileMode), PrecomputedValue.injected(RepositoryDelegatorFunction.IS_VENDOR_COMMAND, false), PrecomputedValue.injected(RepositoryDelegatorFunction.VENDOR_DIRECTORY, vendorDirectory), - PrecomputedValue.injected(VendorFileFunction.VENDOR_DIRECTORY, vendorDirectory), PrecomputedValue.injected( YankedVersionsUtil.ALLOWED_YANKED_VERSIONS, allowedYankedVersions), PrecomputedValue.injected( diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorFileFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorFileFunction.java index 7a75d31177f5ed..50f1102ed801bb 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorFileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorFileFunction.java @@ -23,8 +23,8 @@ import com.google.devtools.build.lib.packages.BazelStarlarkEnvironment; import com.google.devtools.build.lib.packages.DotBazelFileSyntaxChecker; import com.google.devtools.build.lib.packages.VendorThreadContext; +import com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction; import com.google.devtools.build.lib.skyframe.PrecomputedValue; -import com.google.devtools.build.lib.skyframe.PrecomputedValue.Precomputed; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.Root; @@ -35,7 +35,6 @@ import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.SkyValue; import java.io.IOException; -import java.util.Optional; import javax.annotation.Nullable; import net.starlark.java.eval.EvalException; import net.starlark.java.eval.Mutability; @@ -54,9 +53,6 @@ */ public class VendorFileFunction implements SkyFunction { - public static final Precomputed> VENDOR_DIRECTORY = - new Precomputed<>("vendor_directory"); - private static final String VENDOR_FILE_HEADER = """ ############################################################################### @@ -83,7 +79,7 @@ public VendorFileFunction(BazelStarlarkEnvironment starlarkEnv) { @Override public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException, InterruptedException { - if (VENDOR_DIRECTORY.get(env).isEmpty()) { + if (RepositoryDelegatorFunction.VENDOR_DIRECTORY.get(env).isEmpty()) { throw new VendorFileFunctionException( new IllegalStateException( "VENDOR.bazel file is not accessible with vendor mode off (without --vendor_dir" @@ -91,7 +87,7 @@ public SkyValue compute(SkyKey skyKey, Environment env) Transience.PERSISTENT); } - Path vendorPath = VENDOR_DIRECTORY.get(env).get(); + Path vendorPath = RepositoryDelegatorFunction.VENDOR_DIRECTORY.get(env).get(); RootedPath vendorFilePath = RootedPath.toRootedPath(Root.fromPath(vendorPath), LabelConstants.VENDOR_FILE_NAME);