Skip to content

Commit 14dead6

Browse files
committed
Fix gRPC bundle handling
1 parent ee98786 commit 14dead6

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -653,19 +653,31 @@ struct FrameworkBuilder {
653653
.resolvingSymlinksInPath()
654654

655655
// Move resource bundles into the platform framework.
656-
try? fileManager.contentsOfDirectory(
657-
at: frameworkPath.deletingLastPathComponent(),
658-
includingPropertiesForKeys: nil
659-
)
660-
.filter { $0.pathExtension == "bundle" }
661-
// Filter out `gRPCCertificates-Cpp.bundle` since it is unused.
662-
.filter { $0.lastPathComponent == "gRPCCertificates-Cpp.bundle" }
663-
// Bundles are moved rather than copied to prevent them from being
664-
// packaged in a `Resources` directory at the root of the xcframework.
665-
.forEach { try! fileManager.moveItem(
666-
at: $0,
667-
to: platformFrameworkDir.appendingPathComponent($0.lastPathComponent)
668-
) }
656+
do {
657+
try fileManager.contentsOfDirectory(
658+
at: frameworkPath.deletingLastPathComponent(),
659+
includingPropertiesForKeys: nil
660+
)
661+
.filter { $0.pathExtension == "bundle" }
662+
// Bundles are moved rather than copied to prevent them from being
663+
// packaged in a `Resources` directory at the root of the xcframework.
664+
.forEach {
665+
// Delete `gRPCCertificates-Cpp.bundle` since it is not needed (#9184).
666+
guard $0.lastPathComponent != "gRPCCertificates-Cpp.bundle" else {
667+
try fileManager.removeItem(at: $0)
668+
return
669+
}
670+
671+
try fileManager.moveItem(
672+
at: $0,
673+
to: platformFrameworkDir.appendingPathComponent($0.lastPathComponent)
674+
)
675+
}
676+
} catch {
677+
fatalError(
678+
"Could not move resources for framework \(frameworkPath), platform \(platform). Error: \(error)"
679+
)
680+
}
669681

670682
// Use the appropriate moduleMaps
671683
packageModuleMaps(inFrameworks: [frameworkPath],

0 commit comments

Comments
 (0)