Remove dead objc setup code

This appears to be unused

Closes #12073.

RELNOTES[INC]: This removes `--objc_header_scanner_tool`. The flag was primarily used internally, and to our knowledge, a compatible tool was never released. Therefore this flag is believed to be unused.

PiperOrigin-RevId: 331152446
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractObjcRuleSet.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractObjcRuleSet.java
index 803c65a..fb69429 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractObjcRuleSet.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AbstractObjcRuleSet.java
@@ -67,7 +67,6 @@
     builder.addRuleDefinition(new ObjcRuleClasses.SdkFrameworksDependerRule());
     builder.addRuleDefinition(new ObjcRuleClasses.CompileDependencyRule());
     builder.addRuleDefinition(new ObjcRuleClasses.XcrunRule());
-    builder.addRuleDefinition(new ObjcRuleClasses.LibtoolRule());
     builder.addRuleDefinition(new ObjcRuleClasses.CrosstoolRule());
     builder.addRuleDefinition(new XcodeConfigRule());
     builder.addRuleDefinition(new XcodeConfigAliasRule());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibrary.java
index 11af0c8..bd9b2d7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibrary.java
@@ -17,7 +17,6 @@
 import static com.google.common.collect.ImmutableListMultimap.toImmutableListMultimap;
 import static com.google.devtools.build.lib.rules.objc.ObjcProvider.MULTI_ARCH_LINKED_ARCHIVES;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableListMultimap;
@@ -58,10 +57,6 @@
       ImmutableSet.<Key<?>>of(
           ObjcProvider.SDK_DYLIB, ObjcProvider.SDK_FRAMEWORK, ObjcProvider.WEAK_SDK_FRAMEWORK);
 
-  @VisibleForTesting
-  static final String UNSUPPORTED_PLATFORM_TYPE_ERROR_FORMAT =
-      "Unsupported platform type \"%s\"";
-
   @Override
   public final ConfiguredTarget create(RuleContext ruleContext)
       throws InterruptedException, RuleErrorException, ActionConflictException {
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 fb136a6..edfe6ed 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
@@ -214,11 +214,6 @@
     return ruleContext.getExecutablePrerequisite("$xcrunwrapper");
   }
 
