Skip to content

Commit

Permalink
Remove duplicated precomputed value key from VendorFileFunction.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 641013801
Change-Id: Ia74b7b79a870d74b9055f32e4a4a77418fd3f555
  • Loading branch information
meteorcloudy authored and copybara-github committed Jun 6, 2024
1 parent 71fdd60 commit 84e0304
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@ public ImmutableList<Injected> 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -54,9 +53,6 @@
*/
public class VendorFileFunction implements SkyFunction {

public static final Precomputed<Optional<Path>> VENDOR_DIRECTORY =
new Precomputed<>("vendor_directory");

private static final String VENDOR_FILE_HEADER =
"""
###############################################################################
Expand All @@ -83,15 +79,15 @@ 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"
+ " flag)"),
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);

Expand Down

0 comments on commit 84e0304

Please sign in to comment.