23
23
import com .google .common .collect .ImmutableSet ;
24
24
import com .google .devtools .build .lib .actions .ActionExecutionContext ;
25
25
import com .google .devtools .build .lib .actions .ActionExecutionException ;
26
- import com .google .devtools .build .lib .actions .ActionInput ;
27
26
import com .google .devtools .build .lib .actions .ActionOwner ;
28
27
import com .google .devtools .build .lib .actions .Artifact ;
29
28
import com .google .devtools .build .lib .actions .ArtifactResolver ;
30
29
import com .google .devtools .build .lib .actions .Executor ;
31
30
import com .google .devtools .build .lib .actions .PackageRootResolutionException ;
32
31
import com .google .devtools .build .lib .actions .PackageRootResolver ;
33
32
import com .google .devtools .build .lib .actions .ResourceSet ;
34
- import com .google .devtools .build .lib .actions .Spawn ;
35
33
import com .google .devtools .build .lib .analysis .actions .CommandLine ;
36
34
import com .google .devtools .build .lib .analysis .actions .SpawnAction ;
37
35
import com .google .devtools .build .lib .collect .nestedset .NestedSet ;
42
40
import com .google .devtools .build .lib .rules .apple .AppleConfiguration ;
43
41
import com .google .devtools .build .lib .rules .apple .Platform ;
44
42
import com .google .devtools .build .lib .rules .cpp .CppCompileAction .DotdFile ;
45
- import com .google .devtools .build .lib .rules .cpp .CppFileTypes ;
46
43
import com .google .devtools .build .lib .rules .cpp .HeaderDiscovery ;
47
44
import com .google .devtools .build .lib .rules .cpp .HeaderDiscovery .DotdPruningMode ;
48
45
import com .google .devtools .build .lib .rules .cpp .IncludeScanningContext ;
69
66
*/
70
67
public class ObjcCompileAction extends SpawnAction {
71
68
72
- /**
73
- * A spawn that provides all headers to sandboxed execution to allow pruned headers to be
74
- * re-introduced into action inputs.
75
- */
76
- public class ObjcCompileActionSpawn extends ActionSpawn {
77
-
78
- public ObjcCompileActionSpawn (Map <String , String > clientEnv ) {
79
- super (clientEnv );
80
- }
81
-
82
- @ Override
83
- public Iterable <? extends ActionInput > getInputFiles () {
84
- ImmutableList .Builder <ActionInput > inputs = ImmutableList .<ActionInput >builder ()
85
- .addAll (super .getInputFiles ());
86
-
87
- for (Artifact headerArtifact : headers ) {
88
- if (CppFileTypes .OBJC_HEADER .matches (headerArtifact .getFilename ())) {
89
- inputs .add (headerArtifact );
90
- }
91
- }
92
- return inputs .build ();
93
- }
94
- }
95
-
96
69
private final DotdFile dotdFile ;
97
70
private final Artifact sourceFile ;
98
71
private final NestedSet <Artifact > mandatoryInputs ;
99
72
private final HeaderDiscovery .DotdPruningMode dotdPruningPlan ;
100
- private final NestedSet <Artifact > headers ;
101
73
102
74
// This can be read/written from multiple threads, so accesses must be synchronized.
103
75
@ GuardedBy ("this" )
@@ -122,8 +94,7 @@ private ObjcCompileAction(
122
94
DotdFile dotdFile ,
123
95
Artifact sourceFile ,
124
96
NestedSet <Artifact > mandatoryInputs ,
125
- HeaderDiscovery .DotdPruningMode dotdPruningPlan ,
126
- NestedSet <Artifact > headers ) {
97
+ HeaderDiscovery .DotdPruningMode dotdPruningPlan ) {
127
98
super (
128
99
owner ,
129
100
tools ,
@@ -144,7 +115,6 @@ private ObjcCompileAction(
144
115
this .sourceFile = sourceFile ;
145
116
this .mandatoryInputs = mandatoryInputs ;
146
117
this .dotdPruningPlan = dotdPruningPlan ;
147
- this .headers = headers ;
148
118
this .inputsKnown = (dotdPruningPlan == DotdPruningMode .DO_NOT_USE );
149
119
}
150
120
@@ -154,11 +124,6 @@ public HeaderDiscovery.DotdPruningMode getDotdPruningPlan() {
154
124
return dotdPruningPlan ;
155
125
}
156
126
157
- @ Override
158
- public final Spawn getSpawn (Map <String , String > clientEnv ) {
159
- return new ObjcCompileActionSpawn (clientEnv );
160
- }
161
-
162
127
@ Override
163
128
public synchronized boolean inputsKnown () {
164
129
return inputsKnown ;
@@ -171,7 +136,8 @@ public boolean discoversInputs() {
171
136
172
137
@ Override
173
138
public Iterable <Artifact > discoverInputs (ActionExecutionContext actionExecutionContext ) {
174
- return headers ;
139
+ // We do not use include scanning for objc
140
+ return null ;
175
141
}
176
142
177
143
// Keep in sync with {@link CppCompileAction#resolveInputsFromCache}
@@ -330,7 +296,6 @@ public static class Builder extends SpawnAction.Builder {
330
296
private Artifact sourceFile ;
331
297
private final NestedSetBuilder <Artifact > mandatoryInputs = new NestedSetBuilder <>(STABLE_ORDER );
332
298
private HeaderDiscovery .DotdPruningMode dotdPruningPlan ;
333
- private NestedSetBuilder <Artifact > headers = NestedSetBuilder .stableOrder ();
334
299
335
300
/**
336
301
* Creates a new compile action builder with apple environment variables set that are typically
@@ -398,20 +363,6 @@ public Builder setDotdPruningPlan(HeaderDiscovery.DotdPruningMode dotdPruningPla
398
363
this .dotdPruningPlan = dotdPruningPlan ;
399
364
return this ;
400
365
}
401
-
402
- /** Adds to the set of all possible headers that could be required by this compile action. */
403
- public Builder addTransitiveHeaders (NestedSet <Artifact > headers ) {
404
- this .headers .addTransitive (Preconditions .checkNotNull (headers ));
405
- this .addTransitiveInputs (headers );
406
- return this ;
407
- }
408
-
409
- /** Adds to the set of all possible headers that could be required by this compile action. */
410
- public Builder addHeaders (Iterable <Artifact > headers ) {
411
- this .headers .addAll (Preconditions .checkNotNull (headers ));
412
- this .addInputs (headers );
413
- return this ;
414
- }
415
366
416
367
@ Override
417
368
protected SpawnAction createSpawnAction (
@@ -444,8 +395,7 @@ protected SpawnAction createSpawnAction(
444
395
dotdFile ,
445
396
sourceFile ,
446
397
mandatoryInputs .build (),
447
- dotdPruningPlan ,
448
- headers .build ());
398
+ dotdPruningPlan );
449
399
}
450
400
}
451
401
}
0 commit comments