-  /** Returns the location of the libtool tool. */
-  public static final FilesToRunProvider libtool(RuleContext ruleContext) {
-    return ruleContext.getExecutablePrerequisite(ObjcRuleClasses.LIBTOOL_ATTRIBUTE);
-  }
-
   /**
    * Files which can be instrumented along with the attributes in which they may occur and the
    * attributes along which they are propagated from dependencies (via {@link
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
index d1af19e..841e165 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
@@ -204,11 +204,6 @@
                 .exec()
                 .value(Label.parseAbsoluteUnchecked(toolsRepository + "//tools/objc:xcrunwrapper")))
         .add(
-            attr(ObjcRuleClasses.LIBTOOL_ATTRIBUTE, LABEL)
-                .cfg(HostTransition.createFactory())
-                .exec()
-                .value(Label.parseAbsoluteUnchecked(toolsRepository + "//tools/objc:libtool")))
-        .add(
             attr(XcodeConfigRule.XCODE_CONFIG_ATTR_NAME, LABEL)
                 .allowedRuleClasses("xcode_config")
                 .checkConstraints()
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryRule.java
index 9fe8d58..c961da1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcLibraryRule.java
@@ -96,7 +96,6 @@
         .ancestors(
             J2ObjcLibraryBaseRule.class,
             ObjcRuleClasses.CrosstoolRule.class,
-            ObjcRuleClasses.LibtoolRule.class,
             ObjcRuleClasses.XcrunRule.class)
         .build();
   }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
index 786ade8..a6b9838 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java
@@ -226,17 +226,6 @@
   public boolean scanIncludes;
 
   @Option(
-      name = "objc_header_scanner_tool",
-      defaultValue = "@bazel_tools//tools/objc:header_scanner",
-      converter = LabelConverter.class,
-      documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
-      effectTags = {OptionEffectTag.CHANGES_INPUTS},
-      help =
-          "Location of tool to scan Objective-C code for inclusions and output a .headers_list "
-              + "file.")
-  public Label objcHeaderScannerTool;
-
-  @Option(
     name = "apple_sdk",
     defaultValue = "null",
     converter = LabelConverter.class,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
index 4e7a14a..62f6b38 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java
@@ -20,7 +20,6 @@
 import com.google.devtools.build.lib.analysis.config.CompilationMode;
 import com.google.devtools.build.lib.analysis.config.CoreOptions;
 import com.google.devtools.build.lib.analysis.config.Fragment;
-import com.google.devtools.build.lib.cmdline.Label;
 import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
 import com.google.devtools.build.lib.rules.apple.ApplePlatform.PlatformType;
 import com.google.devtools.build.lib.rules.apple.DottedVersion;
@@ -66,7 +65,6 @@
   private final boolean enableAppleBinaryNativeProtos;
   private final HeaderDiscovery.DotdPruningMode dotdPruningPlan;
   private final boolean shouldScanIncludes;
-  private final Label appleSdk;
   private final boolean compileInfoMigration;
 
   ObjcConfiguration(
@@ -96,7 +94,6 @@
             ? HeaderDiscovery.DotdPruningMode.USE
             : HeaderDiscovery.DotdPruningMode.DO_NOT_USE;
     this.shouldScanIncludes = objcOptions.scanIncludes;
-    this.appleSdk = objcOptions.appleSdk;
     this.compileInfoMigration = objcOptions.incompatibleObjcCompileInfoMigration;
   }
 
@@ -257,11 +254,6 @@
     return shouldScanIncludes;
   }
 
-  /** Returns the label for the Apple SDK for current build configuration. */
-  public Label getAppleSdk() {
-    return appleSdk;
-  }
-
   /** Whether native rules can assume compile info has been migrated to CcInfo. */
   public boolean compileInfoMigration() {
     return compileInfoMigration;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
index f4d1fe0..b3e1b79 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
@@ -59,14 +59,6 @@
  * Shared rule classes and associated utility code for Objective-C rules.
  */
 public class ObjcRuleClasses {
-
-  /**
-   * Name of the attribute used for implicit dependency on the libtool wrapper.
-   */
-  public static final String LIBTOOL_ATTRIBUTE = "$libtool";
-  /** Name of attribute used for implicit dependency on the apple SDKs. */
-  public static final String APPLE_SDK_ATTRIBUTE = ":apple_sdk";
-
   static final String LIPO = "lipo";
   static final String STRIP = "strip";
 
@@ -510,7 +502,6 @@
               BaseRuleClasses.RuleBase.class,
               CompileDependencyRule.class,
               CoptsRule.class,
-              LibtoolRule.class,
               XcrunRule.class,
               CrosstoolRule.class)
           .build();
@@ -518,30 +509,6 @@
   }
 
   /**
-   * Common attributes for {@code objc_*} rules that need to call libtool.
-   */
-  public static class LibtoolRule implements RuleDefinition {
-    @Override
-    public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
-      return builder
-          .add(
-              attr(LIBTOOL_ATTRIBUTE, LABEL)
-                  .cfg(HostTransition.createFactory())
-                  .exec()
-                  .value(env.getToolsLabel("//tools/objc:libtool")))
-          .build();
-    }
-    @Override
-    public Metadata getMetadata() {
-      return RuleDefinition.Metadata.builder()
-          .name("$objc_libtool_rule")
-          .type(RuleClassType.ABSTRACT)
-          .ancestors(XcrunRule.class)
-          .build();
-    }
-  }
-
-  /**
    * Common attributes for {@code objc_*} rules that can optionally be set to {@code alwayslink}.
    */
   public static class AlwaysLinkRule implements RuleDefinition {
@@ -786,8 +753,7 @@
               BaseRuleClasses.RuleBase.class,
               CppRuleClasses.CcIncludeScanningRule.class,
               XcrunRule.class,
-              SdkFrameworksDependerRule.class,
-              LibtoolRule.class)
+              SdkFrameworksDependerRule.class)
           .build();
     }
   }
diff --git a/tools/objc/BUILD b/tools/objc/BUILD
index 32c5c44..0082ef7 100644
--- a/tools/objc/BUILD
+++ b/tools/objc/BUILD
@@ -1,7 +1,7 @@
-package(default_visibility = ["//visibility:public"])
-
 load("@rules_cc//cc:defs.bzl", "objc_library")
 
