diff options
author | Klaus Aehlig <aehlig@google.com> | 2017-08-11 19:48:46 +0200 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2017-08-14 14:14:21 +0200 |
commit | 284bdecf68ecb7d1afede7a73043d7ca73618e6d (patch) | |
tree | 1525298fadff99c58dea575f7b6d41c988a2c5e3 /src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java | |
parent | e13280fbd29dd0b349794890c1d5ddf6e332042a (diff) |
BEP: Make tags available in TargetConfigured event
The tags associated with a rule is information that
is useful as information about the target, independent
of the configuration. At the moment, tags cannot be
configuration-dependent anyway, but even if the extend
bazel it that way, the union of all possible tags is
still useful information.
Change-Id: Iabca0c28b0da4b13b8a62b2638a881c53cc70ccc
PiperOrigin-RevId: 164996472
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java index 8395337a4c..db6bea2563 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java @@ -22,9 +22,12 @@ import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventWithConfiguration; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; import com.google.devtools.build.lib.buildeventstream.NullConfiguration; +import com.google.devtools.build.lib.packages.RawAttributeMapper; +import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.packages.Target; import com.google.devtools.build.lib.packages.TargetUtils; import com.google.devtools.build.lib.packages.TestSize; +import com.google.devtools.build.lib.syntax.Type; import java.util.Collection; /** Event reporting about the configurations associated with a given target */ @@ -88,6 +91,10 @@ public class TargetConfiguredEvent implements BuildEventWithConfiguration { public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { BuildEventStreamProtos.TargetConfigured.Builder builder = BuildEventStreamProtos.TargetConfigured.newBuilder().setTargetKind(target.getTargetKind()); + Rule rule = target.getAssociatedRule(); + if (rule != null) { + builder.addAllTag(RawAttributeMapper.of(rule).getMergedValues("tags", Type.STRING_LIST)); + } if (TargetUtils.isTestRule(target)) { builder.setTestSize(bepTestSize(TestSize.getTestSize(target.getAssociatedRule()))); } |