From 4ca4b8dd5b408fc397bcf2ed51f744fd1d0cffa3 Mon Sep 17 00:00:00 2001 From: ulfjack Date: Thu, 17 May 2018 03:14:46 -0700 Subject: [PATCH] Fix modules returning command options Nobody reads the documentation, apparently. It also clearly states that getCommonCommandOptions should be used to add options to all commands. PiperOrigin-RevId: 196965665 --- .../build/lib/buildeventservice/BuildEventServiceModule.java | 3 +-- .../buildeventservice/BazelBuildEventServiceModuleTest.java | 2 +- 2 files changed, 2 insertions(+), 3 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 bee10809321f41..4ff32f1e02915e 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 @@ -35,7 +35,6 @@ import com.google.devtools.build.lib.events.Reporter; import com.google.devtools.build.lib.runtime.BlazeModule; import com.google.devtools.build.lib.runtime.BuildEventStreamer; -import com.google.devtools.build.lib.runtime.Command; import com.google.devtools.build.lib.runtime.CommandEnvironment; import com.google.devtools.build.lib.runtime.SynchronizedOutputStream; import com.google.devtools.build.lib.util.AbruptExitException; @@ -63,7 +62,7 @@ public abstract class BuildEventServiceModule transports = ImmutableSet.of(); @Override - public Iterable> getCommandOptions(Command command) { + public Iterable> getCommonCommandOptions() { return ImmutableList.of(optionsClass(), AuthAndTLSOptions.class, BuildEventStreamOptions.class); } diff --git a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java index e365f8c98db8c0..2b3afda7cd2647 100644 --- a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java @@ -122,7 +122,7 @@ public void validateMocks() { @Test public void testReturnsBuildEventStreamerOptions() throws Exception { BazelBuildEventServiceModule module = new BazelBuildEventServiceModule(); - Iterable> commandOptions = module.getCommandOptions(command); + Iterable> commandOptions = module.getCommonCommandOptions(); assertThat(commandOptions).isNotEmpty(); OptionsParser optionsParser = OptionsParser.newOptionsParser(commandOptions); optionsParser.parse(