Remove unused apple API

These starlark methods have been deprecated for a long time, with viable
replacements, and are not used in the core iOS rules (or anywhere else I
could find). This also inlines a few helpers that were only used once
after this cleanup.

Closes #13874.

PiperOrigin-RevId: 402297894
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
index caaab4a..e4d748e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java
@@ -190,16 +190,6 @@
   }
 
   /**
-   * Returns the value of {@code ios_cpu} for this configuration. This is not necessarily the
-   * platform or cpu for all actions spawned in this configuration; it is appropriate for
-   * identifying the target cpu of iOS compile and link actions within this configuration.
-   */
-  @Override
-  public String getIosCpu() {
-    return appleCpus.iosCpu();
-  }
-
-  /**
    * Gets the single "effective" architecture for this configuration's {@link PlatformType} (for
    * example, "i386" or "arm64"). Prefer this over {@link #getMultiArchitectures(PlatformType)} only
    * if in the context of rule logic which is only concerned with a single architecture (such as in
@@ -287,10 +277,11 @@
     }
     switch (platformType) {
       case IOS:
-        if (getIosMultiCpus().isEmpty()) {
-          return ImmutableList.of(getIosCpu());
+        ImmutableList<String> cpus = appleCpus.iosMultiCpus();
+        if (cpus.isEmpty()) {
+          return ImmutableList.of(appleCpus.iosCpu());
         } else {
-          return getIosMultiCpus();
+          return cpus;
         }
       case WATCHOS:
         return appleCpus.watchosCpus();
@@ -361,44 +352,6 @@
   }
 
   /**
-   * Returns the {@link ApplePlatform} represented by {@code ios_cpu} (see {@link #getIosCpu}. (For
-   * example, {@code i386} maps to {@link ApplePlatform#IOS_SIMULATOR}.) Note that this is not
-   * necessarily the effective platform for all ios actions in the current context: This is
-   * typically the correct platform for implicityly-ios compile and link actions in the current
-   * context. For effective platform for bundling actions, see {@link
-   * #getMultiArchPlatform(PlatformType)}.
-   */
-  // TODO(b/28754442): Deprecate for more general Starlark-exposed platform retrieval.
-  @Override
-  public ApplePlatform getIosCpuPlatform() {
-    return ApplePlatform.forTarget(PlatformType.IOS, getIosCpu());
-  }
-
-  /**
-   * Returns the architecture for which we keep dependencies that should be present only once (in a
-   * single architecture).
-   *
-   * <p>When building with multiple architectures there are some dependencies we want to avoid
-   * duplicating: they would show up more than once in the same location in the final application
-   * bundle which is illegal. Instead we pick one architecture for which to keep all dependencies
-   * and discard any others.
-   */
-  public String getDependencySingleArchitecture() {
-    if (!getIosMultiCpus().isEmpty()) {
-      return getIosMultiCpus().get(0);
-    }
-    return getIosCpu();
-  }
-
-  /**
-   * List of all CPUs that this invocation is being built for. Different from {@link #getIosCpu()}
-   * which is the specific CPU <b>this target</b> is being built for.
-   */
-  public ImmutableList<String> getIosMultiCpus() {
-    return appleCpus.iosMultiCpus();
-  }
-
-  /**
    * Returns the bitcode mode to use for compilation steps. This should only be invoked in
    * single-architecture contexts.
    *
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/README.md b/src/main/java/com/google/devtools/build/lib/rules/objc/README.md
index e3a8f78..7fa2859 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/README.md
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/README.md
@@ -30,7 +30,7 @@
 
 ```
 def __impl(ctx):
-    cpu = ctx.fragments.apple.ios_cpu()
+    cpu = ctx.fragments.apple.single_arch_cpu
 my_rule = rule(
   implementation = __impl
   fragments = ['apple']
diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/AppleConfigurationApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/AppleConfigurationApi.java
index bfc84df..44ded34 100644
--- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/AppleConfigurationApi.java
+++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/apple/AppleConfigurationApi.java
@@ -31,13 +31,6 @@
     extends StarlarkValue {
 
   @StarlarkMethod(
-      name = "ios_cpu",
-      doc =
-          "<b>Deprecated. Use <a href='#single_arch_cpu'>single_arch_cpu</a> instead.</b> "
-              + "The value of ios_cpu for this configuration.")
-  String getIosCpu();
-
-  @StarlarkMethod(
       name = "single_arch_cpu",
       structField = true,
       doc =
@@ -72,14 +65,6 @@
   ApplePlatformApi getMultiArchPlatform(ApplePlatformTypeApiT platformType);
 
   @StarlarkMethod(
-      name = "ios_cpu_platform",
-      doc =
-          "<b>Deprecated. Use <a href='#single_arch_platform'>single_arch_platform</a> or "
-              + "<a href='#multi_arch_platform'>multi_arch_platform</a> instead.</b> "
-              + "The platform given by the ios_cpu flag.")
-  ApplePlatformApi getIosCpuPlatform();
-
-  @StarlarkMethod(
       name = "bitcode_mode",
       doc =
           "Returns the Bitcode mode to use for compilation steps.<p>This field is only valid for"
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
index 1884ea0..9d99922 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcStarlarkTest.java
@@ -344,8 +344,8 @@
         "load('//myinfo:myinfo.bzl', 'MyInfo')",
         "def swift_binary_impl(ctx):",
         "   xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]",
-        "   cpu = ctx.fragments.apple.ios_cpu()",
-        "   platform = ctx.fragments.apple.ios_cpu_platform()",
+        "   cpu = ctx.fragments.apple.single_arch_cpu",
+        "   platform = ctx.fragments.apple.single_arch_platform",
         "   xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]",
         "   dead_code_report = ctx.attr._dead_code_report",
         "   env = apple_common.target_apple_env(xcode_config, platform)",
@@ -529,7 +529,7 @@
         "examples/rule/apple_rules.bzl",
         "load('//myinfo:myinfo.bzl', 'MyInfo')",
         "def _test_rule_impl(ctx):",
-        "   platform = ctx.fragments.apple.ios_cpu_platform()",
+        "   platform = ctx.fragments.apple.single_arch_platform",
         "   return MyInfo(",
         "      name=platform.name_in_plist,",
         "   )",
@@ -546,7 +546,7 @@
         "   name='my_target',",
         ")");
 
-    useConfiguration("--cpu=ios_i386");
+    useConfiguration("--cpu=ios_i386", "--apple_platform_type=ios");
     ConfiguredTarget starlarkTarget = getConfiguredTarget("//examples/apple_starlark:my_target");
 
     Object name = getMyInfoFromTarget(starlarkTarget).getValue("name");