diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
20 files changed, 177 insertions, 26 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java index 6a4037a31f..69e7c79bbb 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java @@ -16,6 +16,7 @@ package com.google.devtools.build.lib.actions; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; @@ -83,7 +84,8 @@ public class ActionExecutedEvent implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + PathConverter pathConverter = converters.pathConverter(); BuildEventStreamProtos.ActionExecuted.Builder actionBuilder = BuildEventStreamProtos.ActionExecuted.newBuilder().setSuccess(getException() == null); if (exception != null && exception.getExitCode() != null) { diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java index 0bdbd9e71e..7c1b02cfbe 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java @@ -18,6 +18,7 @@ import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup; import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.File; @@ -104,7 +105,8 @@ public class AspectCompleteEvent implements SkyValue, BuildEventWithOrderConstra } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + PathConverter pathConverter = converters.pathConverter(); BuildEventStreamProtos.TargetComplete.Builder builder = BuildEventStreamProtos.TargetComplete.newBuilder(); builder.setSuccess(!failed()); diff --git a/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java index 1427e89799..84308a2d86 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java @@ -18,6 +18,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.File; @@ -132,7 +133,8 @@ public final class TargetCompleteEvent implements SkyValue, BuildEventWithOrderC } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + PathConverter pathConverter = converters.pathConverter(); BuildEventStreamProtos.TargetComplete.Builder builder = BuildEventStreamProtos.TargetComplete.newBuilder(); diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java index fe20063887..d7cbdb1139 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/AbortedEvent.java @@ -33,7 +33,7 @@ public class AbortedEvent extends GenericBuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { return GenericBuildEvent.protoChaining(this) .setAborted( BuildEventStreamProtos.Aborted.newBuilder() 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 a93922b8d7..fafc56e40d 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 @@ -29,5 +29,5 @@ public interface BuildEvent extends ChainableEvent, ExtendedEventHandler.Postabl * <p>Provide a presentation of the event according to the specified binary format, as appropriate * protocol buffer. */ - BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter); + BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters pathConverter); } diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventConverters.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventConverters.java new file mode 100644 index 0000000000..1943c1f2cf --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventConverters.java @@ -0,0 +1,27 @@ +// Copyright 2017 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.devtools.build.lib.buildeventstream; + +/** + * Interface for providing {@link BuildEvent}s with the convertes needed for computing the protobuf + * representation. + */ +public interface BuildEventConverters { + /** + * Return the {@link PathConverter} to be used in order to obtain URIs for the the file paths to + * be reported in the event. + */ + PathConverter pathConverter(); +} diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/GenericBuildEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/GenericBuildEvent.java index 613ee6280e..58e85e79cb 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/GenericBuildEvent.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/GenericBuildEvent.java @@ -52,7 +52,7 @@ public class GenericBuildEvent implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { return protoChaining(this).build(); } } diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/ProgressEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/ProgressEvent.java index 3a3ab15e4b..d1eacf5589 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/ProgressEvent.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/ProgressEvent.java @@ -34,7 +34,7 @@ public final class ProgressEvent extends GenericBuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { return GenericBuildEvent.protoChaining(this) .setProgress(BuildEventStreamProtos.Progress.newBuilder().build()) .build(); diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransport.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransport.java index 1bf30b7c0e..3356c230ca 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransport.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransport.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.buildeventstream.transports; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventTransport; import com.google.devtools.build.lib.buildeventstream.PathConverter; import java.io.BufferedOutputStream; @@ -40,7 +41,14 @@ public final class BinaryFormatFileTransport implements BuildEventTransport { @Override public synchronized void sendBuildEvent(BuildEvent event) throws IOException { - event.asStreamProto(pathConverter).writeDelimitedTo(out); + BuildEventConverters converters = + new BuildEventConverters() { + @Override + public PathConverter pathConverter() { + return pathConverter; + } + }; + event.asStreamProto(converters).writeDelimitedTo(out); out.flush(); } diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransport.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransport.java index 5f8f59d338..54e979e739 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransport.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransport.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.buildeventstream.transports; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventTransport; import com.google.devtools.build.lib.buildeventstream.PathConverter; import com.google.protobuf.TextFormat; @@ -40,7 +41,14 @@ public final class TextFormatFileTransport implements BuildEventTransport { @Override public synchronized void sendBuildEvent(BuildEvent event) throws IOException { if (out != null) { - String protoTextRepresentation = TextFormat.printToString(event.asStreamProto(pathConverter)); + BuildEventConverters converters = + new BuildEventConverters() { + @Override + public PathConverter pathConverter() { + return pathConverter; + } + }; + String protoTextRepresentation = TextFormat.printToString(event.asStreamProto(converters)); out.write(("event {\n" + protoTextRepresentation + "}\n\n").getBytes(StandardCharsets.UTF_8)); out.flush(); } diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildCompleteEvent.java index 2412221513..f8e419e65f 100644 --- a/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildCompleteEvent.java +++ b/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildCompleteEvent.java @@ -18,11 +18,11 @@ import static com.google.devtools.build.lib.util.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildFinished; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; -import com.google.devtools.build.lib.buildeventstream.PathConverter; import com.google.devtools.build.lib.buildtool.BuildResult; import java.util.Collection; @@ -59,7 +59,7 @@ public final class BuildCompleteEvent implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { BuildFinished finished = BuildFinished.newBuilder() .setOverallSuccess(result.getSuccess()) diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildStartingEvent.java b/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildStartingEvent.java index 01c148d84b..c13723cf67 100644 --- a/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildStartingEvent.java +++ b/src/main/java/com/google/devtools/build/lib/buildtool/buildevent/BuildStartingEvent.java @@ -17,10 +17,10 @@ package com.google.devtools.build.lib.buildtool.buildevent; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.analysis.BlazeVersionInfo; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; 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.buildeventstream.ProgressEvent; import com.google.devtools.build.lib.buildtool.BuildRequest; import com.google.devtools.build.lib.runtime.CommandEnvironment; @@ -89,7 +89,7 @@ public final class BuildStartingEvent implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { BuildEventStreamProtos.BuildStarted.Builder started = BuildEventStreamProtos.BuildStarted.newBuilder() .setUuid(request.getId().toString()) diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java index 9f5b9d97c5..5727631051 100644 --- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java +++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSet.java @@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.collect.CompactHashSet; - import java.util.AbstractCollection; import java.util.Arrays; import java.util.Collection; @@ -27,7 +26,6 @@ import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.Set; - import javax.annotation.Nullable; /** @@ -144,7 +142,8 @@ public final class NestedSet<E> implements Iterable<E> { } /** - * Returns the internal item or array. For use by NestedSetVisitor. + * Returns the internal item or array. For use by NestedSetVisitor and NestedSetView. Those to + * classes also have knowledge of the internal implementation of NestedSet. */ Object rawChildren() { return children; diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetView.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetView.java new file mode 100644 index 0000000000..48e1ca2046 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetView.java @@ -0,0 +1,99 @@ +// Copyright 2017 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.google.devtools.build.lib.collect.nestedset; + +import com.google.common.collect.ImmutableSet; +import java.util.Set; + +/** + * Class presenting the logical structure of a {@link NestedSet}. + * + * <p>The main use case for this class are situations were a larger number of related nested sets + * needs to be serialized in an efficient way, as is the case when reporting artifacts in the build + * event protocol. + * + * <p>Note that a {@link NestedSet} does not preserve all structure provided to the {@link + * NestedSetBuilder}; in fact, it may decide to inline the contents of small nested sets as direct + * members. This view class provides a view on the structure that is still present in a {@link + * NestedSet}. As there is a fixed limit on the size a transitive member can have to still be + * eligible for inlining, this is enough to allow an efficient deduplicated presentation. + */ +public class NestedSetView<E> { + private final Object set; + + private NestedSetView(Object set) { + this.set = set; + } + + /** Construct a view of a given NestedSet. */ + public NestedSetView(NestedSet<E> set) { + this(set.rawChildren()); + } + + /** + * Return an object where the {@link equals()} method provides the correct notion of (intensional) + * equality of the set viewed. Consumers of this method should not assume any properties of the + * returned object apart from its {@link equals()} method. + * + * <p>The identifier is meant as an abstract, but memory efficient way of remembering nested sets + * directly or indirectly seen. Storing the identifier of a nested-set view will not retain more + * memory than storing the underlying nested set; in particular, it will not prevent the view + * object from being garbage collected. + * + * <p>The equality of the view itself is the one inherited from Object, i.e., you can have many + * views of the same set that are not equal as views. + */ + public Object identifier() { + return set; + } + + /** + * Return the set of transitive members. + * + * <p>This refers to the transitive members after any inlining that might have happened at + * construction of the nested set. + */ + public Set<NestedSetView<E>> transitives() { + if (!(set instanceof Object[])) { + return ImmutableSet.<NestedSetView<E>>of(); + } + ImmutableSet.Builder<NestedSetView<E>> transitives = + new ImmutableSet.Builder<NestedSetView<E>>(); + for (Object c : (Object[]) set) { + if (c instanceof Object[]) { + transitives.add(new NestedSetView(c)); + } + } + return transitives.build(); + } + + /** + * Return the set of direct members. + * + * <p>This refers to the direct members after any inlining that might have happened at + * construction of the nested set. + */ + public Set<E> directs() { + if (!(set instanceof Object[])) { + return ImmutableSet.<E>of((E) set); + } + ImmutableSet.Builder<E> children = new ImmutableSet.Builder<E>(); + for (Object c : (Object[]) set) { + if (!(c instanceof Object[])) { + children.add((E) c); + } + } + return children.build(); + } +} diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java index 94d150ff88..4a0967af85 100644 --- a/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java +++ b/src/main/java/com/google/devtools/build/lib/pkgcache/TargetParsingCompleteEvent.java @@ -19,10 +19,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; 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.cmdline.Label; import com.google.devtools.build.lib.packages.Target; import com.google.devtools.build.lib.packages.TargetUtils; @@ -123,7 +123,7 @@ public class TargetParsingCompleteEvent implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { return GenericBuildEvent.protoChaining(this) .setExpanded(BuildEventStreamProtos.PatternExpanded.newBuilder().build()) .build(); diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java index 8e01b0b1ce..2bddc64e87 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java +++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java @@ -16,6 +16,7 @@ package com.google.devtools.build.lib.rules.test; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; @@ -130,7 +131,8 @@ public class TestAttempt implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + PathConverter pathConverter = converters.pathConverter(); BuildEventStreamProtos.TestResult.Builder builder = BuildEventStreamProtos.TestResult.newBuilder(); builder.setStatus(BuildEventStreamerUtils.bepStatus(status)); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/GotOptionsEvent.java b/src/main/java/com/google/devtools/build/lib/runtime/GotOptionsEvent.java index 4a71f1066e..c07dedaec0 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/GotOptionsEvent.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/GotOptionsEvent.java @@ -16,11 +16,11 @@ package com.google.devtools.build.lib.runtime; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventWithOrderConstraint; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; -import com.google.devtools.build.lib.buildeventstream.PathConverter; import com.google.devtools.build.lib.util.OptionsUtils; import com.google.devtools.common.options.OptionsParser.UnparsedOptionValueDescription; import com.google.devtools.common.options.OptionsProvider; @@ -69,7 +69,7 @@ public class GotOptionsEvent implements BuildEventWithOrderConstraint { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { BuildEventStreamProtos.OptionsParsed.Builder optionsBuilder = BuildEventStreamProtos.OptionsParsed.newBuilder(); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/OriginalCommandLineEvent.java b/src/main/java/com/google/devtools/build/lib/runtime/OriginalCommandLineEvent.java index 3247f9f530..e6b02ba101 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/OriginalCommandLineEvent.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/OriginalCommandLineEvent.java @@ -15,11 +15,11 @@ package com.google.devtools.build.lib.runtime; import com.google.common.collect.ImmutableList; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventWithOrderConstraint; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; -import com.google.devtools.build.lib.buildeventstream.PathConverter; import java.util.Collection; import java.util.List; @@ -48,7 +48,7 @@ public class OriginalCommandLineEvent implements BuildEventWithOrderConstraint { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { return GenericBuildEvent.protoChaining(this) .setCommandLine(BuildEventStreamProtos.CommandLine.newBuilder().addAllArgs(args).build()) .build(); 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 74018cf585..abf10044d5 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 @@ -22,6 +22,7 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.FilesToRunProvider; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; @@ -463,7 +464,8 @@ public class TestSummary implements Comparable<TestSummary>, BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + PathConverter pathConverter = converters.pathConverter(); BuildEventStreamProtos.TestSummary.Builder summaryBuilder = BuildEventStreamProtos.TestSummary.newBuilder() .setOverallStatus(BuildEventStreamerUtils.bepStatus(status)) diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java b/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java index fd273e7fee..463fbfbde1 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PatternExpandingError.java @@ -15,10 +15,10 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.buildeventstream.BuildEvent; +import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; import com.google.devtools.build.lib.buildeventstream.BuildEventId; 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 java.util.Collection; import java.util.List; @@ -58,7 +58,7 @@ public final class PatternExpandingError implements BuildEvent { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(PathConverter pathConverter) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { BuildEventStreamProtos.LoadingFailure failure = BuildEventStreamProtos.LoadingFailure.newBuilder().setDetails(message).build(); return GenericBuildEvent.protoChaining(this).setLoadingFailed(failure).build(); |