diff options
author | ccalvarin <ccalvarin@google.com> | 2017-10-10 05:29:56 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-10-10 11:24:42 +0200 |
commit | ceb1013c1ca0238188e2714442fcfb2efb16bc6a (patch) | |
tree | 2cdd1a3a21e716a7653c8be61d39d8b2396c7bb0 /src/main/java/com/google/devtools/build/lib/buildeventstream | |
parent | 43edc92ac185ee2f1b8d0db31943ec1655b43434 (diff) |
Report the structured Bazel command line via the BEP.
This is part of the effort outlined in https://bazel.build/designs/2017/07/13/improved-command-line-reporting.html. The refactoring of the options parser is not yet complete, so we still do not have complete & correct information about the canonical command line. Where the information is blatantly incorrect, a best approximation was made, with comments and tests documenting the deficiencies.
Change the names of the initial CommandLine fields in the BEP to be explicitly identified as unstructured.
RELNOTES: None.
PiperOrigin-RevId: 171625377
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream')
3 files changed, 34 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java index 1e73efc3db..2479b59b3d 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventId.java @@ -88,11 +88,24 @@ public final class BuildEventId implements Serializable { BuildEventStreamProtos.BuildEventId.newBuilder().setStarted(startedId).build()); } - public static BuildEventId commandlineId() { - BuildEventStreamProtos.BuildEventId.CommandLineId commandLineId = - BuildEventStreamProtos.BuildEventId.CommandLineId.getDefaultInstance(); + public static BuildEventId unstructuredCommandlineId() { + BuildEventStreamProtos.BuildEventId.UnstructuredCommandLineId commandLineId = + BuildEventStreamProtos.BuildEventId.UnstructuredCommandLineId.getDefaultInstance(); return new BuildEventId( - BuildEventStreamProtos.BuildEventId.newBuilder().setCommandLine(commandLineId).build()); + BuildEventStreamProtos.BuildEventId.newBuilder() + .setUnstructuredCommandLine(commandLineId) + .build()); + } + + public static BuildEventId structuredCommandlineId(String commandLineLabel) { + BuildEventStreamProtos.BuildEventId.StructuredCommandLineId commandLineId = + BuildEventStreamProtos.BuildEventId.StructuredCommandLineId.newBuilder() + .setCommandLineLabel(commandLineLabel) + .build(); + return new BuildEventId( + BuildEventStreamProtos.BuildEventId.newBuilder() + .setStructuredCommandLine(commandLineId) + .build()); } public static BuildEventId optionsParsedId() { diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/BUILD b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/BUILD index c1c65b2696..a4bd2ed85a 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/BUILD +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/BUILD @@ -22,6 +22,7 @@ proto_library( name = "build_event_stream_proto", srcs = ["build_event_stream.proto"], deps = [ + "//src/main/protobuf:command_line_proto", "//src/main/protobuf:invocation_policy_proto", ], ) 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 472f104ecc..bbe9963ab9 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 @@ -20,6 +20,7 @@ option java_package = "com.google.devtools.build.lib.buildeventstream"; option java_outer_classname = "BuildEventStreamProtos"; import "src/main/protobuf/invocation_policy.proto"; +import "src/main/protobuf/command_line.proto"; // Identifier for a build event. It is deliberately structured to also provide // information about which build target etc the event is related to. @@ -53,7 +54,16 @@ message BuildEventId { // Identifier on an event indicating the original commandline received by // the bazel server. - message CommandLineId { + message UnstructuredCommandLineId { + } + + // Identifier on an event describing the commandline received by Bazel. + message StructuredCommandLineId { + // A title for this command line value, as there may be multiple. + // For example, a single invocation may wish to report both the literal and + // canonical command lines, and this label would be used to differentiate + // between both versions. + string command_line_label = 1; } // Identifier of an event indicating the workspace status. @@ -159,7 +169,8 @@ message BuildEventId { UnknownBuildEventId unknown = 1; ProgressId progress = 2; BuildStartedId started = 3; - CommandLineId command_line = 11; + UnstructuredCommandLineId unstructured_command_line = 11; + StructuredCommandLineId structured_command_line = 18; WorkspaceStatusId workspace_status = 14; OptionsParsedId options_parsed = 12; FetchId fetch = 17; @@ -260,7 +271,7 @@ message BuildStarted { // like name and relevant entries of rc-files and client environment variables. // However, it does contain enough information to reproduce the build // invocation. -message CommandLine { +message UnstructuredCommandLine { repeated string args = 1; } @@ -531,7 +542,8 @@ message BuildEvent { Progress progress = 3; Aborted aborted = 4; BuildStarted started = 5; - CommandLine command_line = 12; + UnstructuredCommandLine unstructured_command_line = 12; + command_line.CommandLine structured_command_line = 22; OptionsParsed options_parsed = 13; WorkspaceStatus workspace_status = 16; Fetch fetch = 21; |