diff options
author | 2018-05-18 12:46:54 -0700 | |
---|---|---|
committer | 2018-05-18 12:48:25 -0700 | |
commit | fbf2756c649649bc821595c562721ebf1af10361 (patch) | |
tree | f1251754c292c922f421a9368c01841232d322ad /src/main/java/com/google/devtools/build/lib/buildeventservice | |
parent | beaaf669b6f3651445da222cf43b6c33546c0fb7 (diff) |
Add BuildEventProtocolOptions; use to enable/disable important_outputs
The important_outputs field is deprecated, and this adds a flag to disable
its generation entirely.
PiperOrigin-RevId: 197186530
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventservice')
2 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java index 4ff32f1e02..a4e295751c 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java @@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.authandtls.AuthAndTLSOptions; import com.google.devtools.build.lib.buildeventservice.client.BuildEventServiceClient; +import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions; import com.google.devtools.build.lib.buildeventstream.BuildEventTransport; import com.google.devtools.build.lib.buildeventstream.PathConverter; import com.google.devtools.build.lib.buildeventstream.transports.BuildEventStreamOptions; @@ -63,7 +64,11 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions @Override public Iterable<Class<? extends OptionsBase>> getCommonCommandOptions() { - return ImmutableList.of(optionsClass(), AuthAndTLSOptions.class, BuildEventStreamOptions.class); + return ImmutableList.of( + optionsClass(), + AuthAndTLSOptions.class, + BuildEventStreamOptions.class, + BuildEventProtocolOptions.class); } @Override @@ -151,6 +156,9 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions BuildEventStreamOptions bepOptions = checkNotNull(optionsProvider.getOptions(BuildEventStreamOptions.class), "Could not get BuildEventStreamOptions."); + BuildEventProtocolOptions protocolOptions = + checkNotNull(optionsProvider.getOptions(BuildEventProtocolOptions.class), + "Could not get BuildEventProtocolOptions."); BuildEventTransport besTransport = null; try { @@ -163,6 +171,7 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions commandName, moduleEnvironment, clock, + protocolOptions, pathConverter, commandLineReporter, startupOptionsProvider); @@ -178,7 +187,7 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions } ImmutableSet<BuildEventTransport> bepTransports = - BuildEventTransportFactory.createFromOptions(bepOptions, pathConverter); + BuildEventTransportFactory.createFromOptions(bepOptions, protocolOptions, pathConverter); ImmutableSet.Builder<BuildEventTransport> transportsBuilder = ImmutableSet.<BuildEventTransport>builder().addAll(bepTransports); @@ -207,6 +216,7 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions String commandName, ModuleEnvironment moduleEnvironment, Clock clock, + BuildEventProtocolOptions protocolOptions, PathConverter pathConverter, EventHandler commandLineReporter, OptionsProvider startupOptionsProvider) @@ -244,6 +254,7 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions commandName, moduleEnvironment, clock, + protocolOptions, pathConverter, commandLineReporter, besOptions.projectId, diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java index 8783ef01df..ee5c654d95 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java @@ -36,6 +36,7 @@ import com.google.devtools.build.lib.buildeventservice.client.BuildEventServiceC import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; import com.google.devtools.build.lib.buildeventstream.BuildEventContext; +import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEvent.PayloadCase; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildFinished; @@ -94,6 +95,7 @@ public class BuildEventServiceTransport implements BuildEventTransport { private final BuildEventServiceProtoUtil besProtoUtil; private final ModuleEnvironment moduleEnvironment; private final EventHandler commandLineReporter; + private final BuildEventProtocolOptions protocolOptions; private final PathConverter pathConverter; private final Sleeper sleeper; /** Contains all pendingAck events that might be retried in case of failures. */ @@ -130,13 +132,14 @@ public class BuildEventServiceTransport implements BuildEventTransport { String command, ModuleEnvironment moduleEnvironment, Clock clock, + BuildEventProtocolOptions protocolOptions, PathConverter pathConverter, EventHandler commandLineReporter, @Nullable String projectId, Set<String> keywords) { this(besClient, uploadTimeout, bestEffortUpload, publishLifecycleEvents, buildRequestId, - invocationId, command, moduleEnvironment, clock, pathConverter, commandLineReporter, - projectId, keywords, new JavaSleeper()); + invocationId, command, moduleEnvironment, clock, protocolOptions, pathConverter, + commandLineReporter, projectId, keywords, new JavaSleeper()); } @VisibleForTesting @@ -150,6 +153,7 @@ public class BuildEventServiceTransport implements BuildEventTransport { String command, ModuleEnvironment moduleEnvironment, Clock clock, + BuildEventProtocolOptions protocolOptions, PathConverter pathConverter, EventHandler commandLineReporter, @Nullable String projectId, @@ -169,6 +173,7 @@ public class BuildEventServiceTransport implements BuildEventTransport { // loop by publishEventStream re-submitting itself to the executor. // TODO(buchgr): Fix it. this.uploaderExecutorService = listeningDecorator(Executors.newFixedThreadPool(2)); + this.protocolOptions = protocolOptions; this.pathConverter = pathConverter; this.invocationResult = UNKNOWN_STATUS; this.uploadTimeout = uploadTimeout; @@ -292,10 +297,16 @@ public class BuildEventServiceTransport implements BuildEventTransport { public PathConverter pathConverter() { return pathConverter; } + @Override public ArtifactGroupNamer artifactGroupNamer() { return namer; } + + @Override + public BuildEventProtocolOptions getOptions() { + return protocolOptions; + } }); if (PayloadCase.FINISHED.equals(eventProto.getPayloadCase())) { BuildFinished finished = eventProto.getFinished(); |