From 2348a75882bda4ed8b983fd4f8af2c45fa292e10 Mon Sep 17 00:00:00 2001 From: tomlu Date: Wed, 4 Jul 2018 08:55:42 -0700 Subject: Include more information about build events' referenced local files. Instead of just a path, events now include information about the type of file (output, source file, stdout/stderr, test logs, etc.). This information can be used by the uploaders to determine a) whether to upload, b) what kind of lease to give the files. RELNOTES: None PiperOrigin-RevId: 203285549 --- .../lib/buildeventstream/transports/FileTransport.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java') diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java index c193ed094b..cce4f2d213 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java @@ -19,12 +19,14 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEvent.LocalFile; import com.google.devtools.build.lib.buildeventstream.BuildEventArtifactUploader; import com.google.devtools.build.lib.buildeventstream.BuildEventContext; import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions; @@ -37,7 +39,7 @@ import com.google.devtools.build.lib.util.io.AsynchronousFileOutputStream; import com.google.devtools.build.lib.vfs.Path; import com.google.protobuf.Message; import java.io.IOException; -import java.util.Set; +import java.util.Collection; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; @@ -147,10 +149,14 @@ abstract class FileTransport implements BuildEventTransport { * Returns a {@link PathConverter} for the uploaded files, or {@code null} when the uploaded * failed. */ - private ListenableFuture uploadReferencedFiles(Set artifacts) { - checkNotNull(artifacts); - - ListenableFuture upload = uploader.upload(artifacts); + private ListenableFuture uploadReferencedFiles(Collection localFiles) { + checkNotNull(localFiles); + ImmutableMap.Builder localFileMap = + ImmutableMap.builderWithExpectedSize(localFiles.size()); + for (LocalFile localFile : localFiles) { + localFileMap.put(localFile.path, localFile); + } + ListenableFuture upload = uploader.upload(localFileMap.build()); Futures.addCallback( upload, new FutureCallback() { -- cgit v1.2.3