Skip to content

Code reorg to move all public headers under src/api #14371

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

Open
wants to merge 4 commits into
base: cheryllin/firestoreSwiftCpp
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
s.pod_target_xcconfig = {
# Enables C++ <-> Swift interop (by default it's only C)
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
'HEADER_SEARCH_PATHS' => '${PODS_TARGET_SRCROOT} "${PODS_TARGET_SRCROOT}/Firestore/core/src/api"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed when interfaceForSwift did not need to be here before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure exactly why, I suspect it is because headers under interfaceForSwift were using relative paths before. After the move, they are using absolute paths from SRCROOT. But we need the second search path here because the umbrella header still include FirebaseFirestoreCpp.h without absolute path.

}

s.resource_bundles = {
5 changes: 3 additions & 2 deletions FirebaseFirestoreInternal.podspec
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
# framework.
s.public_header_files = [
'Firestore/Source/Public/FirebaseFirestore/*.h',
'Firestore/core/interfaceForSwift/api/*.h'
'Firestore/core/src/api/FirebaseFirestoreCpp.h'
]

# source_files contains most of the header and source files for the project.
@@ -54,8 +54,8 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
'Firestore/Protos/nanopb/**/*.cc',
'Firestore/core/include/**/*.{cc,mm}',
'Firestore/core/src/**/*.{cc,mm}',
'Firestore/core/src/api/*.{cc,mm}',
'FirebaseAuth/Interop/**/*.h',
'Firestore/core/interfaceForSwift/**/*.{cc,h}',
]

# Internal headers that aren't necessarily globally unique. Most C++ internal
@@ -132,6 +132,7 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
'HEADER_SEARCH_PATHS' =>
'"${PODS_TARGET_SRCROOT}" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Source/Public" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/core/src/api" ' +
'"${PODS_ROOT}/nanopb" ' +
'"${PODS_TARGET_SRCROOT}/Firestore/Protos/nanopb"'
}
Original file line number Diff line number Diff line change
@@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "54B8E4A9224BDC4100930F18"
BuildableName = "Firestore_IntegrationTests_macOS.xctest"
BlueprintName = "Firestore_IntegrationTests_macOS"
ReferencedContainer = "container:Firestore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "54B8E4A9224BDC4100930F18"
BuildableName = "Firestore_IntegrationTests_macOS.xctest"
BlueprintName = "Firestore_IntegrationTests_macOS"
ReferencedContainer = "container:Firestore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -70,8 +68,6 @@
ReferencedContainer = "container:Firestore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
#import "FIRAggregateQuery.h"
#import "FIRAggregateQuerySnapshot.h"
#import "FIRAggregateSource.h"
#import "FIRCallbackWrapper.h"
#import "FIRCollectionReference.h"
#import "FIRDocumentChange.h"
#import "FIRDocumentReference.h"
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

#if SWIFT_PACKAGE
import FirebaseFirestoreCpp
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import FirebaseSharedSwift
import Foundation

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
import Foundation

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/DocumentID.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/EncoderDecoder.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/ExplicitNull.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/FieldValue+Encodable.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/GeoPoint+Codable.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/Codable/VectorValue+Codable.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import Foundation
#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
import SwiftUI

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
import SwiftUI

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftAPI/FieldValue+Swift.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftAPI/Pipeline.swift
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

#if SWIFT_PACKAGE
import FirebaseFirestoreCpp
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftAPI/VectorValue+Swift.swift
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
*/

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
2 changes: 1 addition & 1 deletion Firestore/Swift/Source/SwiftHeaderWorkaround.swift
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
// limitations under the License.

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@
* limitations under the License.
*/

#ifndef FIRESTORE_CORE_SRC_API_FIRCALLBACKWRAPPER_H_
#define FIRESTORE_CORE_SRC_API_FIRCALLBACKWRAPPER_H_

#import <Foundation/Foundation.h>

#if defined(__cplusplus)
@@ -26,40 +29,43 @@ namespace api {
class Firestore;
class PipelineResult;
} // namespace api

