Skip to content

Commit

Permalink
BEP: add tool_tag explicitly
Browse files Browse the repository at this point in the history
Add the tool tag explicitly in the OptionsParsed event. In this
way, consumers of the stream can more easily associate an invocation
with a tool.

Change-Id: I6040e91f657082782bf8010a6576001118672e2d
PiperOrigin-RevId: 166862895
  • Loading branch information
aehlig authored and vladmos committed Aug 30, 2017
1 parent 687d6c4 commit 87848e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ message OptionsParsed {
repeated string cmd_line = 3;
repeated string explicit_cmd_line = 4;
blaze.invocation_policy.InvocationPolicy invocation_policy = 5;
string tool_tag = 6;
}

// Payload of an event indicating that an external resource was fetched. This
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters conv

optionsBuilder.setInvocationPolicy(getInvocationPolicy());

CommonCommandOptions commonOptions = getOptions().getOptions(CommonCommandOptions.class);
optionsBuilder.setToolTag(commonOptions.toolTag);

return GenericBuildEvent.protoChaining(this).setOptionsParsed(optionsBuilder.build()).build();
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/shell/integration/build_event_stream_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@ function test_basic() {
# - the target_kind is reported
# - for single-configuration builds, there is precisely one configuration
# event reported; also make variables are shown
bazel test --build_event_text_file=$TEST_log pkg:true \
bazel test --build_event_text_file=$TEST_log --tool_tag=MyFancyTool pkg:true \
|| fail "bazel test failed"
expect_log 'pkg:true'
# Command line
expect_log 'args: "test"'
expect_log 'args: "--build_event_text_file='
expect_log 'args: "pkg:true"'
# Options parsed
expect_log 'tool_tag: "MyFancyTool"'
# Build Finished
expect_log 'build_finished'
expect_log 'SUCCESS'
Expand Down

0 comments on commit 87848e3

Please sign in to comment.