Skip to content

Commit 2035655

Browse files
authored
Fix Analytics source build (#10134)
1 parent cc06fcf commit 2035655

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -482,16 +482,11 @@ enum CocoaPodUtils {
482482
for pod in pods {
483483
let rootPod = String(pod.name.split(separator: "/").first!)
484484

485-
let podIsClosedSource: Bool = FirebaseManifest.shared.pods
486-
.filter(\.isClosedSource)
487-
.map(\.name)
488-
.contains(rootPod)
489-
490485
// Check if we want to use a local version of the podspec.
491-
if !podIsClosedSource,
492-
let localURL = localPodspecPath,
493-
FileManager.default
494-
.fileExists(atPath: localURL.appendingPathComponent("\(rootPod).podspec").path) {
486+
if let localURL = localPodspecPath,
487+
let pathURL = localPodspecPath?.appendingPathComponent("\(rootPod).podspec").path,
488+
FileManager.default.fileExists(atPath: pathURL),
489+
isSourcePodspec(pathURL) {
495490
podfile += " pod '\(pod.name)', :path => '\(localURL.path)'"
496491
} else if let podVersion = pod.version {
497492
// To support Firebase patch versions in the Firebase zip distribution, allow patch updates
@@ -553,6 +548,16 @@ enum CocoaPodUtils {
553548
return podfile
554549
}
555550

551+
private static func isSourcePodspec(_ podspecPath: String) -> Bool {
552+
do {
553+
let contents = try String(contentsOfFile: podspecPath, encoding: .utf8)
554+
// The presence of ".vendored_frameworks" in a podspec indicates a binary pod.
555+
return contents.range(of: ".vendored_frameworks") == nil
556+
} catch {
557+
fatalError("Could not read \(podspecPath): \(error)")
558+
}
559+
}
560+
556561
/// Write a podfile that contains all the pods passed in to the directory passed in with a name
557562
/// "Podfile".
558563
private static func writePodfile(for pods: [VersionedPod],

0 commit comments

Comments
 (0)