From 0b75f843b5f980b7740ff56487ab29daef344609 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Fri, 13 Oct 2023 17:08:55 -0400 Subject: [PATCH] Revert "[Firestore] Consolidate Firestore and FirestoreSwift (#11806)" This reverts commit a7e3720e9e2a03724346ccdc289af639e374c0d9. --- FirebaseFirestore.podspec | 4 - FirebaseFirestoreSwift.podspec | 7 +- .../Sources/FirebaseFirestoreSwift.swift | 30 --- Firestore/CHANGELOG.md | 6 - Firestore/Swift/CHANGELOG.md | 7 - .../CollectionReference+AsyncAwait.swift | 4 +- .../AsyncAwait/Firestore+AsyncAwait.swift | 4 +- .../Codable/CodablePassThroughTypes.swift | 4 +- .../CollectionReference+WriteEncodable.swift | 4 +- .../Swift/Source/Codable/DocumentID.swift | 4 +- .../Codable/DocumentReference+Codable.swift | 4 +- .../DocumentReference+ReadDecodable.swift | 4 +- .../DocumentReference+WriteEncodable.swift | 4 +- .../DocumentSnapshot+ReadDecodable.swift | 4 +- .../Swift/Source/Codable/EncoderDecoder.swift | 4 +- .../Swift/Source/Codable/ExplicitNull.swift | 4 +- .../Source/Codable/FieldValue+Encodable.swift | 4 +- .../Source/Codable/GeoPoint+Codable.swift | 4 +- .../Source/Codable/ServerTimestamp.swift | 4 +- .../Source/Codable/Timestamp+Codable.swift | 4 +- .../Codable/TimestampDecodingStrategy.swift | 4 +- .../Codable/TimestampEncodingStrategy.swift | 4 +- .../Codable/Transaction+WriteEncodable.swift | 4 +- .../Codable/WriteBatch+WriteEncodable.swift | 4 +- .../PropertyWrapper/FirestoreQuery.swift | 4 +- .../FirestoreQueryObservable.swift | 4 +- .../PropertyWrapper/QueryPredicate.swift | 4 +- .../Source/SPMSwiftHeaderWorkaround.swift | 29 --- Package.swift | 227 +++++++++--------- .../FirebaseManifest/FirebaseManifest.swift | 2 +- 30 files changed, 136 insertions(+), 264 deletions(-) delete mode 100644 FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift delete mode 100644 Firestore/Swift/Source/SPMSwiftHeaderWorkaround.swift diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index 4caef19254b..d846ca519bb 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -51,7 +51,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, 'Firestore/core/include/**/*.{cc,mm}', 'Firestore/core/src/**/*.{cc,mm}', 'FirebaseAuth/Interop/*.h', - 'Firestore/Swift/Source/**/*.swift', ] # Internal headers that aren't necessarily globally unique. Most C++ internal @@ -90,8 +89,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, s.dependency 'FirebaseAppCheckInterop', '~> 10.17' s.dependency 'FirebaseCore', '~> 10.0' - s.dependency 'FirebaseCoreExtension', '~> 10.0' - s.dependency 'FirebaseSharedSwift', '~> 10.0' abseil_version = '~> 1.20220623.0' s.dependency 'abseil/algorithm', abseil_version @@ -114,7 +111,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, s.library = 'c++' s.pod_target_xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14', - 'CLANG_CXX_LIBRARY' => 'libc++', 'GCC_C_LANGUAGE_STANDARD' => 'c99', 'GCC_PREPROCESSOR_DEFINITIONS' => "FIRFirestore_VERSION=#{s.version} " + diff --git a/FirebaseFirestoreSwift.podspec b/FirebaseFirestoreSwift.podspec index 7920a59fbd3..d1c43768369 100644 --- a/FirebaseFirestoreSwift.podspec +++ b/FirebaseFirestoreSwift.podspec @@ -31,9 +31,12 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, s.requires_arc = true s.source_files = [ - 'FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift' + 'Firestore/Swift/Source/**/*.swift', ] - s.dependency 'FirebaseFirestore', '~> 10.17' + s.dependency 'FirebaseCore', '~> 10.0' + s.dependency 'FirebaseCoreExtension', '~> 10.0' + s.dependency 'FirebaseFirestore', '~> 10.0' + s.dependency 'FirebaseSharedSwift', '~> 10.0' end diff --git a/FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift b/FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift deleted file mode 100644 index 9918633f67b..00000000000 --- a/FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#warning( - "All of the public API from `FirebaseFirestoreSwift` can now be accessed through the `FirebaseFirestore` module. Therefore, the `FirebaseFirestoreSwift` module is deprecated and will be removed in the future. See https://firebase.google.com/docs/ios/swift-migration for migration instructions." -) - -// The `@_exported` is needed to prevent breaking clients that are using -// types prefixed with the `FirebaseFirestoreSwift` namespace. -@_exported import enum FirebaseFirestore.DecodingFailureStrategy -@_exported import struct FirebaseFirestore.DocumentID -@_exported import protocol FirebaseFirestore.DocumentIDWrappable -@_exported import struct FirebaseFirestore.ExplicitNull -@_exported import enum FirebaseFirestore.FirestoreDecodingError -@_exported import enum FirebaseFirestore.FirestoreEncodingError -@_exported import struct FirebaseFirestore.FirestoreQuery -@_exported import enum FirebaseFirestore.QueryPredicate -@_exported import struct FirebaseFirestore.ServerTimestamp -@_exported import protocol FirebaseFirestore.ServerTimestampWrappable diff --git a/Firestore/CHANGELOG.md b/Firestore/CHANGELOG.md index b0f68196083..44dafdecb09 100644 --- a/Firestore/CHANGELOG.md +++ b/Firestore/CHANGELOG.md @@ -1,9 +1,3 @@ -# Unreleased -- [feature] The `FirebaseFirestore` module now contains Firebase Firestore's - Swift-only APIs that were previously only available via the - `FirebaseFirestoreSwift` extension SDK. See the - `FirebaseFirestoreSwift` release note from this release for more details. - # 10.16.0 - [fixed] Fixed an issue where Firestore's binary SwiftPM distribution would not link properly when building a target for testing. This issue affected diff --git a/Firestore/Swift/CHANGELOG.md b/Firestore/Swift/CHANGELOG.md index 3ffebb7bb27..a176d7c4e11 100644 --- a/Firestore/Swift/CHANGELOG.md +++ b/Firestore/Swift/CHANGELOG.md @@ -1,10 +1,3 @@ -# Unreleased -- [deprecated] All of the public API from `FirebaseFirestoreSwift` can now - be accessed through the `FirebaseFirestore` module. Therefore, - `FirebaseFirestoreSwift` has been deprecated, and will be removed in a - future release. See https://firebase.google.com/docs/ios/swift-migration for - migration instructions. - # 10.12.0 - [added] Added support animations on the `@FirestoreQuery` property wrapper. diff --git a/Firestore/Swift/Source/AsyncAwait/CollectionReference+AsyncAwait.swift b/Firestore/Swift/Source/AsyncAwait/CollectionReference+AsyncAwait.swift index bb7cac18090..3fcb340da63 100644 --- a/Firestore/Swift/Source/AsyncAwait/CollectionReference+AsyncAwait.swift +++ b/Firestore/Swift/Source/AsyncAwait/CollectionReference+AsyncAwait.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore import Foundation #if compiler(>=5.5.2) && canImport(_Concurrency) diff --git a/Firestore/Swift/Source/AsyncAwait/Firestore+AsyncAwait.swift b/Firestore/Swift/Source/AsyncAwait/Firestore+AsyncAwait.swift index d9cf549a15c..2a09c08efab 100644 --- a/Firestore/Swift/Source/AsyncAwait/Firestore+AsyncAwait.swift +++ b/Firestore/Swift/Source/AsyncAwait/Firestore+AsyncAwait.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore import Foundation #if compiler(>=5.5.2) && canImport(_Concurrency) diff --git a/Firestore/Swift/Source/Codable/CodablePassThroughTypes.swift b/Firestore/Swift/Source/Codable/CodablePassThroughTypes.swift index 56fceebfd4d..0b6371745ac 100644 --- a/Firestore/Swift/Source/Codable/CodablePassThroughTypes.swift +++ b/Firestore/Swift/Source/Codable/CodablePassThroughTypes.swift @@ -16,9 +16,7 @@ import Foundation import FirebaseSharedSwift -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore internal struct FirestorePassthroughTypes: StructureCodingPassthroughTypeResolver { static func isPassthroughType(_ t: T) -> Bool { diff --git a/Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift b/Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift index 21d4d8dfc32..fe3ee5167b9 100644 --- a/Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift +++ b/Firestore/Swift/Source/Codable/CollectionReference+WriteEncodable.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore public extension CollectionReference { /// Encodes an instance of `Encodable` and adds a new document to this collection diff --git a/Firestore/Swift/Source/Codable/DocumentID.swift b/Firestore/Swift/Source/Codable/DocumentID.swift index d9abce5907b..fca5f8de0d8 100644 --- a/Firestore/Swift/Source/Codable/DocumentID.swift +++ b/Firestore/Swift/Source/Codable/DocumentID.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore import FirebaseSharedSwift @_implementationOnly import FirebaseCoreExtension diff --git a/Firestore/Swift/Source/Codable/DocumentReference+Codable.swift b/Firestore/Swift/Source/Codable/DocumentReference+Codable.swift index 76f6b2ceec7..ca52fac5e63 100644 --- a/Firestore/Swift/Source/Codable/DocumentReference+Codable.swift +++ b/Firestore/Swift/Source/Codable/DocumentReference+Codable.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /** Mark DocumentReference to conform to Codable. */ diff --git a/Firestore/Swift/Source/Codable/DocumentReference+ReadDecodable.swift b/Firestore/Swift/Source/Codable/DocumentReference+ReadDecodable.swift index 673be200d07..28e76010055 100644 --- a/Firestore/Swift/Source/Codable/DocumentReference+ReadDecodable.swift +++ b/Firestore/Swift/Source/Codable/DocumentReference+ReadDecodable.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore public extension DocumentReference { /// Fetches and decodes the document referenced by this `DocumentReference`. diff --git a/Firestore/Swift/Source/Codable/DocumentReference+WriteEncodable.swift b/Firestore/Swift/Source/Codable/DocumentReference+WriteEncodable.swift index c9345a3867b..11fbfa18330 100644 --- a/Firestore/Swift/Source/Codable/DocumentReference+WriteEncodable.swift +++ b/Firestore/Swift/Source/Codable/DocumentReference+WriteEncodable.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore public extension DocumentReference { /// Encodes an instance of `Encodable` and overwrites the encoded data diff --git a/Firestore/Swift/Source/Codable/DocumentSnapshot+ReadDecodable.swift b/Firestore/Swift/Source/Codable/DocumentSnapshot+ReadDecodable.swift index 90a637d2a9b..ad9a10bd92a 100644 --- a/Firestore/Swift/Source/Codable/DocumentSnapshot+ReadDecodable.swift +++ b/Firestore/Swift/Source/Codable/DocumentSnapshot+ReadDecodable.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore public extension DocumentSnapshot { /// Retrieves all fields in a document and converts them to an instance of diff --git a/Firestore/Swift/Source/Codable/EncoderDecoder.swift b/Firestore/Swift/Source/Codable/EncoderDecoder.swift index 1e503999a39..3c35117222c 100644 --- a/Firestore/Swift/Source/Codable/EncoderDecoder.swift +++ b/Firestore/Swift/Source/Codable/EncoderDecoder.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore import FirebaseSharedSwift import Foundation diff --git a/Firestore/Swift/Source/Codable/ExplicitNull.swift b/Firestore/Swift/Source/Codable/ExplicitNull.swift index 428c9755890..980093dbf0c 100644 --- a/Firestore/Swift/Source/Codable/ExplicitNull.swift +++ b/Firestore/Swift/Source/Codable/ExplicitNull.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /// Wraps an `Optional` field in a `Codable` object such that when the field /// has a `nil` value it will encode to a null value in Firestore. Normally, diff --git a/Firestore/Swift/Source/Codable/FieldValue+Encodable.swift b/Firestore/Swift/Source/Codable/FieldValue+Encodable.swift index 554d86d505b..ef52b09f30f 100644 --- a/Firestore/Swift/Source/Codable/FieldValue+Encodable.swift +++ b/Firestore/Swift/Source/Codable/FieldValue+Encodable.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /** Extends FieldValue to conform to Encodable. */ extension FieldValue: Encodable { diff --git a/Firestore/Swift/Source/Codable/GeoPoint+Codable.swift b/Firestore/Swift/Source/Codable/GeoPoint+Codable.swift index befcd1235c3..60acc2db661 100644 --- a/Firestore/Swift/Source/Codable/GeoPoint+Codable.swift +++ b/Firestore/Swift/Source/Codable/GeoPoint+Codable.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /** * A protocol describing the encodable properties of a GeoPoint. diff --git a/Firestore/Swift/Source/Codable/ServerTimestamp.swift b/Firestore/Swift/Source/Codable/ServerTimestamp.swift index 1be29446b73..bd211a9c442 100644 --- a/Firestore/Swift/Source/Codable/ServerTimestamp.swift +++ b/Firestore/Swift/Source/Codable/ServerTimestamp.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /// A type that can initialize itself from a Firestore Timestamp, which makes /// it suitable for use with the `@ServerTimestamp` property wrapper. diff --git a/Firestore/Swift/Source/Codable/Timestamp+Codable.swift b/Firestore/Swift/Source/Codable/Timestamp+Codable.swift index 15281e6e67b..9bed88200ad 100644 --- a/Firestore/Swift/Source/Codable/Timestamp+Codable.swift +++ b/Firestore/Swift/Source/Codable/Timestamp+Codable.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /** * A protocol describing the encodable properties of a Timestamp. diff --git a/Firestore/Swift/Source/Codable/TimestampDecodingStrategy.swift b/Firestore/Swift/Source/Codable/TimestampDecodingStrategy.swift index 57d69dc4d80..d72c941ac77 100644 --- a/Firestore/Swift/Source/Codable/TimestampDecodingStrategy.swift +++ b/Firestore/Swift/Source/Codable/TimestampDecodingStrategy.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore import FirebaseSharedSwift public extension FirebaseDataDecoder.DateDecodingStrategy { diff --git a/Firestore/Swift/Source/Codable/TimestampEncodingStrategy.swift b/Firestore/Swift/Source/Codable/TimestampEncodingStrategy.swift index 7b9bf45098c..7d1f47dc9fb 100644 --- a/Firestore/Swift/Source/Codable/TimestampEncodingStrategy.swift +++ b/Firestore/Swift/Source/Codable/TimestampEncodingStrategy.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore import FirebaseSharedSwift import Foundation diff --git a/Firestore/Swift/Source/Codable/Transaction+WriteEncodable.swift b/Firestore/Swift/Source/Codable/Transaction+WriteEncodable.swift index dc8d0ea9531..196cee6c94b 100644 --- a/Firestore/Swift/Source/Codable/Transaction+WriteEncodable.swift +++ b/Firestore/Swift/Source/Codable/Transaction+WriteEncodable.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore public extension Transaction { /// Encodes an instance of `Encodable` and overwrites the encoded data diff --git a/Firestore/Swift/Source/Codable/WriteBatch+WriteEncodable.swift b/Firestore/Swift/Source/Codable/WriteBatch+WriteEncodable.swift index 7afda568be5..8232325d1fd 100644 --- a/Firestore/Swift/Source/Codable/WriteBatch+WriteEncodable.swift +++ b/Firestore/Swift/Source/Codable/WriteBatch+WriteEncodable.swift @@ -15,9 +15,7 @@ */ import Foundation -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore public extension WriteBatch { /// Encodes an instance of `Encodable` and overwrites the encoded data diff --git a/Firestore/Swift/Source/PropertyWrapper/FirestoreQuery.swift b/Firestore/Swift/Source/PropertyWrapper/FirestoreQuery.swift index d0663c71801..16ca88baa27 100644 --- a/Firestore/Swift/Source/PropertyWrapper/FirestoreQuery.swift +++ b/Firestore/Swift/Source/PropertyWrapper/FirestoreQuery.swift @@ -15,9 +15,7 @@ */ import SwiftUI -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /// The strategy to use when an error occurs during mapping Firestore documents /// to the target type of `FirestoreQuery`. diff --git a/Firestore/Swift/Source/PropertyWrapper/FirestoreQueryObservable.swift b/Firestore/Swift/Source/PropertyWrapper/FirestoreQueryObservable.swift index c1c9d35b66f..ba1db479c9c 100644 --- a/Firestore/Swift/Source/PropertyWrapper/FirestoreQueryObservable.swift +++ b/Firestore/Swift/Source/PropertyWrapper/FirestoreQueryObservable.swift @@ -15,9 +15,7 @@ */ import SwiftUI -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore @available(iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 14.0, watchOS 7.0, *) internal class FirestoreQueryObservable: ObservableObject { diff --git a/Firestore/Swift/Source/PropertyWrapper/QueryPredicate.swift b/Firestore/Swift/Source/PropertyWrapper/QueryPredicate.swift index e40e10f59cc..54779049d10 100644 --- a/Firestore/Swift/Source/PropertyWrapper/QueryPredicate.swift +++ b/Firestore/Swift/Source/PropertyWrapper/QueryPredicate.swift @@ -14,9 +14,7 @@ * limitations under the License. */ -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal -#endif // SWIFT_PACKAGE +import FirebaseFirestore /// Query predicates that can be used to filter results fetched by `FirestoreQuery`. /// diff --git a/Firestore/Swift/Source/SPMSwiftHeaderWorkaround.swift b/Firestore/Swift/Source/SPMSwiftHeaderWorkaround.swift deleted file mode 100644 index 986d54e697f..00000000000 --- a/Firestore/Swift/Source/SPMSwiftHeaderWorkaround.swift +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#if SWIFT_PACKAGE - @_exported import FirebaseFirestoreInternal - - // This is a trick to force generate a `FirebaseFirestore-Swift.h` - // header that re-exports `FirebaseFirestoreInternal` for Objective-C - // clients. It is important for the below code to reference a Remote - // Config symbol defined in Objective-C as that will import the symbol's - // module (`FirebaseFirestoreInternal`) in the generated header. This - // allows Objective-C clients to import Remote Config's Objective-C API - // using `@import FirebaseFirestore;`. This API is not needed for Swift - // clients and is therefore unavailable in a Swift context. - @available(*, unavailable) - @objc public extension Firestore { - static var __no_op: () -> Void { {} } - } -#endif // SWIFT_PACKAGE diff --git a/Package.swift b/Package.swift index 89033d228b6..7f64eedf570 100644 --- a/Package.swift +++ b/Package.swift @@ -621,10 +621,13 @@ let package = Package( dependencies: ["FirebaseDatabase", "FirebaseDatabaseSwift"], path: "FirebaseDatabaseSwift/Tests/" ), - .binaryTarget( + .target( name: "FirebaseSharedSwift", - url: "https://dl.google.com/firebase/ios/experimental/bin/sharedswift/10.16.0/FirebaseSharedSwift.zip", - checksum: "cfa32eb16ba8fafa7a443ab8f48e019794470bb358066d6c571df1531df02fe6" + path: "FirebaseSharedSwift/Sources", + exclude: [ + "third_party/FirebaseDataEncoder/LICENSE", + "third_party/FirebaseDataEncoder/METADATA", + ] ), .testTarget( name: "FirebaseSharedSwiftTests", @@ -653,6 +656,7 @@ let package = Package( ] ), firestoreWrapperTarget(), + firestoreTarget(), .target( name: "FirebaseFirestoreSwiftTarget", dependencies: [.target(name: "FirebaseFirestoreSwift", @@ -664,9 +668,30 @@ let package = Package( .target( name: "FirebaseFirestoreSwift", dependencies: [ + "FirebaseCore", + "FirebaseCoreExtension", "FirebaseFirestoreTarget", + "FirebaseSharedSwift", + ], + path: "Firestore", + exclude: [ + "CHANGELOG.md", + "CMakeLists.txt", + "Example/", + "LICENSE", + "Protos/", + "README.md", + "Source/", + "core/", + "fuzzing/", + "test.sh", + "Swift/CHANGELOG.md", + "Swift/Tests/", + "third_party/nlohmann_json", ], - path: "FirebaseFirestoreSwift/Sources" + sources: [ + "Swift/Source/", + ] ), // MARK: - Firebase Functions @@ -1295,7 +1320,8 @@ let package = Package( .headerSearchPath("../../.."), ] ), - ] + firestoreTargets(), + + ], cLanguageStandard: .c99, cxxLanguageStandard: CXXLanguageStandard.gnucxx14 ) @@ -1369,10 +1395,7 @@ func firestoreWrapperTarget() -> Target { .product(name: "abseil", package: "abseil-cpp-binary"), .product(name: "gRPC-C++", package: "grpc-binary"), .product(name: "nanopb", package: "nanopb"), - "FirebaseAppCheckInterop", "FirebaseCore", - "FirebaseCoreExtension", - "FirebaseSharedSwift", "leveldb", ], path: "SwiftPM-PlatformExclude/FirebaseFirestoreWrap", @@ -1384,123 +1407,89 @@ func firestoreWrapperTarget() -> Target { ) } -func firestoreTargets() -> [Target] { +func firestoreTarget() -> Target { if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil { - return [ - .target( - name: "FirebaseFirestoreInternal", - dependencies: [ - "FirebaseAppCheckInterop", - "FirebaseCore", - "leveldb", - .product(name: "nanopb", package: "nanopb"), - .product(name: "abseil", package: "abseil-cpp-SwiftPM"), - .product(name: "gRPC-cpp", package: "grpc-ios"), - ], - path: "Firestore", - exclude: [ - "CHANGELOG.md", - "CMakeLists.txt", - "Example/", - "LICENSE", - "Protos/CMakeLists.txt", - "Protos/Podfile", - "Protos/README.md", - "Protos/build_protos.py", - "Protos/cpp/", - "Protos/lib/", - "Protos/nanopb_cpp_generator.py", - "Protos/protos/", - "README.md", - "Source/CMakeLists.txt", - "Swift/", - "core/CMakeLists.txt", - "core/src/util/config_detected.h.in", - "core/test/", - "fuzzing/", - "test.sh", - // Swift PM doesn't recognize hpp files, so we're relying on search paths - // to find third_party/nlohmann_json/json.hpp. - "third_party/", + return .target( + name: "FirebaseFirestore", + dependencies: [ + "FirebaseAppCheckInterop", + "FirebaseCore", + "leveldb", + .product(name: "nanopb", package: "nanopb"), + .product(name: "abseil", package: "abseil-cpp-SwiftPM"), + .product(name: "gRPC-cpp", package: "grpc-ios"), + ], + path: "Firestore", + exclude: [ + "CHANGELOG.md", + "CMakeLists.txt", + "Example/", + "LICENSE", + "Protos/CMakeLists.txt", + "Protos/Podfile", + "Protos/README.md", + "Protos/build_protos.py", + "Protos/cpp/", + "Protos/lib/", + "Protos/nanopb_cpp_generator.py", + "Protos/protos/", + "README.md", + "Source/CMakeLists.txt", + "Swift/", + "core/CMakeLists.txt", + "core/src/util/config_detected.h.in", + "core/test/", + "fuzzing/", + "test.sh", + // Swift PM doesn't recognize hpp files, so we're relying on search paths + // to find third_party/nlohmann_json/json.hpp. + "third_party/", - // Exclude alternate implementations for other platforms - "core/src/remote/connectivity_monitor_noop.cc", - "core/src/util/filesystem_win.cc", - "core/src/util/log_stdio.cc", - "core/src/util/secure_random_openssl.cc", - ], - sources: [ - "Source/", - "Protos/nanopb/", - "core/include/", - "core/src", - ], - publicHeadersPath: "Source/Public", - cSettings: [ - .headerSearchPath("../"), - .headerSearchPath("Source/Public/FirebaseFirestore"), - .headerSearchPath("Protos/nanopb"), - .define("PB_FIELD_32BIT", to: "1"), - .define("PB_NO_PACKED_STRUCTS", to: "1"), - .define("PB_ENABLE_MALLOC", to: "1"), - .define("FIRFirestore_VERSION", to: firebaseVersion), - ], - linkerSettings: [ - .linkedFramework( - "SystemConfiguration", - .when(platforms: [.iOS, .macOS, .tvOS, .firebaseVisionOS]) - ), - .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .firebaseVisionOS])), - .linkedLibrary("c++"), - ] - ), - .target( - name: "FirebaseFirestore", - dependencies: [ - "FirebaseCore", - "FirebaseCoreExtension", - "FirebaseFirestoreInternal", - "FirebaseSharedSwift", - ], - path: "Firestore", - exclude: [ - "CHANGELOG.md", - "CMakeLists.txt", - "Example/", - "LICENSE", - "Protos/", - "README.md", - "Source/", - "core/", - "fuzzing/", - "test.sh", - "Swift/CHANGELOG.md", - "Swift/Tests/", - "third_party/nlohmann_json", - ], - sources: [ - "Swift/Source/", - ] - ), - ] + // Exclude alternate implementations for other platforms + "core/src/remote/connectivity_monitor_noop.cc", + "core/src/util/filesystem_win.cc", + "core/src/util/log_stdio.cc", + "core/src/util/secure_random_openssl.cc", + ], + sources: [ + "Source/", + "Protos/nanopb/", + "core/include/", + "core/src", + ], + publicHeadersPath: "Source/Public", + cSettings: [ + .headerSearchPath("../"), + .headerSearchPath("Source/Public/FirebaseFirestore"), + .headerSearchPath("Protos/nanopb"), + .define("PB_FIELD_32BIT", to: "1"), + .define("PB_NO_PACKED_STRUCTS", to: "1"), + .define("PB_ENABLE_MALLOC", to: "1"), + .define("FIRFirestore_VERSION", to: firebaseVersion), + ], + linkerSettings: [ + .linkedFramework( + "SystemConfiguration", + .when(platforms: [.iOS, .macOS, .tvOS, .firebaseVisionOS]) + ), + .linkedFramework("UIKit", .when(platforms: [.iOS, .tvOS, .firebaseVisionOS])), + .linkedLibrary("c++"), + ] + ) } else if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil { // This is set when running `scripts/check_firestore_symbols.sh`. - return [ - .binaryTarget( - name: "FirebaseFirestore", - // The `xcframework` should be moved to the root of the repo. - path: "FirebaseFirestore.xcframework" - ), - ] + return .binaryTarget( + name: "FirebaseFirestore", + // The `xcframework` should be moved to the root of the repo. + path: "FirebaseFirestore.xcframework" + ) } - return [ - .binaryTarget( - name: "FirebaseFirestore", - url: "https://dl.google.com/firebase/ios/experimental/bin/firestore/10.16.0/FirebaseFirestore.zip", - checksum: "62f1ce3478de5ff9672644cd545e10ac0c39ed7c411661d0136ded28489b2c12" - ), - ] + return .binaryTarget( + name: "FirebaseFirestore", + url: "https://dl.google.com/firebase/ios/bin/firestore/10.16.0/FirebaseFirestore.zip", + checksum: "0a6616a4bbf1adb2f0a502e9ad8e5ab144a8c4993a15bb4b795bae86b66ecab8" + ) } extension Platform { diff --git a/ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift b/ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift index 0860f9197bb..af1befcdbe1 100755 --- a/ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift +++ b/ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift @@ -48,7 +48,7 @@ public let shared = Manifest( Pod("FirebaseDatabaseSwift", allowWarnings: true, zip: true), Pod("FirebaseDynamicLinks", platforms: ["ios"], zip: true), Pod("FirebaseFirestore", allowWarnings: true), - Pod("FirebaseFirestoreSwift", allowWarnings: true, zip: true), + Pod("FirebaseFirestoreSwift", zip: true), Pod("FirebaseFunctions", zip: true), Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"]), Pod(