Browse Source

[Firestore] Add warning when building Firestore's binary SPM distro for visionOS (#12279)

Co-authored-by: Andrew Heard <andrewheard@google.com>
Nick Cooke 2 năm trước cách đây
mục cha
commit
756b5a4cbb

+ 5 - 0
Firestore/CHANGELOG.md

@@ -1,3 +1,8 @@
+# Unreleased
+- Add warning when trying to build Firestore's binary SPM distribution for
+  visionOS (#12279). See Firestore's 10.12.0 release note for a supported
+  workaround.
+
 # 10.19.0
 - [fixed] Made an optimization to the synchronization logic for resumed queries
   to only re-download locally-cached documents that are known to be out-of-sync. (#12044)

+ 16 - 4
Package.swift

@@ -1364,7 +1364,8 @@ func firestoreWrapperTarget() -> Target {
     name: "FirebaseFirestoreTarget",
     dependencies: [.target(name: "FirebaseFirestore",
                            condition: .when(platforms: [.iOS, .tvOS, .macOS, .macCatalyst]))],
-    path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap"
+    path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap",
+    cSettings: [.define("FIREBASE_BINARY_FIRESTORE", to: "1")]
   )
 }
 
@@ -1494,8 +1495,16 @@ func firestoreTargets() -> [Target] {
           name: "FirebaseFirestoreInternalWrapper",
           condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
         ),
-        .product(name: "abseil", package: "abseil-cpp-binary"),
-        .product(name: "gRPC-C++", package: "grpc-binary"),
+        .product(
+          name: "abseil",
+          package: "abseil-cpp-binary",
+          condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
+        ),
+        .product(
+          name: "gRPC-C++",
+          package: "grpc-binary",
+          condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
+        ),
         .product(name: "nanopb", package: "nanopb"),
         "FirebaseAppCheckInterop",
         "FirebaseCore",
@@ -1512,7 +1521,10 @@ func firestoreTargets() -> [Target] {
     ),
     .target(
       name: "FirebaseFirestoreInternalWrapper",
-      dependencies: ["FirebaseFirestoreInternal"],
+      dependencies: [.target(
+        name: "FirebaseFirestoreInternal",
+        condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
+      )],
       path: "FirebaseFirestoreInternal",
       publicHeadersPath: "."
     ),

+ 9 - 0
SwiftPM-PlatformExclude/FirebaseFirestoreWrap/dummy.m

@@ -16,3 +16,12 @@
 #if TARGET_OS_WATCH
 #warning "Firebase Firestore does not support watchOS"
 #endif
+
+#if (defined(TARGET_OS_VISION) && TARGET_OS_VISION) && FIREBASE_BINARY_FIRESTORE
+#error "Firebase Firestore's binary SPM distribution does not support \
+visionOS. To enable the source distribution, quit Xcode and open the desired \
+project from the command line with the FIREBASE_SOURCE_FIRESTORE environment \
+variable: `open --env FIREBASE_SOURCE_FIRESTORE /path/to/project.xcodeproj`. \
+To go back to using the binary distribution of Firestore, quit Xcode and open \
+Xcode like normal, without the environment variable."
+#endif