aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java14
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/NamedArtifactGroup.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java37
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java9
4 files changed, 40 insertions, 35 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index d4591a46b2..44e9f61e39 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -31,7 +31,7 @@ import com.google.devtools.build.lib.analysis.ServerDirectories;
import com.google.devtools.build.lib.analysis.config.BuildOptions;
import com.google.devtools.build.lib.analysis.config.ConfigurationFragmentFactory;
import com.google.devtools.build.lib.analysis.test.CoverageReportActionFactory;
-import com.google.devtools.build.lib.buildeventstream.PathConverter;
+import com.google.devtools.build.lib.buildeventstream.BuildEventArtifactUploaderMap;
import com.google.devtools.build.lib.clock.BlazeClock;
import com.google.devtools.build.lib.clock.Clock;
import com.google.devtools.build.lib.events.Event;
@@ -153,7 +153,7 @@ public final class BlazeRuntime {
private final String defaultsPackageContent;
private final SubscriberExceptionHandler eventBusExceptionHandler;
private final String productName;
- private final PathConverter pathToUriConverter;
+ private final BuildEventArtifactUploaderMap buildEventArtifactUploaders;
private final ActionKeyContext actionKeyContext;
// Workspace state (currently exactly one workspace per server)
@@ -178,7 +178,7 @@ public final class BlazeRuntime {
InvocationPolicy moduleInvocationPolicy,
Iterable<BlazeCommand> commands,
String productName,
- PathConverter pathToUriConverter) {
+ BuildEventArtifactUploaderMap buildEventArtifactUploaders) {
// Server state
this.fileSystem = fileSystem;
this.blazeModules = blazeModules;
@@ -205,7 +205,7 @@ public final class BlazeRuntime {
CommandNameCache.CommandNameCacheInstance.INSTANCE.setCommandNameCache(
new CommandNameCacheImpl(getCommandMap()));
this.productName = productName;
- this.pathToUriConverter = pathToUriConverter;
+ this.buildEventArtifactUploaders = buildEventArtifactUploaders;
}
public BlazeWorkspace initWorkspace(BlazeDirectories directories, BinTools binTools)
@@ -1261,8 +1261,8 @@ public final class BlazeRuntime {
return productName;
}
- public PathConverter getPathToUriConverter() {
- return pathToUriConverter;
+ public BuildEventArtifactUploaderMap getBuildEventArtifactUploaders() {
+ return buildEventArtifactUploaders;
}
/**
@@ -1369,7 +1369,7 @@ public final class BlazeRuntime {
serverBuilder.getInvocationPolicy(),
serverBuilder.getCommands(),
productName,
- serverBuilder.getPathToUriConverter());
+ serverBuilder.getBuildEventArtifactUploaderMap());
}
public Builder setProductName(String productName) {
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/NamedArtifactGroup.java b/src/main/java/com/google/devtools/build/lib/runtime/NamedArtifactGroup.java
index b990c15c7b..431b4276ad 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/NamedArtifactGroup.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/NamedArtifactGroup.java
@@ -25,6 +25,7 @@ import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos;
import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
import com.google.devtools.build.lib.collect.nestedset.NestedSetView;
+import com.google.devtools.build.lib.vfs.Path;
import java.util.Collection;
/**
@@ -52,6 +53,19 @@ class NamedArtifactGroup implements BuildEvent {
}
@Override
+ public ImmutableSet<Path> referencedLocalFiles() {
+ // This has to be consistent with the code below.
+ ImmutableSet.Builder<Path> artifacts = ImmutableSet.builder();
+ for (Artifact artifact : view.directs()) {
+ if (artifact.isMiddlemanArtifact()) {
+ continue;
+ }
+ artifacts.add(artifact.getPath());
+ }
+ return artifacts.build();
+ }
+
+ @Override
public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters) {
PathConverter pathConverter = converters.pathConverter();
ArtifactGroupNamer namer = converters.artifactGroupNamer();
@@ -59,6 +73,7 @@ class NamedArtifactGroup implements BuildEvent {
BuildEventStreamProtos.NamedSetOfFiles.Builder builder =
BuildEventStreamProtos.NamedSetOfFiles.newBuilder();
for (Artifact artifact : view.directs()) {
+ // We never want to report middleman artifacts. They are for internal use only.
if (artifact.isMiddlemanArtifact()) {
continue;
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java b/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java
index b8dc2eb7ef..73bb27e67a 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/ServerBuilder.java
@@ -18,7 +18,8 @@ import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.devtools.build.lib.buildeventstream.PathConverter;
+import com.google.devtools.build.lib.buildeventstream.BuildEventArtifactUploader;
+import com.google.devtools.build.lib.buildeventstream.BuildEventArtifactUploaderMap;
import com.google.devtools.build.lib.packages.AttributeContainer;
import com.google.devtools.build.lib.packages.PackageFactory;
import com.google.devtools.build.lib.packages.RuleClass;
@@ -28,7 +29,6 @@ import com.google.devtools.build.lib.query2.engine.QueryEnvironment.QueryFunctio
import com.google.devtools.build.lib.query2.output.OutputFormatter;
import com.google.devtools.build.lib.runtime.commands.InfoItem;
import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass.InvocationPolicy;
-import com.google.devtools.build.lib.vfs.Path;
/**
* Builder class to create a {@link BlazeRuntime} instance. This class is part of the module API,
@@ -45,8 +45,8 @@ public final class ServerBuilder {
ImmutableList.builder();
private final ImmutableList.Builder<PackageFactory.EnvironmentExtension> environmentExtensions =
ImmutableList.builder();
- private final ImmutableList.Builder<PathConverter> pathToUriConverters
- = ImmutableList.builder();
+ private final BuildEventArtifactUploaderMap.Builder buildEventArtifactUploaders =
+ new BuildEventArtifactUploaderMap.Builder();
@VisibleForTesting
public ServerBuilder() {}
@@ -87,25 +87,8 @@ public final class ServerBuilder {
return commands.build();
}
- /**
- * Return the derived total converter from Paths to URIs. It returns the answer of the first
- * registered converter that can convert the given path, if any. If no registered converter can
- * convert the given path, the "file" URI scheme is used.
- */
- public PathConverter getPathToUriConverter() {
- final ImmutableList<PathConverter> converters = this.pathToUriConverters.build();
- return new PathConverter(){
- @Override
- public String apply(Path path) {
- for (PathConverter converter : converters) {
- String value = converter.apply(path);
- if (value != null) {
- return value;
- }
- }
- return "file://" + path.getPathString();
- }
- };
+ public BuildEventArtifactUploaderMap getBuildEventArtifactUploaderMap() {
+ return buildEventArtifactUploaders.build();
}
/**
@@ -195,11 +178,9 @@ public final class ServerBuilder {
return this;
}
- /**
- * Register a new {@link PathConverter}. Contervers are tried in the order they are registered.
- */
- public ServerBuilder addPathToUriConverter(PathConverter converter) {
- this.pathToUriConverters.add(converter);
+ public ServerBuilder addBuildEventArtifactUploader(
+ BuildEventArtifactUploader uploader, String name) {
+ buildEventArtifactUploaders.add(name, uploader);
return this;
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java b/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java
index 97c66cb8e6..4c8d46825f 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/TestSummary.java
@@ -18,6 +18,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.devtools.build.lib.analysis.AliasProvider;
@@ -490,6 +491,14 @@ public class TestSummary implements Comparable<TestSummary>, BuildEventWithOrder
}
@Override
+ public ImmutableSet<Path> referencedLocalFiles() {
+ ImmutableSet.Builder<Path> artifacts = ImmutableSet.builder();
+ artifacts.addAll(getFailedLogs());
+ artifacts.addAll(getPassedLogs());
+ return artifacts.build();
+ }
+
+ @Override
public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters) {
PathConverter pathConverter = converters.pathConverter();
BuildEventStreamProtos.TestSummary.Builder summaryBuilder =