More refactor work on single-/multi- architecture accessor methods of AppleConfiguration.
Additionally, tweak single-architecture ios-platform logic such that ios_multi_cpus is checked before ios_cpu.

There are two contexts to note:
  1. Single-architecture logic, (generally post-split), unaware of its own platform type aside
    from configuration. This retrieves platform type from the --apple_platform_type configuration value.
     a. getSingleArchPlatform() for Platform retrieval
     b. getSingleArchitecture() for architecture retrieval
  2. Multi-architecture logic, which should be aware of its own platform type, and passes it into
    configuration accessors.
     a. getMultiArchPlatform(PlatformType)
     b. getMultiArchitectures(PlatformType)

All callers are migrated to these methods, though some still pass IOS platform type even though
they may need to be refactored to support additional platform types later.

--
MOS_MIGRATED_REVID=124370652
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 9fc38f0..3b9745f 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
@@ -221,45 +221,42 @@
   }
 
   /**
-   * Gets the single "effective" architecture for the given {@link PlatformType}. Prefer this over
-   * {@link #getArchitectures(PlatformType)} only in cases if in the context of a rule which
-   * is only concerned with a single architecture (such as {@code objc_library}, which registers
-   * single-architecture compile actions.
+   * 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 {@code objc_library}, which registers single-architecture compile actions).
    *
    * <p>Single effective architecture is determined using the following rules:
    * <ol>
    * <li>If {@code --apple_split_cpu} is set (done via prior configuration transition), then
-   * that is the effective architecture.</li>
-   * <li>In the case of iOS, use {@code --ios_cpu}.</li>
+   *     that is the effective architecture.</li>
+   * <li>If the multi cpus flag (e.g. {@code --ios_multi_cpus}) is set and non-empty, then the first
+   *     such architecture is returned.</li>
+   * <li>In the case of iOS, use {@code --ios_cpu} for backwards compatibility.</li>
    * <li>Use the default.</li></ol>
-   * 
-   * @throws IllegalArgumentException if {@code --apple_platform_type} is set (via prior
-   *     configuration transition) yet does not match {@code platformType}
    */
