Skip to content

Commit 5b622de

Browse files
authored
Fix zip bloat issue (#10183)
1 parent 39d6af7 commit 5b622de

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ struct ZipBuilder {
460460
withInstalledPods: installedPods,
461461
rootZipDir: zipDir,
462462
builtFrameworks: frameworksToAssemble,
463-
podsToIgnore: analyticsPods)
463+
frameworksToIgnore: analyticsPods)
464464
// Update the README.
465465
readmeDeps += dependencyString(for: folder, in: productDir, frameworks: podFrameworks)
466466
} catch {
@@ -572,7 +572,7 @@ struct ZipBuilder {
572572
func copyFrameworks(fromPods installedPods: [String],
573573
toDirectory dir: URL,
574574
frameworkLocations: [String: [URL]],
575-
podsToIgnore: [String] = []) throws -> [String] {
575+
frameworksToIgnore: [String] = []) throws -> [String] {
576576
let fileManager = FileManager.default
577577
if !fileManager.directoryExists(at: dir) {
578578
try fileManager.createDirectory(at: dir, withIntermediateDirectories: false, attributes: nil)
@@ -585,8 +585,7 @@ struct ZipBuilder {
585585
// it to the destination directory.
586586
for podName in installedPods {
587587
// Skip the Firebase pod and specifically ignored frameworks.
588-
guard podName != "Firebase",
589-
!podsToIgnore.contains(podName) else {
588+
guard podName != "Firebase" else {
590589
continue
591590
}
592591

@@ -602,6 +601,10 @@ struct ZipBuilder {
602601
// Copy each of the frameworks over, unless it's explicitly ignored.
603602
for xcframework in xcframeworks {
604603
let xcframeworkName = xcframework.lastPathComponent
604+
let name = (xcframeworkName as NSString).deletingPathExtension
605+
if frameworksToIgnore.contains(name) {
606+
continue
607+
}
605608
let destination = dir.appendingPathComponent(xcframeworkName)
606609
try fileManager.copyItem(at: xcframework, to: destination)
607610
copiedFrameworkNames
@@ -713,8 +716,8 @@ struct ZipBuilder {
713716
withInstalledPods installedPods: [String: CocoaPodUtils.PodInfo],
714717
rootZipDir: URL,
715718
builtFrameworks: [String: [URL]],
716-
podsToIgnore: [String] = []) throws -> (productDir: URL,
717-
frameworks: [String]) {
719+
frameworksToIgnore: [String] = []) throws
720+
-> (productDir: URL, frameworks: [String]) {
718721
let podsToCopy = [podName] +
719722
CocoaPodUtils.transitiveMasterPodDependencies(for: podName, in: installedPods)
720723
// Remove any duplicates from the `podsToCopy` array. The easiest way to do this is to wrap it
@@ -726,11 +729,11 @@ struct ZipBuilder {
726729
let namedFrameworks = try copyFrameworks(fromPods: dedupedPods,
727730
toDirectory: productDir,
728731
frameworkLocations: builtFrameworks,
729-
podsToIgnore: podsToIgnore)
732+
frameworksToIgnore: frameworksToIgnore)
730733

731734
let copiedFrameworks = namedFrameworks.filter {
732-
// Skip frameworks that aren't contained in the "podsToIgnore" array and the Firebase pod.
733-
!(podsToIgnore.contains($0) || $0 == "Firebase")
735+
// Skip frameworks that aren't contained in the "frameworksToIgnore" array and the Firebase pod.
736+
!(frameworksToIgnore.contains($0) || $0 == "Firebase")
734737
}
735738

736739
return (productDir, copiedFrameworks)

0 commit comments

Comments
 (0)