diff options
author | 2018-07-04 08:55:42 -0700 | |
---|---|---|
committer | 2018-07-04 08:57:40 -0700 | |
commit | 2348a75882bda4ed8b983fd4f8af2c45fa292e10 (patch) | |
tree | 50e6b82eb7c4d7ba1556a7696e266b630082e87f /src/main/java/com/google/devtools/build/lib/buildeventstream/transports | |
parent | 9b6208c6d74a5d485bed43f4a214f331e32d8ef6 (diff) |
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream/transports')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java | 16 |
1 files changed, 11 insertions, 5 deletions
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<PathConverter> uploadReferencedFiles(Set<Path> artifacts) { - checkNotNull(artifacts); - - ListenableFuture<PathConverter> upload = uploader.upload(artifacts); + private ListenableFuture<PathConverter> uploadReferencedFiles(Collection<LocalFile> localFiles) { + checkNotNull(localFiles); + ImmutableMap.Builder<Path, LocalFile> localFileMap = + ImmutableMap.builderWithExpectedSize(localFiles.size()); + for (LocalFile localFile : localFiles) { + localFileMap.put(localFile.path, localFile); + } + ListenableFuture<PathConverter> upload = uploader.upload(localFileMap.build()); Futures.addCallback( upload, new FutureCallback<PathConverter>() { |