+package(default_visibility = ["//visibility:public"])
+
 # Files which shouldn't be publicly visible and dependencies of all objc_* or ios_* rules shouldn't be in this package.
 exports_files(glob(["**"]))
 
@@ -11,34 +11,10 @@
 )
 
 sh_binary(
-    name = "libtool",
-    srcs = [":libtool.sh"],
-    data = [
-        ":make_hashed_objlist.py",
-        ":xcrunwrapper",
-    ],
-)
-
-sh_binary(
     name = "xcrunwrapper",
     srcs = [":xcrunwrapper.sh"],
 )
 
-filegroup(
-    name = "xctest_infoplist",
-    srcs = ["XCTest-Info.plist"],
-)
-
-filegroup(
-    name = "gcov",
-    srcs = [":gcov_stub"],
-)
-
-filegroup(
-    name = "mcov",
-    srcs = [":mcov_stub"],
-)
-
 xcode_config(
     name = "host_xcodes",
 )
@@ -61,11 +37,6 @@
 )
 
 filegroup(
-    name = "protobuf_compiler",
-    srcs = ["protobuf_compiler.py"],
-)
-
-filegroup(
     name = "protobuf_compiler_support",
     srcs = ["protobuf_support"],
 )
@@ -74,9 +45,3 @@
     name = "protobuf_well_known_types",
     srcs = ["dummy.proto"],
 )
-
-# Intentionally empty
-filegroup(
-    name = "header_scanner",
-    srcs = [],
-)
diff --git a/tools/objc/XCTest-Info.plist b/tools/objc/XCTest-Info.plist
deleted file mode 100644
index 59fae03..0000000
--- a/tools/objc/XCTest-Info.plist
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>en</string>
-	<key>CFBundleDisplayName</key>
-	<string>${PRODUCT_NAME}</string>
-	<key>CFBundleExecutable</key>
-	<string>${EXECUTABLE_NAME}</string>
-	<key>CFBundleIconFiles</key>
-	<array/>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>UIFileSharingEnabled</key>
-	<true/>
-	<key>CFBundleName</key>
-	<string>${PRODUCT_NAME}</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.0.0</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>1.0.0</string>
-	<key>LSRequiresIPhoneOS</key>
-	<true/>
-	<key>UIRequiredDeviceCapabilities</key>
-	<array>
-		<string>armv7</string>
-	</array>
-	<key>UISupportedInterfaceOrientations</key>
-	<array>
-		<string>UIInterfaceOrientationPortrait</string>
-		<string>UIInterfaceOrientationLandscapeLeft</string>
-		<string>UIInterfaceOrientationLandscapeRight</string>
-	</array>
-	<key>UISupportedInterfaceOrientations~ipad</key>
-	<array>
-		<string>UIInterfaceOrientationPortrait</string>
-		<string>UIInterfaceOrientationPortraitUpsideDown</string>
-		<string>UIInterfaceOrientationLandscapeLeft</string>
-		<string>UIInterfaceOrientationLandscapeRight</string>
-	</array>
-	<key>UIRequiresFullScreen</key>
-	<true/>
-	<key>NSAppTransportSecurity</key>
-	<dict>
-		<key>NSAllowsArbitraryLoads</key>
-		<true/>
-	</dict>
-</dict>
-</plist>
\ No newline at end of file
diff --git a/tools/objc/gcov_stub b/tools/objc/gcov_stub
deleted file mode 100644
index 5764e83..0000000
--- a/tools/objc/gcov_stub
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-(
-  printf 'Bazel does not yet support coverage.\n'
-) >&2
-
-exit 1
diff --git a/tools/objc/mcov_stub b/tools/objc/mcov_stub
deleted file mode 100644
index 5764e83..0000000
--- a/tools/objc/mcov_stub
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-(
-  printf 'Bazel does not yet support coverage.\n'
-) >&2
-
-exit 1
diff --git a/tools/objc/protobuf_compiler.py b/tools/objc/protobuf_compiler.py
deleted file mode 100644
index bc99093..0000000
--- a/tools/objc/protobuf_compiler.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# pylint: disable=g-bad-file-header
-# Copyright 2016 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http:#www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Dummy python executable."""
-
-from __future__ import print_function
-
-import sys
-
-if __name__ == '__main__':
-  print('Bazel does not yet support protobuf compiling.')
-  sys.exit(1)