Skip to content

Commit

Permalink
Fix binary build too
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hui committed Jan 29, 2025
1 parent a719dc7 commit d180cf5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 48 deletions.
3 changes: 1 addition & 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/*.h'
]

# source_files contains most of the header and source files for the project.
Expand All @@ -55,7 +55,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/core/interfaceForSwift/**/*.{cc,h}',
]

# Internal headers that aren't necessarily globally unique. Most C++ internal
Expand Down
97 changes: 51 additions & 46 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,23 @@ func firestoreWrapperTarget() -> Target {
)
}

func firestoreInternalTarget() -> Target {
if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
// This is set when running `scripts/check_firestore_symbols.sh`.
return .binaryTarget(
name: "FirebaseFirestoreInternal",
// The `xcframework` should be moved to the root of the repo.
path: "FirebaseFirestoreInternal.xcframework"
)
} else {
return .binaryTarget(
name: "FirebaseFirestoreInternal",
url: "https://dl.google.com/firebase/ios/bin/firestore/11.6.0/rc0/FirebaseFirestoreInternal.zip",
checksum: "ad9d6cf31120ba0a91dbb9ccbe7ad08276a88565f6c79216929ec93a7d436459"
)
}
}

func firebaseFirestoreObjCppTarget() -> Target {
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
return .target(
Expand All @@ -1417,26 +1434,13 @@ func firebaseFirestoreObjCppTarget() -> Target {
)
} else {
return .target(
name: "FirebaseFirestoreCpp",
dependencies: [
"FirebaseAppCheckInterop",
"FirebaseCore",
"leveldb",
"FirebaseFirestoreInternalWrapper",
.product(name: "nanopb", package: "nanopb"),
.product(
name: "gRPC-C++",
package: "grpc-binary",
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
),
],
path: "Firestore/core/interfaceForSwift",
publicHeadersPath: "api", // Path to the public headers
cxxSettings: [
.headerSearchPath("../../../"),
.headerSearchPath("../../Protos/nanopb"),
.headerSearchPath("api"), // Ensure the header search path is correct
]
name: "FirebaseFirestoreObjCpp",
dependencies: [.target(
name: "FirebaseFirestoreInternal",
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
)],
path: "FirebaseFirestoreInternal",
publicHeadersPath: "."
)
}
}
Expand Down Expand Up @@ -1552,29 +1556,13 @@ func firestoreTargets() -> [Target] {
]
}

let firestoreInternalTarget: Target = {
if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
// This is set when running `scripts/check_firestore_symbols.sh`.
return .binaryTarget(
name: "FirebaseFirestoreInternal",
// The `xcframework` should be moved to the root of the repo.
path: "FirebaseFirestoreInternal.xcframework"
)
} else {
return .binaryTarget(
name: "FirebaseFirestoreInternal",
url: "https://dl.google.com/firebase/ios/bin/firestore/11.7.0/rc0/FirebaseFirestoreInternal.zip",
checksum: "08dd8be97322a1c35bdde315376921d145b5c9dd9bb91bbdbb933380556f24f9"
)
}
}()

let firestoreInternal = firestoreInternalTarget()
return [
.target(
name: "FirebaseFirestore",
dependencies: [
.target(
name: "FirebaseFirestoreInternalWrapper",
name: "FirebaseFirestoreObjCpp",
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
),
.product(
Expand All @@ -1597,6 +1585,10 @@ func firestoreTargets() -> [Target] {
],
path: "Firestore/Swift/Source",
resources: [.process("Resources/PrivacyInfo.xcprivacy")],
cSettings: [
.headerSearchPath("../../../"),
.headerSearchPath("../../Protos/nanopb"),
],
swiftSettings: [
.interoperabilityMode(.Cxx), // C++ interoperability setting
],
Expand All @@ -1607,15 +1599,28 @@ func firestoreTargets() -> [Target] {
]
),
.target(
name: "FirebaseFirestoreInternalWrapper",
dependencies: [.target(
name: "FirebaseFirestoreInternal",
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
)],
path: "FirebaseFirestoreInternal",
publicHeadersPath: "."
name: "FirebaseFirestoreCpp",
dependencies: [
"FirebaseAppCheckInterop",
"FirebaseCore",
"leveldb",
"FirebaseFirestoreInternal",
.product(name: "nanopb", package: "nanopb"),
.product(
name: "gRPC-C++",
package: "grpc-binary",
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
),
],
path: "Firestore/core/src/api",
publicHeadersPath: ".", // Path to the public headers
cxxSettings: [
.headerSearchPath("../../../.."),
.headerSearchPath("../../../Protos/nanopb"),
.headerSearchPath("."), // Ensure the header search path is correct
]
),
firestoreInternalTarget,
firestoreInternal,
firebaseFirestoreObjCppTarget(),
]
}

0 comments on commit d180cf5

Please sign in to comment.