diff options
author | 2018-05-23 03:53:01 -0700 | |
---|---|---|
committer | 2018-05-23 03:54:03 -0700 | |
commit | 259c67d9dd0b173fb4cc5830d29ce6004e67ff84 (patch) | |
tree | fd3dcecade6f147b6de612b6bc6b0cb94798f20f /src/main/java/com/google/devtools | |
parent | 174dc5159cb3736ca017598d6f8cec5f1bd44114 (diff) |
RepositoryResolvedEvent: only record the explicitly set original attributes
Prune down the list of attributes to the explicitly set ones when reporting
the original attributes. The attribute list also contains attributes implicitly
added from default values, but the original attributes are intended to record
the original way the rule was invoked from the WORKSPACE file.
Change-Id: I918656159850a52e9afc9f045701b0ea065f4125
PiperOrigin-RevId: 197702283
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedEvent.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedEvent.java index 6eb39609a6..d7aa538e51 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedEvent.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryResolvedEvent.java @@ -56,16 +56,11 @@ public class RepositoryResolvedEvent implements Postable { ImmutableMap.Builder<String, Object> origAttrBuilder = ImmutableMap.builder(); for (Attribute attr : rule.getAttributes()) { - String name = attr.getPublicName(); - if (!name.startsWith("_")) { - // TODO(aehlig): filter out remaining attributes that cannot be set in a - // WORKSPACE file. + if (rule.isAttributeValueExplicitlySpecified(attr)) { + String name = attr.getPublicName(); try { Object value = attrs.getValue(name, Object.class); - // Only record explicit values, skip computed defaults - if (!(value instanceof Attribute.ComputedDefault)) { - origAttrBuilder.put(name, value); - } + origAttrBuilder.put(name, value); } catch (EvalException e) { // Do nothing, just ignore the value. } |