Do not make generated files mandatory deps for ObjC compile when header
thinning is enabled.
@@ -103,24 +103,25 @@ public class ObjcCppSemantics implements CppSemantics {
actionBuilder.addTransitiveMandatoryInputs(objcProvider.get(STATIC_FRAMEWORK_FILE));
actionBuilder.addTransitiveMandatoryInputs(objcProvider.get(DYNAMIC_FRAMEWORK_FILE));
- ImmutableSet.Builder<Artifact> generatedHeaders = ImmutableSet.builder();
-
+ if (isHeaderThinningEnabled) {
+ Artifact sourceFile = actionBuilder.getSourceFile();
+ if (!sourceFile.isTreeArtifact()
+ && SOURCES_FOR_HEADER_THINNING.matches(sourceFile.getFilename())) {
+ actionBuilder.addMandatoryInputs(
+ ImmutableList.of(intermediateArtifacts.headersListFile(sourceFile)));
+ }
+ } else {
+ // Header thinning feature will make all generated files mandatory inputs to the
+ // ObjcHeaderScanning action so this is only required when that is disabled
// TODO(b/62060839): Identify the mechanism used to add generated headers in c++, and recycle
// it here.
+ ImmutableSet.Builder<Artifact> generatedHeaders = ImmutableSet.builder();
for (Artifact header : objcProvider.get(HEADER)) {
if (!header.isSourceArtifact()) {
generatedHeaders.add(header);
}
}
actionBuilder.addMandatoryInputs(generatedHeaders.build());
-
- if (isHeaderThinningEnabled) {
- Artifact sourceFile = actionBuilder.getSourceFile();
- if (!sourceFile.isTreeArtifact()
- && SOURCES_FOR_HEADER_THINNING.matches(sourceFile.getFilename())) {
- actionBuilder.addMandatoryInputs(
- ImmutableList.of(intermediateArtifacts.headersListFile(sourceFile)));
- }
}
}
