diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index 9f9efbb0fe1..baafa371488 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -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"' } s.resource_bundles = { diff --git a/FirebaseFirestoreInternal.podspec b/FirebaseFirestoreInternal.podspec index fa8de69cdd1..a3e0c6062da 100644 --- a/FirebaseFirestoreInternal.podspec +++ b/FirebaseFirestoreInternal.podspec @@ -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"' } diff --git a/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_IntegrationTests_macOS.xcscheme b/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_IntegrationTests_macOS.xcscheme index 809a72983a5..b6e7d07944b 100644 --- a/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_IntegrationTests_macOS.xcscheme +++ b/Firestore/Example/Firestore.xcodeproj/xcshareddata/xcschemes/Firestore_IntegrationTests_macOS.xcscheme @@ -27,6 +27,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -39,17 +48,6 @@ - - - - - - - - #if defined(__cplusplus) @@ -26,15 +29,12 @@ namespace api { class Firestore; class PipelineResult; } // namespace api - namespace core { template class EventListener; } // namespace core - } // namespace firestore } // namespace firebase - namespace api = firebase::firestore::api; namespace core = firebase::firestore::core; @@ -42,24 +42,30 @@ 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>) + // NOLINTNEXTLINE(whitespace/parens) wrapPipelineCallback:(std::shared_ptr)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_ diff --git a/Firestore/Source/API/FIRCallbackWrapper.mm b/Firestore/core/src/api/FIRCallbackWrapper.mm similarity index 66% rename from Firestore/Source/API/FIRCallbackWrapper.mm rename to Firestore/core/src/api/FIRCallbackWrapper.mm index cf6a8aa0c8b..f0ad0571af8 100644 --- a/Firestore/Source/API/FIRCallbackWrapper.mm +++ b/Firestore/core/src/api/FIRCallbackWrapper.mm @@ -20,8 +20,8 @@ #include #include -#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)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)firestore + completion:(void (^)(CppPipelineResult* _Nullable result, + NSError* _Nullable error))completion { class Converter : public EventListener { public: - explicit Converter(std::shared_ptr firestore, PipelineBlock completion) + explicit Converter(std::shared_ptr firestore, + PipelineBlock completion) : firestore_(firestore), completion_(completion) { } diff --git a/Firestore/core/interfaceForSwift/api/FirebaseFirestoreCpp.h b/Firestore/core/src/api/FirebaseFirestoreCpp.h similarity index 53% rename from Firestore/core/interfaceForSwift/api/FirebaseFirestoreCpp.h rename to Firestore/core/src/api/FirebaseFirestoreCpp.h index ed9cc6e6622..a3d46715a68 100644 --- a/Firestore/core/interfaceForSwift/api/FirebaseFirestoreCpp.h +++ b/Firestore/core/src/api/FirebaseFirestoreCpp.h @@ -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" +#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" -#endif // FIRESTORE_CORE_INTERFACEFORSWIFT_API_FIREBASEFIRESTORECPP_H_ +#endif // FIRESTORE_CORE_SRC_API_FIREBASEFIRESTORECPP_H_ diff --git a/Firestore/core/interfaceForSwift/api/CollectionStage.cc b/Firestore/core/src/api/collection_stage.cc similarity index 93% rename from Firestore/core/interfaceForSwift/api/CollectionStage.cc rename to Firestore/core/src/api/collection_stage.cc index f8e5976a62e..60f95ecc4e6 100644 --- a/Firestore/core/interfaceForSwift/api/CollectionStage.cc +++ b/Firestore/core/src/api/collection_stage.cc @@ -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 namespace firebase { diff --git a/Firestore/core/interfaceForSwift/api/CollectionStage.h b/Firestore/core/src/api/collection_stage.h similarity index 80% rename from Firestore/core/interfaceForSwift/api/CollectionStage.h rename to Firestore/core/src/api/collection_stage.h index 50cbed69408..02331926d50 100644 --- a/Firestore/core/interfaceForSwift/api/CollectionStage.h +++ b/Firestore/core/src/api/collection_stage.h @@ -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 -#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_ diff --git a/Firestore/core/src/api/firestore.h b/Firestore/core/src/api/firestore.h index aca18075ce5..0547c88c728 100644 --- a/Firestore/core/src/api/firestore.h +++ b/Firestore/core/src/api/firestore.h @@ -21,9 +21,9 @@ #include #include -#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" diff --git a/Firestore/core/interfaceForSwift/api/FirestorePipeline.cc b/Firestore/core/src/api/firestore_pipeline.cc similarity index 93% rename from Firestore/core/interfaceForSwift/api/FirestorePipeline.cc rename to Firestore/core/src/api/firestore_pipeline.cc index 3d06f049eef..13c7d8063d1 100644 --- a/Firestore/core/interfaceForSwift/api/FirestorePipeline.cc +++ b/Firestore/core/src/api/firestore_pipeline.cc @@ -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 diff --git a/Firestore/core/interfaceForSwift/api/FirestorePipeline.h b/Firestore/core/src/api/firestore_pipeline.h similarity index 79% rename from Firestore/core/interfaceForSwift/api/FirestorePipeline.h rename to Firestore/core/src/api/firestore_pipeline.h index 86bec3cf952..b6d91960cd3 100644 --- a/Firestore/core/interfaceForSwift/api/FirestorePipeline.h +++ b/Firestore/core/src/api/firestore_pipeline.h @@ -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 -#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_ diff --git a/Firestore/core/interfaceForSwift/api/Pipeline.cc b/Firestore/core/src/api/pipeline.cc similarity index 95% rename from Firestore/core/interfaceForSwift/api/Pipeline.cc rename to Firestore/core/src/api/pipeline.cc index 63193ecdbb0..d423680be37 100644 --- a/Firestore/core/interfaceForSwift/api/Pipeline.cc +++ b/Firestore/core/src/api/pipeline.cc @@ -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 -#include +#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" diff --git a/Firestore/core/interfaceForSwift/api/Pipeline.h b/Firestore/core/src/api/pipeline.h similarity index 85% rename from Firestore/core/interfaceForSwift/api/Pipeline.h rename to Firestore/core/src/api/pipeline.h index cd718545b4a..5f26df400ef 100644 --- a/Firestore/core/interfaceForSwift/api/Pipeline.h +++ b/Firestore/core/src/api/pipeline.h @@ -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 #include #include -#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_ diff --git a/Firestore/core/interfaceForSwift/api/PipelineResult.cc b/Firestore/core/src/api/pipeline_result.cc similarity index 94% rename from Firestore/core/interfaceForSwift/api/PipelineResult.cc rename to Firestore/core/src/api/pipeline_result.cc index d8f8323645a..2b83b03e1dd 100644 --- a/Firestore/core/interfaceForSwift/api/PipelineResult.cc +++ b/Firestore/core/src/api/pipeline_result.cc @@ -12,10 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - +#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 { diff --git a/Firestore/core/interfaceForSwift/api/PipelineResult.h b/Firestore/core/src/api/pipeline_result.h similarity index 87% rename from Firestore/core/interfaceForSwift/api/PipelineResult.h rename to Firestore/core/src/api/pipeline_result.h index 830566d0375..edd365b4218 100644 --- a/Firestore/core/interfaceForSwift/api/PipelineResult.h +++ b/Firestore/core/src/api/pipeline_result.h @@ -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 @@ -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_ diff --git a/Firestore/core/interfaceForSwift/api/PipelineSource.cc b/Firestore/core/src/api/pipeline_source.cc similarity index 89% rename from Firestore/core/interfaceForSwift/api/PipelineSource.cc rename to Firestore/core/src/api/pipeline_source.cc index f744a2cb15d..51aa16c47ab 100644 --- a/Firestore/core/interfaceForSwift/api/PipelineSource.cc +++ b/Firestore/core/src/api/pipeline_source.cc @@ -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 -#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" diff --git a/Firestore/core/interfaceForSwift/api/PipelineSource.h b/Firestore/core/src/api/pipeline_source.h similarity index 82% rename from Firestore/core/interfaceForSwift/api/PipelineSource.h rename to Firestore/core/src/api/pipeline_source.h index c4d072230bf..a3fc008d6ec 100644 --- a/Firestore/core/interfaceForSwift/api/PipelineSource.h +++ b/Firestore/core/src/api/pipeline_source.h @@ -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 #include #include -#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_ diff --git a/Firestore/core/interfaceForSwift/api/Stage.cc b/Firestore/core/src/api/stage.cc similarity index 92% rename from Firestore/core/interfaceForSwift/api/Stage.cc rename to Firestore/core/src/api/stage.cc index 15a51380a50..551ca8f2fa5 100644 --- a/Firestore/core/interfaceForSwift/api/Stage.cc +++ b/Firestore/core/src/api/stage.cc @@ -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 { diff --git a/Firestore/core/interfaceForSwift/api/Stage.h b/Firestore/core/src/api/stage.h similarity index 82% rename from Firestore/core/interfaceForSwift/api/Stage.h rename to Firestore/core/src/api/stage.h index b9a8e83e112..53711a82166 100644 --- a/Firestore/core/interfaceForSwift/api/Stage.h +++ b/Firestore/core/src/api/stage.h @@ -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_ diff --git a/Package.swift b/Package.swift index a2c672f8f9b..559ac912cea 100644 --- a/Package.swift +++ b/Package.swift @@ -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 { @@ -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(), ] } diff --git a/scripts/sync_project.rb b/scripts/sync_project.rb index fdf03f8d33f..ecc47709274 100755 --- a/scripts/sync_project.rb +++ b/scripts/sync_project.rb @@ -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"',