14
14
15
15
package com .google .devtools .build .lib .analysis .actions ;
16
16
17
+ import static com .google .common .collect .ImmutableSet .toImmutableSet ;
17
18
import static com .google .devtools .build .lib .actions .ActionAnalysisMetadata .mergeMaps ;
18
19
import static com .google .devtools .build .lib .packages .ExecGroup .DEFAULT_EXEC_GROUP_NAME ;
19
20
@@ -103,7 +104,7 @@ public interface ExtraActionInfoSupplier {
103
104
104
105
private static final String GUID = "ebd6fce3-093e-45ee-adb6-bf513b602f0d" ;
105
106
106
- public static final Interner <ImmutableSortedMap <String , String >> executionInfoInterner =
107
+ private static final Interner <ImmutableSortedMap <String , String >> executionInfoInterner =
107
108
BlazeInterners .newWeakInterner ();
108
109
109
110
private final CommandLines commandLines ;
@@ -118,7 +119,6 @@ public interface ExtraActionInfoSupplier {
118
119
private final ImmutableMap <String , String > executionInfo ;
119
120
120
121
private final ExtraActionInfoSupplier extraActionInfoSupplier ;
121
- private final Artifact primaryOutput ;
122
122
private final Consumer <Pair <ActionExecutionContext , List <SpawnResult >>> resultConsumer ;
123
123
private final boolean stripOutputPaths ;
124
124
@@ -132,7 +132,6 @@ public interface ExtraActionInfoSupplier {
132
132
* @param inputs the set of all files potentially read by this action; must not be subsequently
133
133
* modified.
134
134
* @param outputs the set of all files written by this action; must not be subsequently modified.
135
- * @param primaryOutput the primary output of this action
136
135
* @param resourceSetOrBuilder the resources consumed by executing this Action.
137
136
* @param env the action environment
138
137
* @param commandLines the command lines to execute. This includes the main argv vector and any
@@ -148,7 +147,6 @@ public SpawnAction(
148
147
NestedSet <Artifact > tools ,
149
148
NestedSet <Artifact > inputs ,
150
149
Iterable <Artifact > outputs ,
151
- Artifact primaryOutput ,
152
150
ResourceSetOrBuilder resourceSetOrBuilder ,
153
151
CommandLines commandLines ,
154
152
CommandLineLimits commandLineLimits ,
@@ -161,7 +159,6 @@ public SpawnAction(
161
159
tools ,
162
160
inputs ,
163
161
outputs ,
164
- primaryOutput ,
165
162
resourceSetOrBuilder ,
166
163
commandLines ,
167
164
commandLineLimits ,
@@ -188,7 +185,6 @@ public SpawnAction(
188
185
* @param inputs the set of all files potentially read by this action; must not be subsequently
189
186
* modified
190
187
* @param outputs the set of all files written by this action; must not be subsequently modified.
191
- * @param primaryOutput the primary output of this action
192
188
* @param resourceSetOrBuilder the resources consumed by executing this Action.
193
189
* @param env the action's environment
194
190
* @param executionInfo out-of-band information for scheduling the spawn
@@ -206,7 +202,6 @@ public SpawnAction(
206
202
NestedSet <Artifact > tools ,
207
203
NestedSet <Artifact > inputs ,
208
204
Iterable <? extends Artifact > outputs ,
209
- Artifact primaryOutput ,
210
205
ResourceSetOrBuilder resourceSetOrBuilder ,
211
206
CommandLines commandLines ,
212
207
CommandLineLimits commandLineLimits ,
@@ -221,7 +216,6 @@ public SpawnAction(
221
216
Consumer <Pair <ActionExecutionContext , List <SpawnResult >>> resultConsumer ,
222
217
boolean stripOutputPaths ) {
223
218
super (owner , tools , inputs , runfilesSupplier , outputs , env );
224
- this .primaryOutput = primaryOutput ;
225
219
this .resourceSetOrBuilder = resourceSetOrBuilder ;
226
220
this .executionInfo =
227
221
executionInfo .isEmpty ()
@@ -238,11 +232,6 @@ public SpawnAction(
238
232
this .stripOutputPaths = stripOutputPaths ;
239
233
}
240
234
241
- @ Override
242
- public Artifact getPrimaryOutput () {
243
- return primaryOutput ;
244
- }
245
-
246
235
@ VisibleForTesting
247
236
public CommandLines getCommandLines () {
248
237
return commandLines ;
@@ -261,12 +250,10 @@ public List<String> getArguments() throws CommandLineExpansionException, Interru
261
250
}
262
251
263
252
@ Override
264
- public Sequence <CommandLineArgsApi > getStarlarkArgs () throws EvalException {
253
+ public Sequence <CommandLineArgsApi > getStarlarkArgs () {
265
254
ImmutableList .Builder <CommandLineArgsApi > result = ImmutableList .builder ();
266
255
ImmutableSet <Artifact > directoryInputs =
267
- getInputs ().toList ().stream ()
268
- .filter (artifact -> artifact .isDirectory ())
269
- .collect (ImmutableSet .toImmutableSet ());
256
+ getInputs ().toList ().stream ().filter (Artifact ::isDirectory ).collect (toImmutableSet ());
270
257
271
258
for (CommandLineAndParamFileInfo commandLine : commandLines .getCommandLines ()) {
272
259
result .add (Args .forRegisteredAction (commandLine , directoryInputs ));
@@ -536,7 +523,7 @@ public ExtraActionInfo.Builder getExtraActionInfo(ActionKeyContext actionKeyCont
536
523
* <p>Subclasses of SpawnAction may override this in order to provide action-specific behaviour.
537
524
* This can be necessary, for example, when the action discovers inputs.
538
525
*/
539
- protected SpawnInfo getExtraActionSpawnInfo ()
526
+ private SpawnInfo getExtraActionSpawnInfo ()
540
527
throws CommandLineExpansionException , InterruptedException {
541
528
SpawnInfo .Builder info = SpawnInfo .newBuilder ();
542
529
Spawn spawn = getSpawnForExtraAction ();
@@ -601,7 +588,7 @@ private ActionSpawn(
601
588
throws CommandLineExpansionException {
602
589
super (
603
590
arguments ,
604
- ImmutableMap .< String , String > of (),
591
+ ImmutableMap .of (),
605
592
parent .getExecutionInfo (),
606
593
parent .getRunfilesSupplier (),
607
594
parent ,
@@ -805,8 +792,7 @@ private SpawnAction buildSpawnAction(
805
792
owner ,
806
793
tools ,
807
794
inputsAndTools ,
808
- ImmutableList .copyOf (outputs ),
809
- outputs .get (0 ),
795
+ ImmutableSet .copyOf (outputs ),
810
796
resourceSetOrBuilder ,
811
797
commandLines ,
812
798
commandLineLimits ,
@@ -826,8 +812,7 @@ protected SpawnAction createSpawnAction(
826
812
ActionOwner owner ,
827
813
NestedSet <Artifact > tools ,
828
814
NestedSet <Artifact > inputsAndTools ,
829
- ImmutableList <Artifact > outputs ,
830
- Artifact primaryOutput ,
815
+ ImmutableSet <Artifact > outputs ,
831
816
ResourceSetOrBuilder resourceSetOrBuilder ,
832
817
CommandLines commandLines ,
833
818
CommandLineLimits commandLineLimits ,
@@ -843,7 +828,6 @@ protected SpawnAction createSpawnAction(
843
828
tools ,
844
829
inputsAndTools ,
845
830
outputs ,
846
- primaryOutput ,
847
831
resourceSetOrBuilder ,
848
832
commandLines ,
849
833
commandLineLimits ,
@@ -949,13 +933,6 @@ public Builder addOutputs(Iterable<Artifact> artifacts) {
949
933
return this ;
950
934
}
951
935
952
- /**
953
- * Checks whether the action produces any outputs
954
- */
955
- public boolean hasOutputs () {
956
- return !outputs .isEmpty ();
957
- }
958
-
959
936
/**
960
937
* Sets RecourceSet for builder. If ResourceSetBuilder set, then ResourceSetBuilder will
961
938
* override setResources.
0 commit comments