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
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
1 change: 1 addition & 0 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions FirebaseFirestoreInternal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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"'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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"
Expand All @@ -70,8 +68,6 @@
ReferencedContainer = "container:Firestore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#if SWIFT_PACKAGE
@_exported import FirebaseFirestoreInternalWrapper
@_exported import FirebaseFirestoreObjCpp
#else
@_exported import FirebaseFirestoreInternal
#endif // SWIFT_PACKAGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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_
Loading
Loading