diff options
author | cparsons <cparsons@google.com> | 2018-02-28 12:16:38 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-28 12:18:44 -0800 |
commit | e70aafe68eebfd4f7dedf3cccd19deae72d29db6 (patch) | |
tree | 7dd211075236b3c06b34b0517852bdd624d8a87d /src/main/java/com/google/devtools/build/lib/rules/config | |
parent | 77c4f30b333106ff15de5b5dd42076db01fd22b4 (diff) |
Deprecate and remove several uses of the 'values' map in NativeInfo subclasses.
These subclasses should be using @SkylarkCallable(structField = true) instead
This is a bit of a memory win, as there is now no need to store field information twice.
There are still a couple of stragglers that are more difficult, namely ToolchainInfo and DefaultInfo. Their APIs will likely need some more extensive revamping before proceeding.
RELNOTES: None.
PiperOrigin-RevId: 187364392
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/config')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagProvider.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagProvider.java b/src/main/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagProvider.java index ff80048b63..1296f56b4e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagProvider.java @@ -16,7 +16,6 @@ package com.google.devtools.build.lib.rules.config; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.events.Location; @@ -47,7 +46,7 @@ public class ConfigFeatureFlagProvider extends NativeInfo { private final Predicate<String> validityPredicate; private ConfigFeatureFlagProvider(String value, Predicate<String> validityPredicate) { - super(SKYLARK_CONSTRUCTOR, ImmutableMap.<String, Object>of("value", value)); + super(SKYLARK_CONSTRUCTOR); this.value = value; this.validityPredicate = validityPredicate; @@ -89,6 +88,11 @@ public class ConfigFeatureFlagProvider extends NativeInfo { } /** Gets the current value of the flag in the flag's current configuration. */ + @SkylarkCallable( + name = "value", + doc = "The current value of the flag in the flag's current configuration.", + structField = true + ) public String getValue() { return value; } |