aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/buildeventservice
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-09-26 18:42:09 -0400
committerGravatar John Cater <jcater@google.com>2017-09-27 10:01:24 -0400
commit7477c7aede03f5e0ff7c1ef0872206a869e4c9db (patch)
tree941b76ad55e876f7a7ded679f741abbc03f2db0a /src/main/java/com/google/devtools/build/lib/buildeventservice
parent77e3a5ca955a3834406a837dbd4607b0b432b2d8 (diff)
Adds option bes_keywords BEP publishing.
PiperOrigin-RevId: 170121049
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventservice')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceOptions.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtil.java12
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java11
4 files changed, 33 insertions, 7 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 088c7315c4..0df599426b 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
@@ -229,7 +229,8 @@ public abstract class BuildEventServiceModule<T extends BuildEventServiceOptions
clock,
pathConverter,
commandLineReporter,
- besOptions.projectId);
+ besOptions.projectId,
+ besOptions.besKeywords);
logger.fine("BuildEventServiceTransport was created successfully");
return besTransport;
}
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceOptions.java b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceOptions.java
index e24c204924..e0c86e24d1 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceOptions.java
@@ -19,6 +19,7 @@ import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
import com.google.devtools.common.options.OptionsBase;
import java.time.Duration;
+import java.util.List;
/** Options used by {@link BuildEventServiceModule}. */
public class BuildEventServiceOptions extends OptionsBase {
@@ -76,4 +77,17 @@ public class BuildEventServiceOptions extends OptionsBase {
help = "Specifies the BES project identifier. Defaults to null."
)
public String projectId;
+
+ @Option(
+ name = "bes_keywords",
+ defaultValue = "",
+ documentationCategory = OptionDocumentationCategory.LOGGING,
+ effectTags = {OptionEffectTag.AFFECTS_OUTPUTS},
+ allowMultiple = true,
+ help =
+ "Specifies a list of notification keywords to be added the default set of keywords "
+ + "published to BES (\"command_name=<command_name> \", \"protocol_name=BEP\"). "
+ + "Defaults to none."
+ )
+ public List<String> besKeywords;
}
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtil.java b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtil.java
index 636f873df4..022d29258a 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtil.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtil.java
@@ -35,6 +35,7 @@ import com.google.devtools.build.v1.StreamId;
import com.google.devtools.build.v1.StreamId.BuildComponent;
import com.google.protobuf.Any;
import com.google.protobuf.util.Timestamps;
+import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
@@ -47,18 +48,21 @@ public final class BuildEventServiceProtoUtil {
private final AtomicInteger streamSequenceNumber;
private final String commandName;
private final Clock clock;
+ private final List<String> additionalKeywords;
public BuildEventServiceProtoUtil(
String buildRequestId,
String buildInvocationId,
@Nullable String projectId,
String commandName,
- Clock clock) {
+ Clock clock,
+ List<String> additionalKeywords) {
this.buildRequestId = buildRequestId;
this.buildInvocationId = buildInvocationId;
this.projectId = projectId;
this.commandName = commandName;
this.clock = clock;
+ this.additionalKeywords = additionalKeywords;
this.streamSequenceNumber = new AtomicInteger(1);
}
@@ -189,6 +193,10 @@ public final class BuildEventServiceProtoUtil {
/** Keywords used by BES subscribers to filter notifications */
private ImmutableList<String> getKeywords() {
- return ImmutableList.of("command_name=" + commandName, "protocol_name=BEP");
+ return ImmutableList.<String>builder()
+ .add("command_name=" + commandName)
+ .add("protocol_name=BEP")
+ .addAll(additionalKeywords)
+ .build();
}
}
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 5df6580499..be2ee4d66f 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
@@ -58,6 +58,7 @@ import com.google.protobuf.Any;
import io.grpc.Status;
import java.time.Duration;
import java.util.Deque;
+import java.util.List;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedDeque;
@@ -129,10 +130,11 @@ public class BuildEventServiceTransport implements BuildEventTransport {
Clock clock,
PathConverter pathConverter,
EventHandler commandLineReporter,
- @Nullable String projectId) {
+ @Nullable String projectId,
+ List<String> keywords) {
this(besClient, uploadTimeout, bestEffortUpload, publishLifecycleEvents, buildRequestId,
invocationId, command, moduleEnvironment, clock, pathConverter, commandLineReporter,
- projectId, new JavaSleeper());
+ projectId, keywords, new JavaSleeper());
}
@VisibleForTesting
@@ -149,10 +151,11 @@ public class BuildEventServiceTransport implements BuildEventTransport {
PathConverter pathConverter,
EventHandler commandLineReporter,
@Nullable String projectId,
+ List<String> keywords,
Sleeper sleeper) {
this.besClient = besClient;
- this.besProtoUtil =
- new BuildEventServiceProtoUtil(buildRequestId, invocationId, projectId, command, clock);
+ this.besProtoUtil = new BuildEventServiceProtoUtil(
+ buildRequestId, invocationId, projectId, command, clock, keywords);
this.publishLifecycleEvents = publishLifecycleEvents;
this.moduleEnvironment = moduleEnvironment;
this.commandLineReporter = commandLineReporter;