Also build both watchOS CPUs when targeting armv7k or arm64_32 as opposed to only building both when targeting iOS.

PiperOrigin-RevId: 267210761
diff --git a/src/TulsiGenerator/BazelBuildSettingsFeatures.swift b/src/TulsiGenerator/BazelBuildSettingsFeatures.swift
index 19a04e1..9af01ea 100644
--- a/src/TulsiGenerator/BazelBuildSettingsFeatures.swift
+++ b/src/TulsiGenerator/BazelBuildSettingsFeatures.swift
@@ -22,6 +22,7 @@
 extension PlatformConfiguration {
   public var bazelFlags: [String] {
     var flags = ["--apple_platform_type=\(platform.bazelPlatform)"]
+    let physicalWatchCPUs = "\(CPU.armv7k.rawValue),\(CPU.arm64_32.rawValue)"
 
     switch platform {
     case .ios, .macos:
@@ -29,7 +30,13 @@
     case .tvos:
       flags.append("--\(platform.bazelCPUPlatform)_cpus=\(cpu.rawValue)")
     case .watchos:
-      flags.append("--\(platform.bazelCPUPlatform)_cpus=\(cpu.watchCPU.rawValue)")
+      if (cpu == .armv7k || cpu == .arm64_32) {
+        // Xcode doesn't provide a way to determine the architecture of a watch
+        // so target both watchOS cpus when building for a physical watch.
+        flags.append("--\(platform.bazelCPUPlatform)_cpus=\(physicalWatchCPUs)")
+      } else {
+        flags.append("--\(platform.bazelCPUPlatform)_cpus=\(cpu.watchCPU.rawValue)")
+      }
     }
 
     if case .ios = platform {
@@ -39,8 +46,7 @@
         // otherwise we might unintentionally install a watch app with the wrong
         // architecture. Only 64-bit iOS devices support the Apple Watch Series
         // 4 so we only need to apply the flag to the 64bit iOS CPUs.
-        let cpus = "\(CPU.armv7k.rawValue),\(CPU.arm64_32.rawValue)"
-        flags.append("--\(PlatformType.watchos.bazelCPUPlatform)_cpus=\(cpus)")
+        flags.append("--\(PlatformType.watchos.bazelCPUPlatform)_cpus=\(physicalWatchCPUs)")
       } else {
         flags.append("--\(PlatformType.watchos.bazelCPUPlatform)_cpus=\(cpu.watchCPU.rawValue)")
       }
diff --git a/src/TulsiGeneratorTests/BazelSettingsProviderTests.swift b/src/TulsiGeneratorTests/BazelSettingsProviderTests.swift
index 7ba542f..2f83ca0 100644
--- a/src/TulsiGeneratorTests/BazelSettingsProviderTests.swift
+++ b/src/TulsiGeneratorTests/BazelSettingsProviderTests.swift
@@ -32,7 +32,7 @@
                                                        buildRuleEntries: buildRuleEntries)
 
     let expectedFlag = "--watchos_cpus=armv7k,arm64_32"
-    let expectedIdentifiers = Set(["watchos_armv7k", "watchos_arm64_32"])
+    let expectedIdentifiers = Set(["watchos_armv7k", "watchos_arm64_32", "ios_arm64", "ios_arm64e"])
     // Check that both watchos flags are set for both architectures.
     for (identifier, flags) in settings.platformConfigurationFlags {
       if (expectedIdentifiers.contains(identifier)) {