diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java index 34a33b1f8f9beb..bff253007590a9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java @@ -189,12 +189,6 @@ public class CompilationSupport { "c-compile", "c++-compile"); - /** The kind of include processing to use. */ - enum IncludeProcessingType { - INCLUDE_SCANNING, - NO_PROCESSING; - } - /** Returns the location of the xcrunwrapper tool. */ public static final FilesToRunProvider xcrunwrapper(RuleContext ruleContext) { return ruleContext.getExecutablePrerequisite("$xcrunwrapper"); @@ -531,8 +525,6 @@ private CompilationResult ccCompileAndLink( ObjcCppSemantics createObjcCppSemantics() { return new ObjcCppSemantics( - includeProcessingType, - ruleContext.getFragment(ObjcConfiguration.class), intermediateArtifacts, buildConfiguration, attributes.enableModules()); @@ -734,7 +726,6 @@ static ImmutableList frameworkLibrarySearchPaths(ObjcProvider provider) private final boolean usePch; private final boolean disableLayeringCheck; private final boolean disableParseHeaders; - private final IncludeProcessingType includeProcessingType; private Optional ccCompilationContext; private void setCcCompilationContext(CcCompilationContext ccCompilationContext) { @@ -792,12 +783,6 @@ private CompilationSupport( } this.toolchain = toolchain; - - if (objcConfiguration.shouldScanIncludes()) { - includeProcessingType = IncludeProcessingType.INCLUDE_SCANNING; - } else { - includeProcessingType = IncludeProcessingType.NO_PROCESSING; - } } /** Builder for {@link CompilationSupport} */ diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCppSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCppSemantics.java index 6b52d351f9ba7f..f20d0a1e584df3 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCppSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCppSemantics.java @@ -14,8 +14,6 @@ package com.google.devtools.build.lib.rules.objc; -import static com.google.devtools.build.lib.rules.objc.CompilationSupport.IncludeProcessingType.INCLUDE_SCANNING; - import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.RuleErrorConsumer; @@ -31,15 +29,12 @@ import com.google.devtools.build.lib.rules.cpp.CppConfiguration.HeadersCheckingMode; import com.google.devtools.build.lib.rules.cpp.CppSemantics; import com.google.devtools.build.lib.rules.cpp.HeaderDiscovery.DotdPruningMode; -import com.google.devtools.build.lib.rules.objc.CompilationSupport.IncludeProcessingType; /** * CppSemantics for objc builds. */ public class ObjcCppSemantics implements CppSemantics { - private final IncludeProcessingType includeProcessingType; - private final ObjcConfiguration config; private final IntermediateArtifacts intermediateArtifacts; private final BuildConfiguration buildConfiguration; private final boolean enableModules; @@ -47,20 +42,14 @@ public class ObjcCppSemantics implements CppSemantics { /** * Creates an instance of ObjcCppSemantics * - * @param includeProcessingType The type of include processing to be run. - * @param config the ObjcConfiguration for this build * @param intermediateArtifacts used to create headers_list artifacts * @param buildConfiguration the build configuration for this build * @param enableModules whether modules are enabled */ public ObjcCppSemantics( - IncludeProcessingType includeProcessingType, - ObjcConfiguration config, IntermediateArtifacts intermediateArtifacts, BuildConfiguration buildConfiguration, boolean enableModules) { - this.includeProcessingType = includeProcessingType; - this.config = config; this.intermediateArtifacts = intermediateArtifacts; this.buildConfiguration = buildConfiguration; this.enableModules = enableModules; @@ -78,7 +67,8 @@ public void finalizeCompileActionBuilder( // system framework headers since they are not being scanned right now. // TODO(waltl): do better with include scanning. .addTransitiveMandatoryInputs(actionBuilder.getToolchain().getAllFilesMiddleman()) - .setShouldScanIncludes(includeProcessingType == INCLUDE_SCANNING); + .setShouldScanIncludes( + configuration.getFragment(ObjcConfiguration.class).shouldScanIncludes()); } @Override @@ -97,12 +87,13 @@ public HeadersCheckingMode determineStarlarkHeadersCheckingMode( @Override public boolean allowIncludeScanning() { - return includeProcessingType == IncludeProcessingType.INCLUDE_SCANNING; + return true; } @Override public boolean needsDotdInputPruning(BuildConfiguration configuration) { - return config.getDotdPruningPlan() == DotdPruningMode.USE; + return configuration.getFragment(ObjcConfiguration.class).getDotdPruningPlan() + == DotdPruningMode.USE; } @Override @@ -111,10 +102,10 @@ public void validateAttributes(RuleContext ruleContext) { @Override public boolean needsIncludeValidation() { - // We disable include valication when modules are enabled, because Apple uses absolute paths in + // We disable include validation when modules are enabled, because Apple uses absolute paths in // its module maps, which include validation does not recognize. Modules should only be used // rarely and in third party code anyways. - return (includeProcessingType == INCLUDE_SCANNING) && !enableModules; + return !enableModules; } /**