Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. All rights reserved. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package com.google.devtools.build.lib.analysis; |
| 16 | |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 17 | import com.google.common.collect.ImmutableList; |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 18 | import com.google.common.collect.ImmutableSet; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 19 | import com.google.common.collect.Iterables; |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 20 | import com.google.devtools.build.lib.actions.Artifact; |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 21 | import com.google.devtools.build.lib.actions.EventReportingArtifacts; |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 22 | import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup; |
Klaus Aehlig | 71c993b | 2017-05-09 07:49:46 -0400 | [diff] [blame] | 23 | import com.google.devtools.build.lib.analysis.config.BuildConfiguration; |
gregce | 593f7f9 | 2017-09-19 02:02:21 +0200 | [diff] [blame] | 24 | import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 25 | import com.google.devtools.build.lib.analysis.test.InstrumentedFilesProvider; |
ulfjack | ab21d18 | 2017-08-10 15:36:14 +0200 | [diff] [blame] | 26 | import com.google.devtools.build.lib.analysis.test.TestProvider; |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 27 | import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; |
Klaus Aehlig | a708a02 | 2017-07-11 12:54:40 +0200 | [diff] [blame] | 28 | import com.google.devtools.build.lib.buildeventstream.BuildEvent; |
aehlig | 617bb89 | 2017-04-04 15:03:23 +0000 | [diff] [blame] | 29 | import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 30 | import com.google.devtools.build.lib.buildeventstream.BuildEventId; |
| 31 | import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; |
Klaus Aehlig | 0a6cd62 | 2017-04-21 17:09:40 +0200 | [diff] [blame] | 32 | import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.File; |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 33 | import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.OutputGroup; |
Klaus Aehlig | a708a02 | 2017-07-11 12:54:40 +0200 | [diff] [blame] | 34 | import com.google.devtools.build.lib.buildeventstream.BuildEventWithConfiguration; |
Klaus Aehlig | 74d716b | 2016-11-23 12:38:24 +0000 | [diff] [blame] | 35 | import com.google.devtools.build.lib.buildeventstream.BuildEventWithOrderConstraint; |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 36 | import com.google.devtools.build.lib.buildeventstream.GenericBuildEvent; |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 37 | import com.google.devtools.build.lib.buildeventstream.TestFileNameConstants; |
Klaus Aehlig | d1f4a16 | 2016-10-25 14:51:55 +0000 | [diff] [blame] | 38 | import com.google.devtools.build.lib.causes.Cause; |
Klaus Aehlig | 1f452c3 | 2017-02-02 10:19:15 +0000 | [diff] [blame] | 39 | import com.google.devtools.build.lib.cmdline.Label; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 40 | import com.google.devtools.build.lib.collect.nestedset.NestedSet; |
| 41 | import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 42 | import com.google.devtools.build.lib.collect.nestedset.NestedSetView; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 43 | import com.google.devtools.build.lib.collect.nestedset.Order; |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 44 | import com.google.devtools.build.lib.packages.AttributeMap; |
Klaus Aehlig | 10da466 | 2017-06-27 15:36:27 +0200 | [diff] [blame] | 45 | import com.google.devtools.build.lib.packages.TestSize; |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 46 | import com.google.devtools.build.lib.syntax.Type; |
Mark Schaller | 6df8179 | 2015-12-10 18:47:47 +0000 | [diff] [blame] | 47 | import com.google.devtools.build.lib.util.Preconditions; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 48 | import com.google.devtools.build.skyframe.SkyValue; |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 49 | import java.util.Collection; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 50 | |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 51 | /** This event is fired as soon as a target is either built or fails. */ |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 52 | public final class TargetCompleteEvent |
Klaus Aehlig | 71c993b | 2017-05-09 07:49:46 -0400 | [diff] [blame] | 53 | implements SkyValue, |
| 54 | BuildEventWithOrderConstraint, |
| 55 | EventReportingArtifacts, |
| 56 | BuildEventWithConfiguration { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 57 | private final ConfiguredTarget target; |
Klaus Aehlig | d1f4a16 | 2016-10-25 14:51:55 +0000 | [diff] [blame] | 58 | private final NestedSet<Cause> rootCauses; |
Klaus Aehlig | 74d716b | 2016-11-23 12:38:24 +0000 | [diff] [blame] | 59 | private final Collection<BuildEventId> postedAfter; |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 60 | private final Iterable<ArtifactsInOutputGroup> outputs; |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 61 | private final NestedSet<Artifact> baselineCoverageArtifacts; |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 62 | private final boolean isTest; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 63 | |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 64 | private TargetCompleteEvent( |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 65 | ConfiguredTarget target, |
| 66 | NestedSet<Cause> rootCauses, |
| 67 | Iterable<ArtifactsInOutputGroup> outputs, |
| 68 | boolean isTest) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 69 | this.target = target; |
Klaus Aehlig | d1f4a16 | 2016-10-25 14:51:55 +0000 | [diff] [blame] | 70 | this.rootCauses = |
| 71 | (rootCauses == null) ? NestedSetBuilder.<Cause>emptySet(Order.STABLE_ORDER) : rootCauses; |
Klaus Aehlig | 74d716b | 2016-11-23 12:38:24 +0000 | [diff] [blame] | 72 | |
| 73 | ImmutableList.Builder postedAfterBuilder = ImmutableList.builder(); |
| 74 | for (Cause cause : getRootCauses()) { |
| 75 | postedAfterBuilder.add(BuildEventId.fromCause(cause)); |
| 76 | } |
| 77 | this.postedAfter = postedAfterBuilder.build(); |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 78 | this.outputs = outputs; |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 79 | this.isTest = isTest; |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 80 | InstrumentedFilesProvider instrumentedFilesProvider = |
| 81 | this.target.getProvider(InstrumentedFilesProvider.class); |
| 82 | if (instrumentedFilesProvider == null) { |
| 83 | this.baselineCoverageArtifacts = null; |
| 84 | } else { |
| 85 | NestedSet<Artifact> baselineCoverageArtifacts = |
| 86 | instrumentedFilesProvider.getBaselineCoverageArtifacts(); |
| 87 | if (!baselineCoverageArtifacts.isEmpty()) { |
| 88 | this.baselineCoverageArtifacts = baselineCoverageArtifacts; |
| 89 | } else { |
| 90 | this.baselineCoverageArtifacts = null; |
| 91 | } |
| 92 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 93 | } |
| 94 | |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 95 | /** Construct a successful target completion event. */ |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 96 | public static TargetCompleteEvent createSuccessfulTarget( |
| 97 | ConfiguredTarget ct, NestedSet<ArtifactsInOutputGroup> outputs) { |
| 98 | return new TargetCompleteEvent(ct, null, outputs, false); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 99 | } |
| 100 | |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 101 | /** Construct a successful target completion event for a target that will be tested. */ |
| 102 | public static TargetCompleteEvent createSuccessfulTestTarget(ConfiguredTarget ct) { |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 103 | return new TargetCompleteEvent(ct, null, ImmutableList.<ArtifactsInOutputGroup>of(), true); |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 107 | /** |
| 108 | * Construct a target completion event for a failed target, with the given non-empty root causes. |
| 109 | */ |
Klaus Aehlig | d1f4a16 | 2016-10-25 14:51:55 +0000 | [diff] [blame] | 110 | public static TargetCompleteEvent createFailed(ConfiguredTarget ct, NestedSet<Cause> rootCauses) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 111 | Preconditions.checkArgument(!Iterables.isEmpty(rootCauses)); |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 112 | return new TargetCompleteEvent( |
| 113 | ct, rootCauses, ImmutableList.<ArtifactsInOutputGroup>of(), false); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Returns the target associated with the event. |
| 118 | */ |
| 119 | public ConfiguredTarget getTarget() { |
| 120 | return target; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Determines whether the target has failed or succeeded. |
| 125 | */ |
| 126 | public boolean failed() { |
| 127 | return !rootCauses.isEmpty(); |
| 128 | } |
| 129 | |
Klaus Aehlig | d1f4a16 | 2016-10-25 14:51:55 +0000 | [diff] [blame] | 130 | /** Get the root causes of the target. May be empty. */ |
| 131 | public Iterable<Cause> getRootCauses() { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 132 | return rootCauses; |
| 133 | } |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 134 | |
| 135 | @Override |
| 136 | public BuildEventId getEventId() { |
Klaus Aehlig | ebec925 | 2017-06-27 17:29:50 +0200 | [diff] [blame] | 137 | BuildConfiguration config = getTarget().getConfiguration(); |
| 138 | BuildEventId configId = |
| 139 | config == null ? BuildEventId.nullConfigurationId() : config.getEventId(); |
| 140 | return BuildEventId.targetCompleted(getTarget().getLabel(), configId); |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public Collection<BuildEventId> getChildrenEvents() { |
| 145 | ImmutableList.Builder childrenBuilder = ImmutableList.builder(); |
| 146 | for (Cause cause : getRootCauses()) { |
| 147 | childrenBuilder.add(BuildEventId.fromCause(cause)); |
| 148 | } |
Klaus Aehlig | 6f97850 | 2016-11-30 12:12:56 +0000 | [diff] [blame] | 149 | if (isTest) { |
Klaus Aehlig | 1f452c3 | 2017-02-02 10:19:15 +0000 | [diff] [blame] | 150 | // For tests, announce all the test actions that will minimally happen (except for |
| 151 | // interruption). If after the result of a test action another attempt is necessary, |
| 152 | // it will be announced with the action that made the new attempt necessary. |
| 153 | Label label = target.getTarget().getLabel(); |
| 154 | TestProvider.TestParams params = target.getProvider(TestProvider.class).getTestParams(); |
| 155 | for (int run = 0; run < Math.max(params.getRuns(), 1); run++) { |
| 156 | for (int shard = 0; shard < Math.max(params.getShards(), 1); shard++) { |
Klaus Aehlig | ae5c14c | 2017-05-09 08:27:38 -0400 | [diff] [blame] | 157 | childrenBuilder.add( |
| 158 | BuildEventId.testResult(label, run, shard, target.getConfiguration().getEventId())); |
Klaus Aehlig | 1f452c3 | 2017-02-02 10:19:15 +0000 | [diff] [blame] | 159 | } |
| 160 | } |
Klaus Aehlig | ae5c14c | 2017-05-09 08:27:38 -0400 | [diff] [blame] | 161 | childrenBuilder.add(BuildEventId.testSummary(label, target.getConfiguration().getEventId())); |
Klaus Aehlig | 8d25362 | 2016-11-02 17:24:46 +0000 | [diff] [blame] | 162 | } |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 163 | return childrenBuilder.build(); |
| 164 | } |
| 165 | |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 166 | // TODO(aehlig): remove as soon as we managed to get rid of the deprecated "important_output" |
| 167 | // field. |
| 168 | private static void addImportantOutputs( |
| 169 | BuildEventStreamProtos.TargetComplete.Builder builder, |
| 170 | BuildEventConverters converters, |
| 171 | Iterable<Artifact> artifacts) { |
| 172 | for (Artifact artifact : artifacts) { |
| 173 | String name = artifact.getPath().relativeTo(artifact.getRoot().getPath()).getPathString(); |
| 174 | String uri = converters.pathConverter().apply(artifact.getPath()); |
| 175 | builder.addImportantOutput(File.newBuilder().setName(name).setUri(uri).build()); |
| 176 | } |
| 177 | } |
| 178 | |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 179 | @Override |
aehlig | 617bb89 | 2017-04-04 15:03:23 +0000 | [diff] [blame] | 180 | public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 181 | BuildEventStreamProtos.TargetComplete.Builder builder = |
| 182 | BuildEventStreamProtos.TargetComplete.newBuilder(); |
| 183 | |
| 184 | builder.setSuccess(!failed()); |
Klaus Aehlig | 6fcc00f | 2017-04-27 16:58:24 +0200 | [diff] [blame] | 185 | builder.setTargetKind(target.getTarget().getTargetKind()); |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 186 | builder.addAllTag(getTags()); |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 187 | builder.addAllOutputGroup(getOutputFilesByGroup(converters.artifactGroupNamer())); |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 188 | |
Klaus Aehlig | 10da466 | 2017-06-27 15:36:27 +0200 | [diff] [blame] | 189 | if (isTest) { |
| 190 | builder.setTestSize( |
Klaus Aehlig | 2a92c90 | 2017-08-11 14:03:31 +0200 | [diff] [blame] | 191 | TargetConfiguredEvent.bepTestSize( |
| 192 | TestSize.getTestSize(target.getTarget().getAssociatedRule()))); |
Klaus Aehlig | 10da466 | 2017-06-27 15:36:27 +0200 | [diff] [blame] | 193 | } |
| 194 | |
Klaus Aehlig | 0a6cd62 | 2017-04-21 17:09:40 +0200 | [diff] [blame] | 195 | // TODO(aehlig): remove direct reporting of artifacts as soon as clients no longer |
| 196 | // need it. |
| 197 | for (ArtifactsInOutputGroup group : outputs) { |
| 198 | if (group.areImportant()) { |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 199 | addImportantOutputs(builder, converters, group.getArtifacts()); |
Klaus Aehlig | 0a6cd62 | 2017-04-21 17:09:40 +0200 | [diff] [blame] | 200 | } |
| 201 | } |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 202 | if (baselineCoverageArtifacts != null) { |
| 203 | addImportantOutputs(builder, converters, baselineCoverageArtifacts); |
| 204 | } |
Klaus Aehlig | 0a6cd62 | 2017-04-21 17:09:40 +0200 | [diff] [blame] | 205 | |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 206 | BuildEventStreamProtos.TargetComplete complete = builder.build(); |
Klaus Aehlig | 8a8a7fc | 2016-10-26 14:27:48 +0000 | [diff] [blame] | 207 | return GenericBuildEvent.protoChaining(this).setCompleted(complete).build(); |
| 208 | } |
Klaus Aehlig | 74d716b | 2016-11-23 12:38:24 +0000 | [diff] [blame] | 209 | |
| 210 | @Override |
| 211 | public Collection<BuildEventId> postedAfter() { |
| 212 | return postedAfter; |
| 213 | } |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 214 | |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 215 | @Override |
| 216 | public Collection<NestedSet<Artifact>> reportedArtifacts() { |
| 217 | ImmutableSet.Builder<NestedSet<Artifact>> builder = |
| 218 | new ImmutableSet.Builder<NestedSet<Artifact>>(); |
| 219 | for (ArtifactsInOutputGroup artifactsInGroup : outputs) { |
| 220 | builder.add(artifactsInGroup.getArtifacts()); |
| 221 | } |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 222 | if (baselineCoverageArtifacts != null) { |
| 223 | builder.add(baselineCoverageArtifacts); |
| 224 | } |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 225 | return builder.build(); |
| 226 | } |
| 227 | |
Klaus Aehlig | 71c993b | 2017-05-09 07:49:46 -0400 | [diff] [blame] | 228 | @Override |
Klaus Aehlig | a708a02 | 2017-07-11 12:54:40 +0200 | [diff] [blame] | 229 | public Collection<BuildEvent> getConfigurations() { |
Klaus Aehlig | 71c993b | 2017-05-09 07:49:46 -0400 | [diff] [blame] | 230 | BuildConfiguration configuration = target.getConfiguration(); |
| 231 | if (configuration != null) { |
| 232 | return ImmutableList.of(target.getConfiguration()); |
| 233 | } else { |
Klaus Aehlig | a708a02 | 2017-07-11 12:54:40 +0200 | [diff] [blame] | 234 | return ImmutableList.<BuildEvent>of(); |
Klaus Aehlig | 71c993b | 2017-05-09 07:49:46 -0400 | [diff] [blame] | 235 | } |
| 236 | } |
| 237 | |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 238 | private Iterable<String> getTags() { |
| 239 | // We are only interested in targets that are rules. |
| 240 | if (!(target instanceof RuleConfiguredTarget)) { |
| 241 | return ImmutableList.<String>of(); |
| 242 | } |
| 243 | AttributeMap attributes = ConfiguredAttributeMapper.of((RuleConfiguredTarget) target); |
| 244 | // Every rule (implicitly) has a "tags" attribute. |
| 245 | return attributes.get("tags", Type.STRING_LIST); |
| 246 | } |
| 247 | |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 248 | private Iterable<OutputGroup> getOutputFilesByGroup(ArtifactGroupNamer namer) { |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 249 | ImmutableList.Builder<OutputGroup> groups = ImmutableList.builder(); |
| 250 | for (ArtifactsInOutputGroup artifactsInOutputGroup : outputs) { |
| 251 | OutputGroup.Builder groupBuilder = OutputGroup.newBuilder(); |
| 252 | groupBuilder.setName(artifactsInOutputGroup.getOutputGroup()); |
Klaus Aehlig | 4901d8b | 2017-04-10 15:13:59 +0000 | [diff] [blame] | 253 | groupBuilder.addFileSets( |
| 254 | namer.apply( |
| 255 | (new NestedSetView<Artifact>(artifactsInOutputGroup.getArtifacts())).identifier())); |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 256 | groups.add(groupBuilder.build()); |
| 257 | } |
Klaus Aehlig | cba24ab | 2017-09-27 05:14:11 -0400 | [diff] [blame^] | 258 | if (baselineCoverageArtifacts != null) { |
| 259 | groups.add( |
| 260 | OutputGroup.newBuilder() |
| 261 | .setName(TestFileNameConstants.BASELINE_COVERAGE) |
| 262 | .addFileSets( |
| 263 | namer.apply( |
| 264 | (new NestedSetView<Artifact>(baselineCoverageArtifacts).identifier()))) |
| 265 | .build()); |
| 266 | } |
Jakob Buchgraber | fb64609 | 2017-02-27 18:53:25 +0000 | [diff] [blame] | 267 | return groups.build(); |
| 268 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 269 | } |