@@ -651,7 +651,33 @@ struct FrameworkBuilder {
651
651
platform == . catalyst || platform == . macOS ? " Resources " : " "
652
652
)
653
653
. resolvingSymlinksInPath ( )
654
- processPrivacyManifests ( fileManager, frameworkPath, resourceDir)
654
+
655
+ // Move resource bundles into the platform framework.
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: resourceDir. appendingPathComponent ( $0. lastPathComponent)
674
+ )
675
+ }
676
+ } catch {
677
+ fatalError (
678
+ " Could not move resources for framework \( frameworkPath) , platform \( platform) . Error: \( error) "
679
+ )
680
+ }
655
681
656
682
// Use the appropriate moduleMaps
657
683
packageModuleMaps ( inFrameworks: [ frameworkPath] ,
@@ -663,39 +689,6 @@ struct FrameworkBuilder {
663
689
}
664
690
}
665
691
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
- // TODO(ncooke3): Once the zip is built with Xcode 15, the following
678
- // `filter` can be removed. The following block exists to preserve
679
- // how resources (e.g. like FIAM's) are packaged for use in Xcode 14.
680
- . filter { bundleURL in
681
- let dirEnum = fileManager. enumerator ( atPath: bundleURL. path)
682
- var containsPrivacyManifest = false
683
- while let relativeFilePath = dirEnum? . nextObject ( ) as? String {
684
- if relativeFilePath. hasSuffix ( " PrivacyInfo.xcprivacy " ) {
685
- containsPrivacyManifest = true
686
- break
687
- }
688
- }
689
- return containsPrivacyManifest
690
- }
691
- // Bundles are moved rather than copied to prevent them from being
692
- // packaged in a `Resources` directory at the root of the xcframework.
693
- . forEach { try ! fileManager. moveItem (
694
- at: $0,
695
- to: platformFrameworkDir. appendingPathComponent ( $0. lastPathComponent)
696
- ) }
697
- }
698
-
699
692
/// Package the built frameworks into an XCFramework.
700
693
/// - Parameter withName: The framework name.
701
694
/// - Parameter frameworks: The grouped frameworks.
0 commit comments