namespace core {
template <typename T>
class EventListener;
} // namespace core

} // namespace firestore
} // namespace firebase

namespace api = firebase::firestore::api;
namespace core = firebase::firestore::core;

NS_ASSUME_NONNULL_BEGIN

typedef api::PipelineResult CppPipelineResult;

typedef void (^PipelineBlock)(CppPipelineResult *_Nullable result, NSError *_Nullable error)
typedef void (^PipelineBlock)(CppPipelineResult* _Nullable result,
NSError* _Nullable error)
NS_SWIFT_UNAVAILABLE("Use Swift's closure syntax instead.");

NS_SWIFT_SENDABLE
NS_SWIFT_NAME(CallbackWrapper)
@interface FIRCallbackWrapper : NSObject

// Note: Marking callbacks in callback-based APIs as `Sendable` can help prevent crashes when they
// are invoked on a different thread than the one they were originally defined in. If this callback
// is expected to be called on a different thread, it should be marked as `Sendable` to ensure
// thread safety.
// Note: Marking callbacks in callback-based APIs as `Sendable` can help prevent
// crashes when they are invoked on a different thread than the one they were
// originally defined in. If this callback is expected to be called on a
// different thread, it should be marked as `Sendable` to ensure thread safety.
+ (std::shared_ptr<core::EventListener<api::PipelineResult>>)
// NOLINTNEXTLINE(whitespace/parens)
wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore
completion:(void (^NS_SWIFT_SENDABLE)(CppPipelineResult *_Nullable result,
NSError *_Nullable error))completion
// NOLINTNEXTLINE(whitespace/parens)
completion:(void (^NS_SWIFT_SENDABLE)(
CppPipelineResult* _Nullable result,
NSError* _Nullable error))completion
NS_SWIFT_NAME(wrapPipelineCallback(firestore:completion:));

@end

NS_ASSUME_NONNULL_END
#endif
#endif // defined(__cplusplus)

#endif // FIRESTORE_CORE_SRC_API_FIRCALLBACKWRAPPER_H_
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@
#include <utility>
#include <vector>

#include "Firestore/core/interfaceForSwift/api/Pipeline.h"
#include "Firestore/core/interfaceForSwift/api/PipelineResult.h"
#include "Firestore/core/src/api/pipeline.h"
#include "Firestore/core/src/api/pipeline_result.h"
#include "Firestore/core/src/core/event_listener.h"
#include "Firestore/core/src/util/error_apple.h"
#include "Firestore/core/src/util/statusor.h"
@@ -34,18 +34,22 @@

@implementation FIRCallbackWrapper

