Browse Source

Fix VisionOS and WatchOS CI (#12966)

Paul Beusterien 1 year ago
parent
commit
95cf48558f

+ 2 - 3
.github/workflows/spm.yml

@@ -88,6 +88,8 @@ jobs:
     strategy:
       matrix:
         # Full set of Firebase-Package tests only run on iOS. Run subset on other platforms.
+        # visionOS isn't buildable from here (even with Firestore source) because the test
+        # targets need Analytics.
         target: [tvOS, macOS, catalyst]
         os: [macos-13, macos-14]
         include:
@@ -95,9 +97,6 @@ jobs:
             xcode: Xcode_15.2
           - os: macos-14
             xcode: Xcode_15.3
-          - os: macos-14
-            target: visionOS
-            xcode: Xcode_15.3
     runs-on: ${{ matrix.os }}
     steps:
     - uses: actions/checkout@v4

+ 2 - 0
FirebaseInAppMessaging/Sources/Flows/FIRIAMDisplayExecutor.m

@@ -363,8 +363,10 @@
         return;
       }
       self.alertWindow = [[UIWindow alloc] initWithWindowScene:foregroundedScene];
+#if TARGET_OS_IOS || TARGET_OS_TV
     } else {
       self.alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
+#endif
     }
     UIViewController *alertViewController = [[UIViewController alloc] init];
     self.alertWindow.rootViewController = alertViewController;

+ 8 - 2
scripts/build.sh

@@ -169,10 +169,12 @@ tvos_flags=(
   -destination 'platform=tvOS Simulator,name=Apple TV'
 )
 watchos_flags=(
+  -sdk 'watchsimulator'
   -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)'
 )
 visionos_flags=(
-  -destination 'platform=visionOS Simulator'
+  -sdk 'xrsimulator'
+  -destination 'platform=visionOS Simulator,name=Apple Vision Pro'
 )
 catalyst_flags=(
   ARCHS=x86_64 VALID_ARCHS=x86_64 SUPPORTS_MACCATALYST=YES -sdk macosx
@@ -409,12 +411,16 @@ case "$product-$platform-$method" in
     fi
     ;;
 
+  # TODO: This is actually building for iOS instead of watchOS. Update to use
+  # watchOS xcb_flags along with the watchOS sdk option. Also nanopb and promises
+  # podspecs need minimum version updates.
+
   MessagingSampleStandaloneWatchApp-*-*)
     if check_secrets; then
       RunXcodebuild \
         -workspace 'FirebaseMessaging/Apps/SampleStandaloneWatchApp/SampleStandaloneWatchApp.xcworkspace' \
         -scheme "SampleStandaloneWatchApp Watch App" \
-        "${xcb_flags[@]}" \
+        -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' \
         build
     fi
     ;;