Skip to content

Commit ddbe5b1

Browse files
authored
Fix ZipBuilder crash and warning (#6653)
1 parent aea0b5c commit ddbe5b1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ZipBuilder/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ enum CocoaPodUtils {
8989
static func cleanPodCache() {
9090
let result = Shell.executeCommandFromScript("pod cache clean --all", outputToConsole: false)
9191
switch result {
92-
case let .error(code):
92+
case let .error(code, _):
9393
fatalError("Could not clean the pod cache, the command exited with \(code). Try running the" +
9494
"command in Terminal to see what's wrong.")
9595
case .success:
@@ -413,15 +413,23 @@ enum CocoaPodUtils {
413413

414414
// Loop through the subspecs passed in and use the actual Pod name.
415415
for pod in pods {
416-
podfile += " pod '\(pod.name)'"
417416
let podspec = String(pod.name.split(separator: "/")[0] + ".podspec")
418417
// Check if we want to use a local version of the podspec.
419418
if let localURL = LaunchArgs.shared.localPodspecPath,
420419
FileManager.default
421420
.fileExists(atPath: localURL.appendingPathComponent(podspec).path) {
422-
podfile += ", :path => '\(localURL.path)'"
421+
podfile += " pod '\(pod.name)', :path => '\(localURL.path)'"
423422
} else if let podVersion = pod.version {
424-
podfile += ", '\(podVersion)'"
423+
podfile += " pod '\(pod.name)', '\(podVersion)'"
424+
} else if pod.name.starts(with: "Firebase"),
425+
let localURL = LaunchArgs.shared.localPodspecPath,
426+
FileManager.default
427+
.fileExists(atPath: localURL.appendingPathComponent("Firebase.podspec").path) {
428+
// Let Firebase.podspec force the right version for unspecified closed Firebase pods.
429+
let podString = pod.name.replacingOccurrences(of: "Firebase", with: "")
430+
podfile += " pod 'Firebase/\(podString)', :path => '\(localURL.path)'"
431+
} else {
432+
podfile += " pod '\(pod.name)'"
425433
}
426434
if pod.version != nil {
427435
// Don't add Google pods if versions were specified or we're doing a secondary install

0 commit comments

Comments
 (0)