// In public Swift documentation for integrating Swift and C++, using raw pointers in C++ is
// generally considered unsafe. However, during an experiment where the result was passed as a value
// instead of a pointer, a double free error occurred. This issue could not be traced effectively
// because the implementation resides within the Swift-C++ transition layer. In this specific use
// case, the C++ OnEvent() scope is destroyed after the Swift callback has been destroyed. Due to
// this ordering, using a raw pointer is a safe workaround for now.
+ (PipelineSnapshotListener)wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore
completion:(void (^)(CppPipelineResult *_Nullable result,
NSError *_Nullable error))completion {
// In public Swift documentation for integrating Swift and C++, using raw
// pointers in C++ is generally considered unsafe. However, during an experiment
// where the result was passed as a value instead of a pointer, a double free
// error occurred. This issue could not be traced effectively because the
// implementation resides within the Swift-C++ transition layer. In this
// specific use case, the C++ OnEvent() scope is destroyed after the Swift
// callback has been destroyed. Due to this ordering, using a raw pointer is a
// safe workaround for now.
+ (PipelineSnapshotListener)
wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore
completion:(void (^)(CppPipelineResult* _Nullable result,
NSError* _Nullable error))completion {
class Converter : public EventListener<CppPipelineResult> {
public:
explicit Converter(std::shared_ptr<api::Firestore> firestore, PipelineBlock completion)
explicit Converter(std::shared_ptr<api::Firestore> firestore,
PipelineBlock completion)
: firestore_(firestore), completion_(completion) {
}

Original file line number Diff line number Diff line change
@@ -14,14 +14,15 @@
* limitations under the License.
*/

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_
#ifndef FIRESTORE_CORE_SRC_API_FIREBASEFIRESTORECPP_H_
#define FIRESTORE_CORE_SRC_API_FIREBASEFIRESTORECPP_H_

#import "CollectionStage.h"
#import "FirestorePipeline.h"
#import "Pipeline.h"
#import "PipelineResult.h"
#import "PipelineSource.h"
#import "Stage.h"
#import "Firestore/core/src/api/FIRCallbackWrapper.h"

Check failure on line 20 in Firestore/core/src/api/FirebaseFirestoreCpp.h

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

'Firestore/core/src/api/FIRCallbackWrapper.h' file not found

Check failure on line 20 in Firestore/core/src/api/FirebaseFirestoreCpp.h

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

'Firestore/core/src/api/FIRCallbackWrapper.h' file not found

Check failure on line 20 in Firestore/core/src/api/FirebaseFirestoreCpp.h

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

'Firestore/core/src/api/FIRCallbackWrapper.h' file not found

Check failure on line 20 in Firestore/core/src/api/FirebaseFirestoreCpp.h

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

'Firestore/core/src/api/FIRCallbackWrapper.h' file not found

Check failure on line 20 in Firestore/core/src/api/FirebaseFirestoreCpp.h

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

'Firestore/core/src/api/FIRCallbackWrapper.h' file not found
#import "Firestore/core/src/api/collection_stage.h"
#import "Firestore/core/src/api/firestore_pipeline.h"
#import "Firestore/core/src/api/pipeline.h"
#import "Firestore/core/src/api/pipeline_result.h"
#import "Firestore/core/src/api/pipeline_source.h"
#import "Firestore/core/src/api/stage.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the main reasons for restructuring the iOS SDK is to enable Swift source files to access all C++ APIs. Are there any technical limitations or restrictions in moving the existing API headers, like document reference header, into this file?


#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_
#endif // FIRESTORE_CORE_SRC_API_FIREBASEFIRESTORECPP_H_
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "Firestore/core/interfaceForSwift/api/CollectionStage.h"
#include "Firestore/core/src/api/collection_stage.h"
#include <iostream>

namespace firebase {
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_COLLECTIONSTAGE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_COLLECTIONSTAGE_H_
#ifndef FIRESTORE_CORE_SRC_API_COLLECTION_STAGE_H_
#define FIRESTORE_CORE_SRC_API_COLLECTION_STAGE_H_

#include <string>
#include "Stage.h"
#include "Firestore/core/src/api/stage.h"

namespace firebase {
namespace firestore {
@@ -36,4 +36,4 @@ class Collection : public Stage {
} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_COLLECTIONSTAGE_H_
#endif // FIRESTORE_CORE_SRC_API_COLLECTION_STAGE_H_
2 changes: 1 addition & 1 deletion Firestore/core/src/api/firestore.h
Original file line number Diff line number Diff line change
@@ -21,9 +21,9 @@
#include <mutex>
#include <string>

#include "Firestore/core/interfaceForSwift/api/PipelineSource.h"
#include "Firestore/core/src/api/api_fwd.h"
#include "Firestore/core/src/api/load_bundle_task.h"
#include "Firestore/core/src/api/pipeline_source.h"
#include "Firestore/core/src/api/settings.h"
#include "Firestore/core/src/core/core_fwd.h"
#include "Firestore/core/src/credentials/credentials_fwd.h"
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "Firestore/core/interfaceForSwift/api/FirestorePipeline.h"
#include "Firestore/core/src/api/firestore_pipeline.h"

#include <memory>

Original file line number Diff line number Diff line change
@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIRESTOREPIPELINE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIRESTOREPIPELINE_H_
#ifndef FIRESTORE_CORE_SRC_API_FIRESTORE_PIPELINE_H_
#define FIRESTORE_CORE_SRC_API_FIRESTORE_PIPELINE_H_

#include <memory>

#include "PipelineSource.h"
#include "Firestore/core/src/api/pipeline_source.h"

namespace firebase {
namespace firestore {
@@ -34,4 +34,4 @@ class FirestorePipeline {
} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIRESTOREPIPELINE_H_
#endif // FIRESTORE_CORE_SRC_API_FIRESTORE_PIPELINE_H_
Original file line number Diff line number Diff line change
@@ -12,15 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "Firestore/core/interfaceForSwift/api/Pipeline.h"

#include <future>
#include <memory>
#include "Firestore/core/src/api/pipeline.h"

#include "Firestore/core/include/firebase/firestore/timestamp.h"
#include "Firestore/core/interfaceForSwift/api/PipelineResult.h"
#include "Firestore/core/src/api/firestore.h"
#include "Firestore/core/src/api/listener_registration.h"
#include "Firestore/core/src/api/pipeline_result.h"
#include "Firestore/core/src/api/source.h"
#include "Firestore/core/src/core/event_listener.h"
#include "Firestore/core/src/core/listen_options.h"
Original file line number Diff line number Diff line change
@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINE_H_
#ifndef FIRESTORE_CORE_SRC_API_PIPELINE_H_
#define FIRESTORE_CORE_SRC_API_PIPELINE_H_

#include <functional>
#include <memory>
#include <vector>
#include "PipelineResult.h"
#include "Stage.h"
#include "Firestore/core/src/api/pipeline_result.h"
#include "Firestore/core/src/api/stage.h"

namespace firebase {
namespace firestore {
@@ -57,4 +57,4 @@ class Pipeline {
} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINE_H_
#endif // FIRESTORE_CORE_SRC_API_PIPELINE_H_
Original file line number Diff line number Diff line change
@@ -12,10 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <iostream>

#include "Firestore/core/src/api/pipeline_result.h"
#include "Firestore/core/include/firebase/firestore/timestamp.h"
#include "Firestore/core/interfaceForSwift/api/PipelineResult.h"

namespace firebase {
namespace firestore {
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINERESULT_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINERESULT_H_
#ifndef FIRESTORE_CORE_SRC_API_PIPELINE_RESULT_H_
#define FIRESTORE_CORE_SRC_API_PIPELINE_RESULT_H_

#include <memory>

@@ -48,4 +48,4 @@ class PipelineResult {

} // namespace firestore
} // namespace firebase
#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINERESULT_H_
#endif // FIRESTORE_CORE_SRC_API_PIPELINE_RESULT_H_
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "Firestore/core/interfaceForSwift/api/PipelineSource.h"
#include "Firestore/core/src/api/pipeline_source.h"

#include <string>

#include "Firestore/core/interfaceForSwift/api/CollectionStage.h"
#include "Firestore/core/src/api/collection_stage.h"
#include "Firestore/core/src/api/document_reference.h"
#include "Firestore/core/src/api/firestore.h"

Original file line number Diff line number Diff line change
@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINESOURCE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINESOURCE_H_
#ifndef FIRESTORE_CORE_SRC_API_PIPELINE_SOURCE_H_
#define FIRESTORE_CORE_SRC_API_PIPELINE_SOURCE_H_

#include <memory>
#include <string>
#include <vector>

#include "Pipeline.h"
#include "Firestore/core/src/api/pipeline.h"

namespace firebase {
namespace firestore {
@@ -44,4 +44,4 @@ class PipelineSource {
} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_PIPELINESOURCE_H_
#endif // FIRESTORE_CORE_SRC_API_PIPELINE_SOURCE_H_
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "Firestore/core/interfaceForSwift/api/Stage.h"
#include "Firestore/core/src/api/stage.h"

namespace firebase {
namespace firestore {
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef FIRESTORE_CORE_INTERFACEFORSWIFT_API_STAGE_H_
#define FIRESTORE_CORE_INTERFACEFORSWIFT_API_STAGE_H_
#ifndef FIRESTORE_CORE_SRC_API_STAGE_H_
#define FIRESTORE_CORE_SRC_API_STAGE_H_

namespace firebase {
namespace firestore {
@@ -30,4 +30,4 @@ class Stage {
} // namespace firestore
} // namespace firebase

#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_STAGE_H_
#endif // FIRESTORE_CORE_SRC_API_STAGE_H_
44 changes: 22 additions & 22 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1356,7 +1356,7 @@ func abseilDependency() -> Package.Dependency {
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
packageInfo = (
"https://github.com/firebase/abseil-cpp-SwiftPM.git",
"0.20240116.1" ..< "0.20240117.0"
"0.20240722.2" ..< "0.20240723.0"
)
} else {
packageInfo = (
@@ -1374,7 +1374,7 @@ func grpcDependency() -> Package.Dependency {
// If building Firestore from source, abseil will need to be built as source
// as the headers in the binary version of abseil are unusable.
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.65.0" ..< "1.66.0")
packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.69.0" ..< "1.70.0")
} else {
packageInfo = ("https://github.com/google/grpc-binary.git", "1.65.1" ..< "1.66.0")
}
@@ -1401,24 +1401,21 @@ func firestoreWrapperTarget() -> Target {
)
}

func firebaseFirestoreCppTarget() -> Target {
func firebaseFirestoreObjCppTarget() -> Target {
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
return .target(
name: "FirebaseFirestoreCpp",
name: "FirebaseFirestoreObjCpp",
dependencies: [
"FirebaseAppCheckInterop",
"FirebaseCore",
"leveldb",
"FirebaseFirestoreInternalWrapper",
.product(name: "nanopb", package: "nanopb"),
.product(name: "gRPC-cpp", package: "grpc-ios"),
"FirebaseFirestoreCpp",
],
path: "Firestore/core/interfaceForSwift",
publicHeadersPath: "api", // Path to the public headers
path: "Firestore/Source",
publicHeadersPath: "Public", // Path to the public headers
cxxSettings: [
.headerSearchPath("../../../"),
.headerSearchPath("../../Protos/nanopb"),
.headerSearchPath("api"), // Ensure the header search path is correct
.headerSearchPath("../../"),
.headerSearchPath("Public/FirebaseFirestore/"),
.headerSearchPath("../Protos/nanopb"),
]
)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a todo here to remind me to change the binary building process?

@@ -1451,7 +1448,7 @@ func firestoreTargets() -> [Target] {
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
return [
.target(
name: "FirebaseFirestoreInternalWrapper",
name: "FirebaseFirestoreCpp",
dependencies: [
"FirebaseAppCheckInterop",
"FirebaseCore",
@@ -1462,6 +1459,8 @@ func firestoreTargets() -> [Target] {
],
path: "Firestore",
exclude: [
// Exclude legacy objc layer
"Source/",
"CHANGELOG.md",
"CMakeLists.txt",
"Example/",
@@ -1480,7 +1479,6 @@ func firestoreTargets() -> [Target] {
"core/CMakeLists.txt",
"core/src/util/config_detected.h.in",
"core/test/",
"core/interfaceForSwift/",
"fuzzing/",
"test.sh",
// Swift PM doesn't recognize hpp files, so we're relying on search paths
@@ -1494,15 +1492,13 @@ func firestoreTargets() -> [Target] {
"core/src/util/secure_random_openssl.cc",
],
sources: [
"Source/",
"Protos/nanopb/",
"core/include/",
"core/src",
],
publicHeadersPath: "Source/Public",
publicHeadersPath: "core/src/api",
cSettings: [
.headerSearchPath("../"),
.headerSearchPath("Source/Public/FirebaseFirestore"),
.headerSearchPath("Protos/nanopb"),
.define("PB_FIELD_32BIT", to: "1"),
.define("PB_NO_PACKED_STRUCTS", to: "1"),
@@ -1518,15 +1514,15 @@ func firestoreTargets() -> [Target] {
.linkedLibrary("c++"),
]
),
firebaseFirestoreCppTarget(),
firebaseFirestoreObjCppTarget(),
.target(
name: "FirebaseFirestore",
dependencies: [
"FirebaseCore",
"FirebaseCoreExtension",
"FirebaseFirestoreInternalWrapper",
"FirebaseSharedSwift",
"FirebaseFirestoreCpp",
"FirebaseFirestoreObjCpp",
"FirebaseSharedSwift",
],
path: "Firestore",
exclude: [
@@ -1548,6 +1544,10 @@ func firestoreTargets() -> [Target] {
"Swift/Source/",
],
resources: [.process("Source/Resources/PrivacyInfo.xcprivacy")],
cxxSettings: [
.headerSearchPath("../"),
.headerSearchPath("Protos/nanopb"),
],
swiftSettings: [
.interoperabilityMode(.Cxx), // C++ interoperability setting
]
@@ -1619,6 +1619,6 @@ func firestoreTargets() -> [Target] {
publicHeadersPath: "."
),
firestoreInternalTarget,
firebaseFirestoreCppTarget(),
firebaseFirestoreObjCppTarget(),
]
}
3 changes: 3 additions & 0 deletions scripts/sync_project.rb
Original file line number Diff line number Diff line change
@@ -111,6 +111,9 @@ def sync_firestore(test_only)
# Make public headers available as "FIRQuery.h"
'"${PODS_ROOT}/../../../Firestore/Source/Public/FirebaseFirestore"',

# Make public headers available as "FirebaseFirestoreCpp.h"
'"${PODS_ROOT}/../../../Firestore/core/src/api"',

# Generated protobuf and nanopb output expects to search relative to the
# output path.
'"${PODS_ROOT}/../../../Firestore/Protos/cpp"',

Unchanged files with check annotations Beta

}
int LocalStore::Backfill() const {
return persistence_->Run("Backfill Indexes", [&] {

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-15, Xcode_16, catalyst)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-15, Xcode_16, macOS)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-15, Xcode_16, tvOS)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-15, Xcode_16, visionOS)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-15, Xcode_16, iOS)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-13, Xcode_15.2, iOS)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / spm-source (macos-14, Xcode_15.4, iOS)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]

Check warning on line 589 in Firestore/core/src/local/local_store.cc

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

implicit conversion loses integer precision: 'typename std::enable_if<!std::is_same<void, decltype(block())>::value, decltype(block())>::type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return index_backfiller_->WriteIndexEntries(this);
});
}
static func convertToArrayFromCppVector(_ vector: CppPipelineResult)
-> [PipelineResult] {
// Create a Swift array and populate it by iterating over the C++ vector
var swiftArray: [PipelineResult] = []

Check warning on line 30 in Firestore/Swift/Source/SwiftAPI/PipelineResult.swift

GitHub Actions / spm-source (macos-15, Xcode_16, visionOS)

variable 'swiftArray' was never mutated; consider changing to 'let' constant
// for index in vector.indices {
// let cppResult = vector[index]
// See the License for the specific language governing permissions and
// limitations under the License.
import Firebase

Check failure on line 15 in CoreOnly/Tests/FirebasePodTest/FirebasePodTest/AppDelegate.swift

GitHub Actions / installation-test

could not build Objective-C module 'Firebase'
// Verify that the following Firebase Swift APIs can be found.
import FirebaseAnalytics
androidMinimumVersion = actionCodeSettings?.androidMinimumVersion
androidInstallApp = actionCodeSettings?.androidInstallIfNotAvailable ?? false
handleCodeInApp = actionCodeSettings?.handleCodeInApp ?? false
dynamicLinkDomain = actionCodeSettings?.dynamicLinkDomain

Check warning on line 180 in FirebaseAuth/Sources/Swift/Backend/RPC/GetOOBConfirmationCodeRequest.swift

GitHub Actions / client-app-spm-source-firestore (iOS, ClientApp)

'dynamicLinkDomain' is deprecated: Firebase Dynamic Links is deprecated. Migrate to use Firebase Hosting link and use `linkDomain` to set a custom domain instead.
linkDomain = actionCodeSettings?.linkDomain
super.init(