Skip to content

Commit b1f0409

Browse files
committed
Refactor dep. functions
1 parent 74e17b0 commit b1f0409

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

Package.swift

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,31 +1307,37 @@ func googleAppMeasurementDependency() -> Package.Dependency {
13071307
}
13081308

13091309
func abseilDependency() -> Package.Dependency {
1310+
let packageInfo: (url: String, range: Range<Version>)
1311+
1312+
// If building Firestore from source, abseil will need to be built as source
1313+
// as the headers in the binary version of abseil are unusable.
13101314
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
1311-
return .package(
1312-
url: "https://github.com/firebase/abseil-cpp-SwiftPM.git",
1315+
packageInfo = (
1316+
"https://github.com/firebase/abseil-cpp-SwiftPM.git",
13131317
"0.20220623.0" ..< "0.20220624.0"
13141318
)
1319+
} else {
1320+
packageInfo = (
1321+
"https://github.com/google/abseil-cpp-binary.git",
1322+
"1.2022062300.0" ..< "1.2022062400.0"
1323+
)
13151324
}
13161325

1317-
return .package(
1318-
url: "https://github.com/google/abseil-cpp-binary.git",
1319-
"1.2022062300.0" ..< "1.2022062400.0"
1320-
)
1326+
return .package(url: packageInfo.url, packageInfo.range)
13211327
}
13221328

13231329
func grpcDependency() -> Package.Dependency {
1330+
let packageInfo: (url: String, range: Range<Version>)
1331+
1332+
// If building Firestore from source, abseil will need to be built as source
1333+
// as the headers in the binary version of abseil are unusable.
13241334
if ProcessInfo.processInfo.environment["FIREBASE_SOURCE_FIRESTORE"] != nil {
1325-
return .package(
1326-
url: "https://github.com/grpc/grpc-ios.git",
1327-
"1.50.1" ..< "1.51.0"
1328-
)
1335+
packageInfo = ("https://github.com/grpc/grpc-ios.git", "1.50.1" ..< "1.51.0")
1336+
} else {
1337+
packageInfo = ("https://github.com/google/grpc-binary.git", "1.50.1" ..< "1.51.0")
13291338
}
13301339

1331-
return .package(
1332-
url: "https://github.com/google/grpc-binary.git",
1333-
"1.50.1" ..< "1.51.0"
1334-
)
1340+
return .package(url: packageInfo.url, packageInfo.range)
13351341
}
13361342

13371343
func firestoreWrapperTarget() -> Target {

0 commit comments

Comments
 (0)