Skip to content

Commit 4fbce87

Browse files
committed
Fix binary build too
1 parent 357e877 commit 4fbce87

File tree

2 files changed

+61
-48
lines changed

2 files changed

+61
-48
lines changed

FirebaseFirestoreInternal.podspec

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
3030
# framework.
3131
s.public_header_files = [
3232
'Firestore/Source/Public/FirebaseFirestore/*.h',
33-
'Firestore/core/interfaceForSwift/api/*.h'
33+
'Firestore/core/src/api/*.h'
3434
]
3535

3636
# source_files contains most of the header and source files for the project.
@@ -55,7 +55,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
5555
'Firestore/core/include/**/*.{cc,mm}',
5656
'Firestore/core/src/**/*.{cc,mm}',
5757
'FirebaseAuth/Interop/**/*.h',
58-
'Firestore/core/interfaceForSwift/**/*.{cc,h}',
5958
]
6059

6160
# Internal headers that aren't necessarily globally unique. Most C++ internal

Package.swift

+60-46
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,25 @@ func firestoreWrapperTarget() -> Target {
14011401
)
14021402
}
14031403

1404+
func firestoreInternalTarget() -> Target {
1405+
if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
1406+
// This is set when running `scripts/check_firestore_symbols.sh`.
1407+
return .binaryTarget(
1408+
name: "FirebaseFirestoreInternal",
1409+
// The `xcframework` should be moved to the root of the repo.
1410+
path: "FirebaseFirestoreInternal.xcframework"
1411+
)
1412+
} else {
1413+
return .binaryTarget(
1414+
name: "FirebaseFirestoreInternal",
1415+
url: "https://dl.google.com/firebase/ios/bin/firestore/11.6.0/rc0/FirebaseFirestoreInternal.zip",
1416+
checksum: "ad9d6cf31120ba0a91dbb9ccbe7ad08276a88565f6c79216929ec93a7d436459"
1417+
)
1418+
}
1419+
}
1420+
1421+
// Returns a target of Objective CPP API wrapping around Firestore's core C++ target. Most of the
1422+
// public APIs of Firestore come from this target.
14041423
func firebaseFirestoreObjCppTarget() -> Target {
14051424
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
14061425
return .target(
@@ -1420,26 +1439,13 @@ func firebaseFirestoreObjCppTarget() -> Target {
14201439
)
14211440
} else {
14221441
return .target(
1423-
name: "FirebaseFirestoreCpp",
1424-
dependencies: [
1425-
"FirebaseAppCheckInterop",
1426-
"FirebaseCore",
1427-
"leveldb",
1428-
"FirebaseFirestoreInternalWrapper",
1429-
.product(name: "nanopb", package: "nanopb"),
1430-
.product(
1431-
name: "gRPC-C++",
1432-
package: "grpc-binary",
1433-
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
1434-
),
1435-
],
1436-
path: "Firestore/core/interfaceForSwift",
1437-
publicHeadersPath: "api", // Path to the public headers
1438-
cxxSettings: [
1439-
.headerSearchPath("../../../"),
1440-
.headerSearchPath("../../Protos/nanopb"),
1441-
.headerSearchPath("api"), // Ensure the header search path is correct
1442-
]
1442+
name: "FirebaseFirestoreObjCpp",
1443+
dependencies: [.target(
1444+
name: "FirebaseFirestoreInternal",
1445+
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
1446+
)],
1447+
path: "FirebaseFirestoreInternal",
1448+
publicHeadersPath: "."
14431449
)
14441450
}
14451451
}
@@ -1448,6 +1454,8 @@ func firestoreTargets() -> [Target] {
14481454
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
14491455
return [
14501456
.target(
1457+
// The C++ core implementation of the Firestore SDK, this target is where the actual
1458+
// logic of the SDK lives in.
14511459
name: "FirebaseFirestoreCpp",
14521460
dependencies: [
14531461
"FirebaseAppCheckInterop",
@@ -1515,6 +1523,7 @@ func firestoreTargets() -> [Target] {
15151523
]
15161524
),
15171525
firebaseFirestoreObjCppTarget(),
1526+
// Public swift APIs wrapped around core C++ and ObjCpp APIs.
15181527
.target(
15191528
name: "FirebaseFirestore",
15201529
dependencies: [
@@ -1555,29 +1564,15 @@ func firestoreTargets() -> [Target] {
15551564
]
15561565
}
15571566

1558-
let firestoreInternalTarget: Target = {
1559-
if ProcessInfo.processInfo.environment["FIREBASECI_USE_LOCAL_FIRESTORE_ZIP"] != nil {
1560-
// This is set when running `scripts/check_firestore_symbols.sh`.
1561-
return .binaryTarget(
1562-
name: "FirebaseFirestoreInternal",
1563-
// The `xcframework` should be moved to the root of the repo.
1564-
path: "FirebaseFirestoreInternal.xcframework"
1565-
)
1566-
} else {
1567-
return .binaryTarget(
1568-
name: "FirebaseFirestoreInternal",
1569-
url: "https://dl.google.com/firebase/ios/bin/firestore/11.8.0/rc0/FirebaseFirestoreInternal.zip",
1570-
checksum: "860882689232f3192a816cea3db8b6c4cbad2896188dec90f35bbdfd2536169c"
1571-
)
1572-
}
1573-
}()
1574-
1567+
// Binary firestore builds coming from cocoapods builds
1568+
let firestoreInternal = firestoreInternalTarget()
15751569
return [
15761570
.target(
1571+
// Public swift APIs wrapped around core C++ and ObjCpp APIs.
15771572
name: "FirebaseFirestore",
15781573
dependencies: [
15791574
.target(
1580-
name: "FirebaseFirestoreInternalWrapper",
1575+
name: "FirebaseFirestoreObjCpp",
15811576
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
15821577
),
15831578
.product(
@@ -1600,6 +1595,10 @@ func firestoreTargets() -> [Target] {
16001595
],
16011596
path: "Firestore/Swift/Source",
16021597
resources: [.process("Resources/PrivacyInfo.xcprivacy")],
1598+
cSettings: [
1599+
.headerSearchPath("../../../"),
1600+
.headerSearchPath("../../Protos/nanopb"),
1601+
],
16031602
swiftSettings: [
16041603
.interoperabilityMode(.Cxx), // C++ interoperability setting
16051604
],
@@ -1610,15 +1609,30 @@ func firestoreTargets() -> [Target] {
16101609
]
16111610
),
16121611
.target(
1613-
name: "FirebaseFirestoreInternalWrapper",
1614-
dependencies: [.target(
1615-
name: "FirebaseFirestoreInternal",
1616-
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
1617-
)],
1618-
path: "FirebaseFirestoreInternal",
1619-
publicHeadersPath: "."
1612+
// For binary builds, this target exposes the core C++ APIs such that FirebaseFirestore(swift)
1613+
// can use the C++ apis directly without ObjCpp in between.
1614+
name: "FirebaseFirestoreCpp",
1615+
dependencies: [
1616+
"FirebaseAppCheckInterop",
1617+
"FirebaseCore",
1618+
"leveldb",
1619+
"FirebaseFirestoreInternal",
1620+
.product(name: "nanopb", package: "nanopb"),
1621+
.product(
1622+
name: "gRPC-C++",
1623+
package: "grpc-binary",
1624+
condition: .when(platforms: [.iOS, .macCatalyst, .tvOS, .macOS])
1625+
),
1626+
],
1627+
path: "Firestore/core/src/api",
1628+
publicHeadersPath: ".", // Path to the public headers
1629+
cxxSettings: [
1630+
.headerSearchPath("../../../.."),
1631+
.headerSearchPath("../../../Protos/nanopb"),
1632+
.headerSearchPath("."), // Ensure the header search path is correct
1633+
]
16201634
),
1621-
firestoreInternalTarget,
1635+
firestoreInternal,
16221636
firebaseFirestoreObjCppTarget(),
16231637
]
16241638
}

0 commit comments

Comments
 (0)