diff options
author | 2018-06-15 01:40:02 -0700 | |
---|---|---|
committer | 2018-06-15 01:41:16 -0700 | |
commit | 68aa410229cb36ceedc910c803a0aff2db6d027f (patch) | |
tree | 3fa7f6805066a96966e9fa4191774a4b1c06d2cf /src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java | |
parent | 522f76ae5e50ae9848b6f407acbcce62bb808016 (diff) |
Add a mechanism for build event protocol events to upload files
This should be a no-op, mostly replacing PathConverter with
BuildEventArtifactUploader, since none of the implementations perform any
upload yet.
PiperOrigin-RevId: 200685325
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java index de4cfb8c88..6d6900687c 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEvent.java @@ -14,7 +14,10 @@ package com.google.devtools.build.lib.buildeventstream; +import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.events.ExtendedEventHandler; +import com.google.devtools.build.lib.vfs.Path; +import java.util.Set; /** * Interface for objects that can be posted on the public event stream. @@ -23,11 +26,29 @@ import com.google.devtools.build.lib.events.ExtendedEventHandler; * pass-through of events, as well as proper chaining of events. */ public interface BuildEvent extends ChainableEvent, ExtendedEventHandler.Postable { + + /** + * Returns a list of files that are referenced in the protobuf representation returned by {@link + * #asStreamProto(BuildEventContext)}. + * + * <p>This method is different from {@code EventReportingArtifacts#reportedArtifacts()} in that it + * only returns files directly referenced in the protobuf returned by {@link + * #asStreamProto(BuildEventContext)}. + * + * <p>Note the consistency requirement - you must not attempt to pass Path objects to the + * {@link PathConverter} unless you have returned the Path object here. + */ + // TODO(ulfjack): Consider moving the upload call to the BuildEventContext and returning a map + // from Path to URI, rather than a callback. + default Set<Path> referencedLocalFiles() { + return ImmutableSet.of(); + } + /** * Provide a binary representation of the event. * * <p>Provide a presentation of the event according to the specified binary format, as appropriate * protocol buffer. */ - BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters); + BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext context); } |