@@ -49,11 +49,11 @@ struct FrameworkBuilder {
49
49
/// - Parameter logsOutputDir: The path to the directory to place build logs.
50
50
/// - Parameter setCarthage: Set Carthage diagnostics flag in build.
51
51
/// - Parameter moduleMapContents: Module map contents for all frameworks in this pod.
52
- /// - Returns: A path to the newly compiled frameworks, and Resources .
52
+ /// - Returns: A path to the newly compiled frameworks.
53
53
func compileFrameworkAndResources( withName framework: String ,
54
54
logsOutputDir: URL ? = nil ,
55
55
setCarthage: Bool ,
56
- podInfo: CocoaPodUtils . PodInfo ) -> ( [ URL ] , URL ? ) {
56
+ podInfo: CocoaPodUtils . PodInfo ) -> [ URL ] {
57
57
let fileManager = FileManager . default
58
58
let outputDir = fileManager. temporaryDirectory ( withName: " frameworks_being_built " )
59
59
let logsDir = logsOutputDir ?? fileManager. temporaryDirectory ( withName: " build_logs " )
@@ -74,8 +74,7 @@ struct FrameworkBuilder {
74
74
}
75
75
76
76
if dynamicFrameworks {
77
- return ( buildDynamicFrameworks ( withName: framework, logsDir: logsDir, outputDir: outputDir) ,
78
- nil )
77
+ return buildDynamicFrameworks ( withName: framework, logsDir: logsDir, outputDir: outputDir)
79
78
} else {
80
79
return buildStaticFrameworks (
81
80
withName: framework,
@@ -330,7 +329,7 @@ struct FrameworkBuilder {
330
329
logsDir: URL ,
331
330
outputDir: URL ,
332
331
setCarthage: Bool ,
333
- podInfo: CocoaPodUtils . PodInfo ) -> ( [ URL ] , URL ) {
332
+ podInfo: CocoaPodUtils . PodInfo ) -> [ URL ] {
334
333
// Build every architecture and save the locations in an array to be assembled.
335
334
let slicedFrameworks = buildFrameworksForAllPlatforms ( withName: framework, logsDir: logsDir,
336
335
setCarthage: setCarthage)
@@ -387,15 +386,6 @@ struct FrameworkBuilder {
387
386
388
387
// TODO: copy PrivateHeaders directory as well if it exists. SDWebImage is an example pod.
389
388
390
- // Move all the Resources into .bundle directories in the destination Resources dir. The
391
- // Resources live are contained within the folder structure:
392
- // `projectDir/arch/Release-platform/FrameworkName`.
393
- // The Resources are stored at the top-level of the .framework or .xcframework directory.
394
- // For Firebase distributions, they are propagated one level higher in the final distribution.
395
- let resourceContents = projectDir. appendingPathComponents ( [ anyPlatform. buildName,
396
- anyPlatform. buildDirName,
397
- framework] )
398
-
399
389
guard let moduleMapContentsTemplate = podInfo. moduleMapContents else {
400
390
fatalError ( " Module map contents missing for framework \( frameworkName) " )
401
391
}
@@ -421,7 +411,7 @@ struct FrameworkBuilder {
421
411
""" )
422
412
}
423
413
}
424
- return ( frameworks, resourceContents )
414
+ return frameworks
425
415
}
426
416
427
417
/// Parses CocoaPods config files or uses the passed in `moduleMapContents` to write the
@@ -669,6 +659,17 @@ struct FrameworkBuilder {
669
659
fatalError ( " Could not create framework directory needed to build \( framework) : \( error) " )
670
660
}
671
661
662
+ // Copy resource bundles (if any)
663
+ try ? fileManager. contentsOfDirectory (
664
+ at: frameworkPath. deletingLastPathComponent ( ) ,
665
+ includingPropertiesForKeys: nil
666
+ )
667
+ . filter { $0. pathExtension == " bundle " }
668
+ . forEach { try ! fileManager. copyItem (
669
+ at: $0,
670
+ to: platformFrameworkDir. appendingPathComponent ( $0. lastPathComponent)
671
+ ) }
672
+
672
673
// Copy the binary to the right location.
673
674
let binaryName = frameworkPath. lastPathComponent. replacingOccurrences ( of: " .framework " ,
674
675
with: " " )
@@ -695,11 +696,9 @@ struct FrameworkBuilder {
695
696
/// - Parameter withName: The framework name.
696
697
/// - Parameter frameworks: The grouped frameworks.
697
698
/// - Parameter xcframeworksDir: Location at which to build the xcframework.
698
- /// - Parameter resourceContents: Location of the resources for this xcframework.
699
699
static func makeXCFramework( withName name: String ,
700
700
frameworks: [ URL ] ,
701
- xcframeworksDir: URL ,
702
- resourceContents: URL ? ) -> URL {
701
+ xcframeworksDir: URL ) -> URL {
703
702
let xcframework = xcframeworksDir
704
703
. appendingPathComponent ( frameworkBuildName ( name) + " .xcframework " )
705
704
@@ -724,16 +723,6 @@ struct FrameworkBuilder {
724
723
case . success:
725
724
print ( " XCFramework for \( name) built successfully at \( xcframework) . " )
726
725
}
727
- // xcframework resources are packaged at top of xcframework.
728
- if let resourceContents = resourceContents {
729
- let resourceDir = xcframework. appendingPathComponent ( " Resources " )
730
- do {
731
- try ResourcesManager . moveAllBundles ( inDirectory: resourceContents, to: resourceDir)
732
- } catch {
733
- fatalError ( " Could not move bundles into Resources directory while building \( name) : " +
734
- " \( error) " )
735
- }
736
- }
737
726
return xcframework
738
727
}
739
728
}
0 commit comments