Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.4.0] Remove PackageGroupConfiguredTarget.isAvailableFor function #19444

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@

package com.google.devtools.build.lib.analysis.configuredtargets;

import static net.starlark.java.eval.Module.ofInnermostEnclosingStarlarkFunction;

import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.Allowlist;
import com.google.devtools.build.lib.analysis.FileProvider;
import com.google.devtools.build.lib.analysis.PackageSpecificationProvider;
import com.google.devtools.build.lib.analysis.TargetContext;
import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
import com.google.devtools.build.lib.cmdline.BazelModuleContext;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
Expand All @@ -32,12 +28,6 @@
import com.google.devtools.build.lib.packages.PackageSpecification.PackageGroupContents;
import com.google.devtools.build.lib.packages.Provider;
import javax.annotation.Nullable;
import net.starlark.java.annot.Param;
import net.starlark.java.annot.ParamType;
import net.starlark.java.annot.StarlarkMethod;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Starlark;
import net.starlark.java.eval.StarlarkThread;

/**
* Dummy ConfiguredTarget for package groups. Contains no functionality, since package groups are
Expand Down Expand Up @@ -86,24 +76,4 @@ protected Info rawGetStarlarkProvider(Provider.Key providerKey) {
protected Object rawGetStarlarkProvider(String providerKey) {
return null;
}

@StarlarkMethod(
name = "isAvailableFor",
documented = false,
parameters = {
@Param(
name = "label",
allowedTypes = {@ParamType(type = Label.class)})
},
useStarlarkThread = true)
public boolean starlarkMatches(Label label, StarlarkThread starlarkThread) throws EvalException {
RepositoryName repository =
BazelModuleContext.of(ofInnermostEnclosingStarlarkFunction(starlarkThread))
.label()
.getRepository();
if (!"@_builtins".equals(repository.getNameWithAt())) {
throw Starlark.errorf("private API only for use by builtins");
}
return Allowlist.isAvailableFor(packageSpecificationProvider.getPackageSpecifications(), label);
}
}