-  // TODO(cparsons): Support platform types other than iOS.
-  // TODO(b/28958783): Consider changing this behavior to be more consistent between single and
-  // multi-arch cases.
-  public String getSingleArchitecture(PlatformType platformType) {
+  public String getSingleArchitecture() {
     if (!Strings.isNullOrEmpty(appleSplitCpu)) {
-      if (applePlatformType != platformType) {
-        throw new IllegalArgumentException(
-            String.format("Expected post-split-transition platform type %s to match input %s ",
-                applePlatformType, platformType));
-      }
       return appleSplitCpu;
     }
-    switch (platformType) {
+    switch (applePlatformType) {
       case IOS:
-        return getIosCpu();
-      // TODO(cparsons): Support other platform types.
+        if (!getIosMultiCpus().isEmpty()) {
+          return getIosMultiCpus().get(0);
+        } else {
+          return getIosCpu();
+        }
+      // TODO(cparsons): Support platform types other than iOS.
       default: 
-        throw new IllegalArgumentException("Unhandled platform type " + platformType);
+        throw new IllegalArgumentException("Unhandled platform type " + applePlatformType);
     }
   }
-
+ 
   /**
    * Gets the "effective" architecture(s) for the given {@link PlatformType}. For example,
-   * "i386" or "arm64". At least one architecture is always returned.
+   * "i386" or "arm64". At least one architecture is always returned. Prefer this over
+   * {@link #getSingleArchitecture} in rule logic which may support multiple architectures, such
+   * as bundling rules.
    * 
    * <p>Effective architecture(s) is determined using the following rules:
    * <ol>
@@ -273,7 +270,7 @@
    * @throws IllegalArgumentException if {@code --apple_platform_type} is set (via prior
    *     configuration transition) yet does not match {@code platformType}
    */
-  public List<String> getArchitectures(PlatformType platformType) {
+  public List<String> getMultiArchitectures(PlatformType platformType) {
     if (!Strings.isNullOrEmpty(appleSplitCpu)) {
       if (applePlatformType != platformType) {
         throw new IllegalArgumentException(
@@ -296,39 +293,26 @@
   }
 
   /**
-   * Gets the current configuration {@link Platform} for the given {@link PlatformType}. Platform
-   * is determined via a combination between the given platform type and the "effective
-   * architecture" of this configuration, as returned by {@link #getArchitectures}. If there
-   * are multiple effective architectures, the first in the list will be used. (This handles
-   * cases where multiple architectures may be specified, for example via multi-cpu flag, though
-   * only one can be consumed for the current rule.) Consider {@link #getBundlingPlatform} as an
-   * alternative, when more than one architecture may be expected.
+   * Gets the single "effective" platform for this configuration's {@link PlatformType} and
+   * architecture. Prefer this over {@link #getMultiArchPlatform(PlatformType)}
+   * only in cases if in the context of rule logic which is only concerned with a single
+   * architecture (such as in {@code objc_library}, which registers single-architecture compile
+   * actions).
    */
-  public Platform getPlatform(PlatformType platformType) {
-    return Platform.forTarget(platformType, getSingleArchitecture(platformType));
+  public Platform getSingleArchPlatform() {
+    return Platform.forTarget(applePlatformType, getSingleArchitecture());
   }
   
   /**
-   * Returns the platform of the configuration for the current bundle for {@link PlatformType#IOS}
-   * platform type, based on configured "effective" architectures (for example, {@code i386} maps
-   * to {@link Platform#IOS_SIMULATOR}).
-   * 
-   * <p>Effective architecture(s) are determined via {@link #getArchitectures}. If there are
-   * multiple effective architectures, then returns {@link Platform#IOS_DEVICE} if any of the
-   * architectures matches it, otherwise returns {@link Platform#IOS_SIMULATOR}.
-   *
-   * <p>Note that this method is similar to, {@link #getPlatform} but different in how it handles
-   * multiple architecture scenarios. This method should be used for obtaining {@link Platform} in
-   * contexts where multiple architectures are expected, such as bundling rules.
-   *
-   * @throws IllegalArgumentException if the current build options specify architecture(s) with
-   *     no known apple platform
+   * Gets the current configuration {@link Platform} for the given {@link PlatformType}. Platform
+   * is determined via a combination between the given platform type and the "effective"
+   * architectures of this configuration, as returned by {@link #getMultiArchitectures}; if any
+   * of the supported architectures are of device type, this will return a device platform.
+   * Otherwise, this will return a simulator platform.
    */
-  // TODO(bazel-team): This method should be enabled to return multiple values once all call sites
-  // (in particular actool, bundlemerge, momc) have been upgraded to support multiple values.
-  // TODO(cparsons): Take platform type as input, supporting platforms other than IOS.
-  public Platform getBundlingPlatform() {
-    List<String> architectures = getArchitectures(PlatformType.IOS);
+  // TODO(bazel-team): This should support returning multiple platforms.
+  public Platform getMultiArchPlatform(PlatformType platformType) {
+    List<String> architectures = getMultiArchitectures(platformType);
     for (String arch : architectures) {
       if (Platform.forTarget(PlatformType.IOS, arch) == Platform.IOS_DEVICE) {
         return Platform.IOS_DEVICE;
@@ -336,18 +320,19 @@
     }
     return Platform.IOS_SIMULATOR;
   }
-  
+
   /**
    * Returns the {@link Platform} represented by {@code ios_cpu} (see {@link #getIosCpu}.
    * (For example, {@code i386} maps to {@link Platform#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 #getBundlingPlatform}.
+   * context. For effective platform for bundling actions, see
+   * {@link #getMultiArchPlatform(PlatformType)}.
    */
   // TODO(b/28754442): Deprecate for more general skylark-exposed platform retrieval.
   @SkylarkCallable(name = "ios_cpu_platform", doc = "The platform given by the ios_cpu flag.")
   public Platform getIosCpuPlatform() {
-    return getPlatform(PlatformType.IOS);
+    return Platform.forTarget(PlatformType.IOS, iosCpu);
   }
 
   /**
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java
index a2bbaa1..097f24f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/AppleToolchain.java
@@ -33,7 +33,6 @@
 import com.google.devtools.build.lib.packages.RuleClass;
 import com.google.devtools.build.lib.packages.RuleClass.Builder;
 import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
-import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
 import com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos.XcodeprojBuildSetting;
@@ -82,12 +81,11 @@
           .build();
 
   /**
-   * Returns the platform plist name (for example, iPhoneSimulator) for the platform corresponding
-   * to the value of {@code --ios_cpu} in the given configuration.
+   * Returns the platform plist name (for example, iPhoneSimulator) for the single-arch-context
+   * apple platform specified in the configuration.
    */
-  // TODO(bazel-team): Support non-ios platforms.
   public static String getPlatformPlistName(AppleConfiguration configuration) {
-    return configuration.getPlatform(PlatformType.IOS).getNameInPlist();
+    return configuration.getSingleArchPlatform().getNameInPlist();
   }
 
   /**
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java
index ec64b37..e7dba73 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/AppleBinary.java
@@ -30,7 +30,6 @@
 import com.google.devtools.build.lib.packages.Attribute.SplitTransition;
 import com.google.devtools.build.lib.packages.Attribute.SplitTransitionProvider;
 import com.google.devtools.build.lib.packages.Rule;
-import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
 import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory;
 import com.google.devtools.build.lib.rules.apple.AppleCommandLineOptions;
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
@@ -144,11 +143,11 @@
         .registerCombineArchitecturesAction(
             binariesToLipo.build(),
             ruleIntermediateArtifacts.combinedArchitectureBinary(),
-            appleConfiguration.getPlatform(PlatformType.IOS))
+            appleConfiguration.getMultiArchPlatform(PlatformType.IOS))
         .registerCombineArchitecturesAction(
             archivesToLipo.build(),
             ruleContext.getImplicitOutputArtifact(AppleBinaryRule.LIPO_ARCHIVE),
-            appleConfiguration.getPlatform(PlatformType.IOS));
+            appleConfiguration.getMultiArchPlatform(PlatformType.IOS));
 
     RuleConfiguredTargetBuilder targetBuilder =
         ObjcRuleClasses.ruleConfiguredTarget(ruleContext, filesToBuild.build());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BinaryLinkingTargetFactory.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BinaryLinkingTargetFactory.java
index 7ee2cc8..1f98901 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BinaryLinkingTargetFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BinaryLinkingTargetFactory.java
@@ -32,6 +32,7 @@
 import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory;
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
 import com.google.devtools.build.lib.rules.apple.Platform;
+import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.lib.rules.objc.CompilationSupport.ExtraLinkArgs;
 import com.google.devtools.build.lib.rules.objc.ObjcCommon.ResourceAttributes;
 import com.google.devtools.build.lib.rules.objc.ProtoSupport.TargetType;
@@ -151,7 +152,7 @@
             .validateAttributes();
 
         xcTestAppProvider = Optional.of(releaseBundlingSupport.xcTestAppProvider());
-        if (appleConfiguration.getBundlingPlatform() == Platform.IOS_SIMULATOR) {
+        if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS) == Platform.IOS_SIMULATOR) {
           Artifact runnerScript = intermediateArtifacts.runnerScript();
           Artifact ipaFile = ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA);
           releaseBundlingSupport.registerGenerateRunnerScriptAction(runnerScript, ipaFile);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleMergeControlBytes.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleMergeControlBytes.java
index f7a83be..372fe5e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleMergeControlBytes.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleMergeControlBytes.java
@@ -17,6 +17,7 @@
 import com.google.common.io.ByteSource;
 import com.google.devtools.build.lib.actions.Artifact;
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
+import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.lib.util.Preconditions;
 import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos;
 import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.Control;
@@ -57,7 +58,7 @@
             // TODO(bazel-team): Add rule attribute for specifying targeted device family
             .setMinimumOsVersion(bundling.getMinimumOsVersion().toString())
             .setSdkVersion(appleConfiguration.getIosSdkVersion().toString())
-            .setPlatform(appleConfiguration.getBundlingPlatform().name())
+            .setPlatform(appleConfiguration.getMultiArchPlatform(PlatformType.IOS).name())
             .setBundleRoot(bundling.getBundleDir());
 
     if (bundling.getBundleInfoplist().isPresent()) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
index bb816ba..66650a2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/BundleSupport.java
@@ -319,7 +319,8 @@
                   .add("-XD_MOMC_SDKROOT=" + AppleToolchain.sdkDir())
                   .add("-XD_MOMC_IOS_TARGET_VERSION=" + bundling.getMinimumOsVersion())
                   .add("-MOMC_PLATFORMS")
-                  .add(appleConfiguration.getBundlingPlatform().getLowerCaseNameInPlist())
+                  .add(appleConfiguration.getMultiArchPlatform(PlatformType.IOS)
+                      .getLowerCaseNameInPlist())
                   .add("-XD_MOMC_TARGET_VERSION=10.6")
                   .add(datamodel.getContainer().getSafePathString())
                   .build())
@@ -445,7 +446,8 @@
             // The next three arguments are positional, i.e. they don't have flags before them.
             .addPath(zipOutput.getExecPath())
             .add("--platform")
-            .add(appleConfiguration.getBundlingPlatform().getLowerCaseNameInPlist())
+            .add(appleConfiguration.getMultiArchPlatform(PlatformType.IOS)
+                .getLowerCaseNameInPlist())
             .addExecPath("--output-partial-info-plist", partialInfoPlist)
             .add("--minimum-deployment-target")
             .add(bundling.getMinimumOsVersion().toString());
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 5adaf56..ef3d63c 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
@@ -81,7 +81,6 @@
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
 import com.google.devtools.build.lib.rules.apple.AppleToolchain;
 import com.google.devtools.build.lib.rules.apple.Platform;
-import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.lib.rules.cpp.CppModuleMap;
 import com.google.devtools.build.lib.rules.cpp.CppModuleMapAction;
 import com.google.devtools.build.lib.rules.cpp.LinkerInputs;
@@ -563,7 +562,7 @@
     // TODO(bazel-team): Remote private headers from inputs once they're added to the provider.
     ruleContext.registerAction(
         ObjcRuleClasses.spawnAppleEnvActionBuilder(
-                ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+                ruleContext, appleConfiguration.getSingleArchPlatform())
             .setMnemonic("ObjcCompile")
             .setExecutable(xcrunwrapper(ruleContext))
             .setCommandLine(commandLine.build())
@@ -693,7 +692,7 @@
 
     ruleContext.registerAction(
         ObjcRuleClasses.spawnAppleEnvActionBuilder(
-                ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+                ruleContext, appleConfiguration.getSingleArchPlatform())
             .setMnemonic("SwiftCompile")
             .setExecutable(xcrunwrapper(ruleContext))
             .setCommandLine(commandLine.build())
@@ -763,7 +762,7 @@
     commandLine.add(commonFrameworkFlags(objcProvider, appleConfiguration));
 
     ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder(
-            ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+            ruleContext, appleConfiguration.getSingleArchPlatform())
         .setMnemonic("SwiftModuleMerge")
         .setExecutable(xcrunwrapper(ruleContext))
         .setCommandLine(commandLine.build())
@@ -794,13 +793,13 @@
     actions.add(objFilelistAction(context, objFiles, objList));
 
     actions.add(ObjcRuleClasses.spawnAppleEnvActionBuilder(
-            ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+            ruleContext, appleConfiguration.getSingleArchPlatform())
         .setMnemonic("ObjcLink")
         .setExecutable(libtool(ruleContext))
         .setCommandLine(new CustomCommandLine.Builder()
             .add("-static")
             .add("-filelist").add(objList.getExecPathString())
-            .add("-arch_only").add(appleConfiguration.getSingleArchitecture(PlatformType.IOS))
+            .add("-arch_only").add(appleConfiguration.getSingleArchitecture())
             .add("-syslibroot").add(AppleToolchain.sdkDir())
             .add("-o").add(archive.getExecPathString())
             .build())
@@ -834,12 +833,12 @@
     ImmutableList<Artifact> objcLibraries = objcLibraries(objcProvider);
     ImmutableList<Artifact> ccLibraries = ccLibraries(objcProvider);
     ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder(
-            ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+            ruleContext, appleConfiguration.getSingleArchPlatform())
         .setMnemonic("ObjcLink")
         .setExecutable(libtool(ruleContext))
         .setCommandLine(new CustomCommandLine.Builder()
             .add("-static")
-            .add("-arch_only").add(appleConfiguration.getSingleArchitecture(PlatformType.IOS))
+            .add("-arch_only").add(appleConfiguration.getSingleArchitecture())
             .add("-syslibroot").add(AppleToolchain.sdkDir())
             .add("-o").add(outputArchive.getExecPathString())
             .addExecPaths(objcLibraries)
@@ -1037,7 +1036,7 @@
             linkmap);
     ruleContext.registerAction(
         ObjcRuleClasses.spawnAppleEnvActionBuilder(
-                ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+                ruleContext, appleConfiguration.getSingleArchPlatform())
             .setMnemonic("ObjcLink")
             .setShellCommand(ImmutableList.of("/bin/bash", "-c"))
             .setCommandLine(new SingleArgCommandLine(commandLine))
@@ -1072,7 +1071,7 @@
 
       ruleContext.registerAction(
           ObjcRuleClasses.spawnAppleEnvActionBuilder(
-                  ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+                  ruleContext, appleConfiguration.getSingleArchPlatform())
               .setMnemonic("ObjcBinarySymbolStrip")
               .setExecutable(xcrunwrapper(ruleContext))
               .setCommandLine(symbolStripCommandLine(stripArgs, binaryToLink, strippedBinary))
@@ -1341,7 +1340,7 @@
             commandLine,
             ParameterFile.ParameterFileType.UNQUOTED, ISO_8859_1));
         ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder(
-                ruleContext, appleConfiguration.getPlatform(PlatformType.IOS))
+                ruleContext, appleConfiguration.getSingleArchPlatform())
             .setMnemonic("DummyPruner")
             .setExecutable(pruner)
             .addInput(dummyArchive)
@@ -1557,8 +1556,9 @@
    */
   @VisibleForTesting
   static String swiftTarget(AppleConfiguration configuration) {
-    return configuration.getSingleArchitecture(PlatformType.IOS)
-        + "-apple-ios" + configuration.getIosSdkVersion();
+    // TODO(bazel-team): Assert the configuration is for an apple platform, or support
+    // other platform types.
+    return configuration.getSingleArchitecture() + "-apple-ios" + configuration.getIosSdkVersion();
   }
   
   /**
@@ -1568,7 +1568,7 @@
       ObjcProvider provider, ObjcConfiguration objcConfiguration,
       AppleConfiguration appleConfiguration) {
     ImmutableList.Builder<String> builder = new ImmutableList.Builder<>();
-    Platform platform = appleConfiguration.getPlatform(PlatformType.IOS);
+    Platform platform = appleConfiguration.getSingleArchPlatform();
     if (platform == Platform.IOS_SIMULATOR) {
       builder.add("-mios-simulator-version-min=" + objcConfiguration.getMinimumOs());
     } else {
@@ -1580,7 +1580,7 @@
     }
 
     return builder
-        .add("-arch", appleConfiguration.getSingleArchitecture(PlatformType.IOS))
+        .add("-arch", appleConfiguration.getSingleArchitecture())
         .add("-isysroot", AppleToolchain.sdkDir())
         // TODO(bazel-team): Pass framework search paths to Xcodegen.
         .addAll(commonFrameworkFlags(provider, appleConfiguration))
@@ -1600,7 +1600,7 @@
    */
   static Iterable<String> commonFrameworkNames(
       ObjcProvider provider, AppleConfiguration appleConfiguration) {
-    Platform platform = appleConfiguration.getPlatform(PlatformType.IOS);
+    Platform platform = appleConfiguration.getSingleArchPlatform();
 
     return new ImmutableList.Builder<String>()
         .add(AppleToolchain.sdkFrameworkDir(platform, appleConfiguration))
@@ -1628,7 +1628,7 @@
 
   private static List<String> platformSpecificCompileFlagsForClang(
       AppleConfiguration configuration) {
-    switch (configuration.getPlatform(PlatformType.IOS)) {
+    switch (configuration.getSingleArchPlatform()) {
       case IOS_DEVICE:
         return ImmutableList.of();
       case IOS_SIMULATOR:
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java
index 25d5e47..617fd3e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java
@@ -27,6 +27,7 @@
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher;
 import com.google.devtools.build.lib.rules.apple.Platform;
+import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.lib.rules.objc.ObjcProvider.Flag;
 import com.google.devtools.build.lib.rules.objc.ReleaseBundlingSupport.SplitArchTransition;
 
@@ -81,7 +82,7 @@
       ReleaseBundlingSupport releaseBundlingSupport) throws InterruptedException {
     // If this is an application built for the simulator, make it runnable.
     AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
-    if (appleConfiguration.getBundlingPlatform() == Platform.IOS_SIMULATOR) {
+    if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS) == Platform.IOS_SIMULATOR) {
       Artifact runnerScript = ObjcRuleClasses.intermediateArtifacts(ruleContext).runnerScript();
       Artifact ipaFile = ruleContext.getImplicitOutputArtifact(ReleaseBundlingSupport.IPA);
       releaseBundlingSupport.registerGenerateRunnerScriptAction(runnerScript, ipaFile);
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 f6a0c93..ded917c 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
@@ -1043,7 +1043,8 @@
                             Rule rule, AttributeMap attributes, BuildConfiguration configuration) {
                           AppleConfiguration appleConfiguration =
                               configuration.getFragment(AppleConfiguration.class);
-                          if (appleConfiguration.getBundlingPlatform() != Platform.IOS_DEVICE) {
+                          if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS)
+                              != Platform.IOS_DEVICE) {
                             return null;
                           }
                           if (rule.isAttributeValueExplicitlySpecified(PROVISIONING_PROFILE_ATTR)) {
@@ -1341,7 +1342,8 @@
                             BuildConfiguration configuration) {
                           AppleConfiguration appleConfiguration =
                               configuration.getFragment(AppleConfiguration.class);
-                          if (appleConfiguration.getBundlingPlatform() != Platform.IOS_DEVICE) {
+                          if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS)
+                              != Platform.IOS_DEVICE) {
                             return null;
                           }
                           if (rule.isAttributeValueExplicitlySpecified(
@@ -1524,7 +1526,8 @@
                             BuildConfiguration configuration) {
                           AppleConfiguration appleConfiguration =
                               configuration.getFragment(AppleConfiguration.class);
-                          if (appleConfiguration.getBundlingPlatform() != Platform.IOS_DEVICE) {
+                          if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS)
+                              != Platform.IOS_DEVICE) {
                             return null;
                           }
                           if (rule.isAttributeValueExplicitlySpecified(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
index 868303e..f67b0a8 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
@@ -261,7 +261,7 @@
 
     AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
     if (releaseBundling.getProvisioningProfile() == null
-        && appleConfiguration.getBundlingPlatform() != Platform.IOS_SIMULATOR) {
+        && appleConfiguration.getMultiArchPlatform(PlatformType.IOS) != Platform.IOS_SIMULATOR) {
       ruleContext.attributeError(releaseBundling.getProvisioningProfileAttrName(),
           DEVICE_NO_PROVISIONING_PROFILE);
     }
@@ -373,7 +373,7 @@
     String platformWithVersion =
         String.format(
             "%s%s",
-            configuration.getBundlingPlatform().getLowerCaseNameInPlist(),
+            configuration.getMultiArchPlatform(PlatformType.IOS).getLowerCaseNameInPlist(),
             configuration.getIosSdkVersion());
     ruleContext.registerAction(
         ObjcRuleClasses.spawnAppleEnvActionBuilder(ruleContext)
@@ -402,7 +402,7 @@
     List<Integer> uiDeviceFamily =
         TargetDeviceFamily.UI_DEVICE_FAMILY_VALUES.get(bundleSupport.targetDeviceFamilies());
     AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
-    Platform platform = appleConfiguration.getBundlingPlatform();
+    Platform platform = appleConfiguration.getMultiArchPlatform(PlatformType.IOS);
 
     NSDictionary result = new NSDictionary();
 
@@ -457,7 +457,7 @@
     }
 
     AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
-    if (appleConfiguration.getBundlingPlatform() == Platform.IOS_DEVICE) {
+    if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS) == Platform.IOS_DEVICE) {
       processingNeeded = true;
       registerEntitlementsActions();
       actionCommandLine += signingCommandLine();
@@ -766,7 +766,7 @@
       DottedVersion minimumOsVersion) {
     ImmutableList<BundleableFile> extraBundleFiles;
     AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
-    if (appleConfiguration.getBundlingPlatform() == Platform.IOS_DEVICE) {
+    if (appleConfiguration.getMultiArchPlatform(PlatformType.IOS) == Platform.IOS_DEVICE) {
       extraBundleFiles = ImmutableList.of(new BundleableFile(
           releaseBundling.getProvisioningProfile(), PROVISIONING_PROFILE_BUNDLE_FILE));
     } else {
@@ -820,7 +820,7 @@
     AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
 
     new LipoSupport(ruleContext).registerCombineArchitecturesAction(linkedBinaries(),
-        resultingLinkedBinary, appleConfiguration.getPlatform(PlatformType.IOS));
+        resultingLinkedBinary, appleConfiguration.getMultiArchPlatform(PlatformType.IOS));
   }
 
   private NestedSet<Artifact> linkedBinaries() {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/WatchApplicationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/WatchApplicationSupport.java
index a55c1a0..ad0d191 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/WatchApplicationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/WatchApplicationSupport.java
@@ -47,6 +47,7 @@
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration.ConfigurationDistinguisher;
 import com.google.devtools.build.lib.rules.apple.Platform;
+import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.lib.rules.objc.ReleaseBundlingSupport.LinkedBinary;
 import com.google.devtools.build.lib.rules.objc.WatchUtils.WatchOSVersion;
 import com.google.devtools.build.lib.syntax.Type;
@@ -153,7 +154,8 @@
    * {@code TargetDeviceFamily.WATCH}.
    */
   private ImmutableSet<TargetDeviceFamily> families() {
-    Platform platform = ruleContext.getFragment(AppleConfiguration.class).getBundlingPlatform();
+    Platform platform =
+        ruleContext.getFragment(AppleConfiguration.class).getMultiArchPlatform(PlatformType.IOS);
     if (platform == Platform.IOS_DEVICE) {
       return ImmutableSet.of(TargetDeviceFamily.WATCH);
     } else {
@@ -207,7 +209,7 @@
             Joiner.on(" ").join(ImmutableList.of("_WatchKitStub", bundleName))));
 
     ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder(ruleContext,
-        ruleContext.getFragment(AppleConfiguration.class).getBundlingPlatform())
+        ruleContext.getFragment(AppleConfiguration.class).getMultiArchPlatform(PlatformType.IOS))
         .setProgressMessage(
             "Copying WatchKit binary and stub resource: " + ruleContext.getLabel())
         .setShellCommand(ImmutableList.of("/bin/bash", "-c", Joiner.on(" ").join(command)))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/WatchUtils.java b/src/main/java/com/google/devtools/build/lib/rules/objc/WatchUtils.java
index e8abe97..4909c25 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/WatchUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/WatchUtils.java
@@ -24,6 +24,7 @@
 import com.google.devtools.build.lib.analysis.RuleContext;
 import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
 import com.google.devtools.build.lib.rules.apple.DottedVersion;
+import com.google.devtools.build.lib.rules.apple.Platform.PlatformType;
 import com.google.devtools.build.xcode.xcodegen.proto.XcodeGenProtos.XcodeprojBuildSetting;
 
 /**
@@ -140,7 +141,7 @@
             watchKitSupportDirName));
 
     ruleContext.registerAction(ObjcRuleClasses.spawnAppleEnvActionBuilder(ruleContext,
-        ruleContext.getFragment(AppleConfiguration.class).getBundlingPlatform())
+        ruleContext.getFragment(AppleConfiguration.class).getMultiArchPlatform(PlatformType.IOS))
         .setProgressMessage("Copying Watchkit support to app bundle")
         .setShellCommand(ImmutableList.of("/bin/bash", "-c", Joiner.on(" ").join(command)))
         .addOutput(watchSupportZip)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
index 61ac5a6..4719bfc 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/XcodeSupport.java
@@ -272,7 +272,7 @@
       this.project = project;
       this.pbxproj = pbxproj;
       this.workspaceRoot = objcConfiguration.getXcodeWorkspaceRoot();
-      this.appleCpus = appleConfiguration.getArchitectures(PlatformType.IOS);
+      this.appleCpus = appleConfiguration.getMultiArchitectures(PlatformType.IOS);
       this.minimumOs = objcConfiguration.getMinimumOs().toString();
       this.generateDebugSymbols =
           objcConfiguration.generateDebugSymbols() || objcConfiguration.generateDsym();