Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Firestore] Consolidate Firestore and FirestoreSwift #11806

Merged
merged 20 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ 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
Expand Down Expand Up @@ -89,6 +90,8 @@ 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
Expand All @@ -111,6 +114,7 @@ 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} " +
Expand Down
7 changes: 2 additions & 5 deletions FirebaseFirestoreSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,

s.requires_arc = true
s.source_files = [
'Firestore/Swift/Source/**/*.swift',
'FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift'
]

s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'FirebaseCoreExtension', '~> 10.0'
s.dependency 'FirebaseFirestore', '~> 10.0'
s.dependency 'FirebaseSharedSwift', '~> 10.0'
s.dependency 'FirebaseFirestore', '~> 10.17'

end
30 changes: 30 additions & 0 deletions FirebaseFirestoreSwift/Sources/FirebaseFirestoreSwift.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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
6 changes: 6 additions & 0 deletions Firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 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
Expand Down
7 changes: 7 additions & 0 deletions Firestore/Swift/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
import Foundation

#if compiler(>=5.5.2) && canImport(_Concurrency)
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/AsyncAwait/Firestore+AsyncAwait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
import Foundation

#if compiler(>=5.5.2) && canImport(_Concurrency)
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/CodablePassThroughTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

import Foundation
import FirebaseSharedSwift
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

internal struct FirestorePassthroughTypes: StructureCodingPassthroughTypeResolver {
static func isPassthroughType<T>(_ t: T) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

public extension CollectionReference {
/// Encodes an instance of `Encodable` and adds a new document to this collection
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/DocumentID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
import FirebaseSharedSwift
@_implementationOnly import FirebaseCoreExtension

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/** Mark DocumentReference to conform to Codable. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

public extension DocumentReference {
/// Fetches and decodes the document referenced by this `DocumentReference`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

public extension DocumentReference {
/// Encodes an instance of `Encodable` and overwrites the encoded data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

public extension DocumentSnapshot {
/// Retrieves all fields in a document and converts them to an instance of
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/EncoderDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
import FirebaseSharedSwift
import Foundation

Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/ExplicitNull.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/// 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,
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/FieldValue+Encodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/** Extends FieldValue to conform to Encodable. */
extension FieldValue: Encodable {
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/GeoPoint+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/**
* A protocol describing the encodable properties of a GeoPoint.
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/ServerTimestamp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/// A type that can initialize itself from a Firestore Timestamp, which makes
/// it suitable for use with the `@ServerTimestamp` property wrapper.
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/Codable/Timestamp+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/**
* A protocol describing the encodable properties of a Timestamp.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
import FirebaseSharedSwift

public extension FirebaseDataDecoder.DateDecodingStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
import FirebaseSharedSwift
import Foundation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

public extension Transaction {
/// Encodes an instance of `Encodable` and overwrites the encoded data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import Foundation
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

public extension WriteBatch {
/// Encodes an instance of `Encodable` and overwrites the encoded data
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/PropertyWrapper/FirestoreQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import SwiftUI
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/// The strategy to use when an error occurs during mapping Firestore documents
/// to the target type of `FirestoreQuery`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import SwiftUI
import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

@available(iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 14.0, watchOS 7.0, *)
internal class FirestoreQueryObservable<T>: ObservableObject {
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Swift/Source/PropertyWrapper/QueryPredicate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

import FirebaseFirestore
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE

/// Query predicates that can be used to filter results fetched by `FirestoreQuery`.
///
Expand Down
29 changes: 29 additions & 0 deletions Firestore/Swift/Source/SPMSwiftHeaderWorkaround.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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
Loading