Skip to content

Commit c441f62

Browse files
committed
Refactor out of method
1 parent 87bba4d commit c441f62

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,20 @@ struct FrameworkBuilder {
651651
platform == .catalyst || platform == .macOS ? "Resources" : ""
652652
)
653653
.resolvingSymlinksInPath()
654-
processPrivacyManifests(fileManager, frameworkPath, resourceDir)
654+
655+
// 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+
// Bundles are moved rather than copied to prevent them from being
662+
// packaged in a `Resources` directory at the root of the xcframework.
663+
.forEach { try! fileManager.moveItem(
664+
at: $0,
665+
to: platformFrameworkDir.appendingPathComponent($0.lastPathComponent)
666+
) }
667+
655668

656669
// Use the appropriate moduleMaps
657670
packageModuleMaps(inFrameworks: [frameworkPath],
@@ -663,25 +676,6 @@ struct FrameworkBuilder {
663676
}
664677
}
665678

666-
/// Process privacy manifests.
667-
///
668-
/// Move any privacy manifest-containing resource bundles into the platform framework.
669-
func processPrivacyManifests(_ fileManager: FileManager,
670-
_ frameworkPath: URL,
671-
_ platformFrameworkDir: URL) {
672-
try? fileManager.contentsOfDirectory(
673-
at: frameworkPath.deletingLastPathComponent(),
674-
includingPropertiesForKeys: nil
675-
)
676-
.filter { $0.pathExtension == "bundle" }
677-
// Bundles are moved rather than copied to prevent them from being
678-
// packaged in a `Resources` directory at the root of the xcframework.
679-
.forEach { try! fileManager.moveItem(
680-
at: $0,
681-
to: platformFrameworkDir.appendingPathComponent($0.lastPathComponent)
682-
) }
683-
}
684-
685679
/// Package the built frameworks into an XCFramework.
686680
/// - Parameter withName: The framework name.
687681
/// - Parameter frameworks: The grouped frameworks.

0 commit comments

Comments
 (0)