aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2017-08-11 19:48:46 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-14 14:14:21 +0200
commit284bdecf68ecb7d1afede7a73043d7ca73618e6d (patch)
tree1525298fadff99c58dea575f7b6d41c988a2c5e3 /src/main/java/com/google/devtools
parente13280fbd29dd0b349794890c1d5ddf6e332042a (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')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/TargetConfiguredEvent.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto6
2 files changed, 12 insertions, 1 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())));
}
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
index c80349868c..1d6b907b56 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
@@ -324,6 +324,10 @@ message TargetConfigured {
// The size of the test, if the target is a test target. Unset otherwise.
TestSize test_size = 2;
+
+ // List of all tags associated with this target (for all possible
+ // configurations).
+ repeated string tag = 3;
}
message File {
@@ -414,7 +418,7 @@ message TargetComplete {
// new clients should not use it.
repeated File important_output = 4 [deprecated = true];
- // List of tags associated with this target.
+ // List of tags associated with this configured target.
repeated string tag = 3;
}