aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar plf <plf@google.com>2018-05-28 01:08:04 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-28 01:09:36 -0700
commit2ad044cbc0214ad1e1d7a30350e8b428dcd29bf4 (patch)
treef8237a2f1f02a26503e29f877eb7c9dbdc58fa6d /src/main/java/com/google
parenta7e05846f75cc38de58a392ee61d69aea5598ed7 (diff)
Skylark: Exposes disabled features from rule context to Skylark
WANT_LGTM=all RELNOTES:none PiperOrigin-RevId: 198269370
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java8
2 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
index 6d440191dd..4e424bbc60 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
@@ -595,6 +595,12 @@ public final class SkylarkRuleContext implements SkylarkRuleContextApi {
}
@Override
+ public ImmutableList<String> getDisabledFeatures() throws EvalException {
+ checkMutable("disabled_features");
+ return ImmutableList.copyOf(ruleContext.getDisabledFeatures());
+ }
+
+ @Override
public ArtifactRoot getBinDirectory() throws EvalException {
checkMutable("bin_dir");
return getConfiguration().getBinDirectory(ruleContext.getRule().getRepository());
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
index ca23f57fc3..2350429680 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
@@ -240,11 +240,17 @@ public interface SkylarkRuleContextApi extends SkylarkValue {
@SkylarkCallable(
name = "features",
structField = true,
- doc = "Returns the set of features that are enabled for this rule."
+ doc = "Returns the set of features that are explicitly enabled by the user for this rule."
)
public ImmutableList<String> getFeatures() throws EvalException;
@SkylarkCallable(
+ name = "disabled_features",
+ structField = true,
+ doc = "Returns the set of features that are explicitly disabled by the user for this rule.")
+ ImmutableList<String> getDisabledFeatures() throws EvalException;
+
+ @SkylarkCallable(
name = "bin_dir",
structField = true,
doc = "The root corresponding to bin directory."