Remove unused isTestRule for ObjC builds This was likely left over from before rules_apple was split out. This was never set to true. Closes #12446. PiperOrigin-RevId: 342052250
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 6cc0b8c..2cdaa43 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
@@ -176,16 +176,6 @@ private static final String NO_ENABLE_MODULES_FEATURE_NAME = "no_enable_modules"; private static final String DEAD_STRIP_FEATURE_NAME = "dead_strip"; - /** - * Enabled if this target's rule is not a test rule. Binary stripping should not be applied in the - * link step. TODO(b/36562173): Replace this behavior with a condition on bundle creation. - * - * <p>Note that the crosstool does not support feature negation in FlagSet.with_feature, which is - * the mechanism used to condition linker arguments here. Therefore, we expose - * "is_not_test_target" instead of the more intuitive "is_test_target". - */ - private static final String IS_NOT_TEST_TARGET_FEATURE_NAME = "is_not_test_target"; - private static final String GENERATE_LINKMAP_FEATURE_NAME = "generate_linkmap"; private static final String XCODE_VERSION_FEATURE_NAME_PREFIX = "xcode_"; @@ -556,9 +546,6 @@ if (getPchFile().isPresent()) { activatedCrosstoolSelectables.add("pch"); } - if (!isTestRule) { - activatedCrosstoolSelectables.add(IS_NOT_TEST_TARGET_FEATURE_NAME); - } if (objcConfiguration.generateDsym()) { activatedCrosstoolSelectables.add(CppRuleClasses.GENERATE_DSYM_FILE_FEATURE_NAME); } else { @@ -688,7 +675,6 @@ private final Map<String, NestedSet<Artifact>> outputGroupCollector; private final ImmutableList.Builder<Artifact> objectFilesCollector; private final CcToolchainProvider toolchain; - private final boolean isTestRule; private final boolean usePch; private final IncludeProcessingType includeProcessingType; private Optional<ObjcProvider> objcProvider; @@ -724,7 +710,6 @@ Map<String, NestedSet<Artifact>> outputGroupCollector, ImmutableList.Builder<Artifact> objectFilesCollector, CcToolchainProvider toolchain, - boolean isTestRule, boolean usePch) throws InterruptedException { this.ruleContext = ruleContext; @@ -733,7 +718,6 @@ this.appleConfiguration = buildConfiguration.getFragment(AppleConfiguration.class); this.attributes = compilationAttributes; this.intermediateArtifacts = intermediateArtifacts; - this.isTestRule = isTestRule; this.outputGroupCollector = outputGroupCollector; this.objectFilesCollector = objectFilesCollector; this.objcProvider = Optional.absent(); @@ -763,7 +747,6 @@ private Map<String, NestedSet<Artifact>> outputGroupCollector; private ImmutableList.Builder<Artifact> objectFilesCollector; private CcToolchainProvider toolchain; - private boolean isTestRule = false; private boolean usePch = true; /** Sets the {@link RuleContext} for the calling target. */ @@ -799,12 +782,6 @@ return this; } - /** Indicates that this CompilationSupport is for use in a test rule. */ - public Builder setIsTestRule() { - this.isTestRule = true; - return this; - } - /** * Causes the provided map to be updated with output groups produced by compile action * registration. @@ -873,7 +850,6 @@ outputGroupCollector, objectFilesCollector, toolchain, - isTestRule, usePch); } } @@ -894,7 +870,7 @@ NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER), // The COVERAGE_GCOV_PATH environment variable is added in TestSupport#getExtraProviders() NestedSetBuilder.<Pair<String, String>>emptySet(Order.COMPILE_ORDER), - !isTestRule, + /* withBaselineCoverage= */ true, /* reportedToActualSources= */ NestedSetBuilder.create(Order.STABLE_ORDER)); } @@ -1577,23 +1553,17 @@ */ private void registerBinaryStripAction(Artifact binaryToLink, StrippingType strippingType) { final ImmutableList<String> stripArgs; - if (isTestRule) { - // For test targets, only debug symbols are stripped off, since /usr/bin/strip is not able - // to strip off all symbols in XCTest bundle. - stripArgs = ImmutableList.of("-S"); - } else { - switch (strippingType) { - case DYNAMIC_LIB: - case KERNEL_EXTENSION: - // For dylibs and kexts, must strip only local symbols. - stripArgs = ImmutableList.of("-x"); - break; - case DEFAULT: - stripArgs = ImmutableList.<String>of(); - break; - default: - throw new IllegalArgumentException("Unsupported stripping type " + strippingType); - } + switch (strippingType) { + case DYNAMIC_LIB: + case KERNEL_EXTENSION: + // For dylibs and kexts, must strip only local symbols. + stripArgs = ImmutableList.of("-x"); + break; + case DEFAULT: + stripArgs = ImmutableList.<String>of(); + break; + default: + throw new IllegalArgumentException("Unsupported stripping type " + strippingType); } Artifact strippedBinary = intermediateArtifacts.strippedSingleArchitectureBinary();
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl b/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl index 096d847..0668a40 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl +++ b/src/test/java/com/google/devtools/build/lib/packages/util/mock/osx_cc_toolchain_config.bzl
@@ -7487,7 +7487,6 @@ flags = ["-dead_strip", "-no_dead_strip_inits_and_terms"], ), ], - with_features = [with_feature_set(features = ["is_not_test_target"])], ), flag_set( actions = [ @@ -7564,8 +7563,6 @@ dbg_feature = feature(name = "dbg", implies = ["dbg_only_flag"]) - is_not_test_target_feature = feature(name = "is_not_test_target") - xcode_5_8_feature = feature( name = "xcode_5.8", flag_sets = [ @@ -7882,7 +7879,6 @@ language_objc_feature, language_feature, only_doth_headers_in_module_maps_feature, - is_not_test_target_feature, generate_dsym_file_feature, no_generate_debug_symbols_feature, generate_linkmap_feature,