From 259c67d9dd0b173fb4cc5830d29ce6004e67ff84 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 23 May 2018 03:53:01 -0700 Subject: 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 --- .../build/lib/bazel/repository/RepositoryResolvedEvent.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/google/devtools') 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 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. } -- cgit v1.2.3