Skip to content

Commit 521cbcf

Browse files
authored
[Release Tooling] Cleanup unused folder references (#12825)
1 parent ee81927 commit 521cbcf

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,8 @@ struct FrameworkBuilder {
5555
setCarthage: Bool,
5656
podInfo: CocoaPodUtils.PodInfo) -> ([URL], URL?) {
5757
let fileManager = FileManager.default
58-
let outputDir = fileManager.temporaryDirectory(withName: "frameworks_being_built")
5958
let logsDir = logsOutputDir ?? fileManager.temporaryDirectory(withName: "build_logs")
6059
do {
61-
// Remove the compiled frameworks directory, this isn't the cache we're using.
62-
if fileManager.directoryExists(at: outputDir) {
63-
try fileManager.removeItem(at: outputDir)
64-
}
65-
66-
try fileManager.createDirectory(at: outputDir, withIntermediateDirectories: true)
67-
6860
// Create our logs directory if it doesn't exist.
6961
if !fileManager.directoryExists(at: logsDir) {
7062
try fileManager.createDirectory(at: logsDir, withIntermediateDirectories: true)
@@ -74,13 +66,12 @@ struct FrameworkBuilder {
7466
}
7567

7668
if dynamicFrameworks {
77-
return (buildDynamicFrameworks(withName: framework, logsDir: logsDir, outputDir: outputDir),
69+
return (buildDynamicFrameworks(withName: framework, logsDir: logsDir),
7870
nil)
7971
} else {
8072
return buildStaticFrameworks(
8173
withName: framework,
8274
logsDir: logsDir,
83-
outputDir: outputDir,
8475
setCarthage: setCarthage,
8576
podInfo: podInfo
8677
)
@@ -312,8 +303,7 @@ struct FrameworkBuilder {
312303
/// - Parameter logsDir: The path to the directory to place build logs.
313304
/// - Returns: A path to the newly compiled frameworks (with any included Resources embedded).
314305
private func buildDynamicFrameworks(withName framework: String,
315-
logsDir: URL,
316-
outputDir: URL) -> [URL] {
306+
logsDir: URL) -> [URL] {
317307
// xcframework doesn't lipo things together but accepts fat frameworks for one target.
318308
// We group architectures here to deal with this fact.
319309
var thinFrameworks = [URL]()
@@ -340,7 +330,6 @@ struct FrameworkBuilder {
340330
/// - Returns: A path to the newly compiled framework, and the Resource URL.
341331
private func buildStaticFrameworks(withName framework: String,
342332
logsDir: URL,
343-
outputDir: URL,
344333
setCarthage: Bool,
345334
podInfo: CocoaPodUtils.PodInfo) -> ([URL], URL) {
346335
// Build every architecture and save the locations in an array to be assembled.
@@ -350,13 +339,6 @@ struct FrameworkBuilder {
350339
// Create the framework directory in the filesystem for the thin archives to go.
351340
let fileManager = FileManager.default
352341
let frameworkName = FrameworkBuilder.frameworkBuildName(framework)
353-
let frameworkDir = outputDir.appendingPathComponent("\(frameworkName).framework")
354-
do {
355-
try fileManager.createDirectory(at: frameworkDir, withIntermediateDirectories: true)
356-
} catch {
357-
fatalError("Could not create framework directory while building framework \(frameworkName). " +
358-
"\(error)")
359-
}
360342

361343
guard let anyPlatform = targetPlatforms.first,
362344
let archivePath = slicedFrameworks[anyPlatform] else {
@@ -410,7 +392,6 @@ struct FrameworkBuilder {
410392
let moduleMapContents = moduleMapContentsTemplate.get(umbrellaHeader: umbrellaHeader)
411393
let frameworks = groupFrameworks(withName: frameworkName,
412394
isCarthage: setCarthage,
413-
fromFolder: frameworkDir,
414395
slicedFrameworks: slicedFrameworks,
415396
moduleMapContents: moduleMapContents)
416397

@@ -542,18 +523,13 @@ struct FrameworkBuilder {
542523
/// Groups slices for each platform into a minimal set of frameworks.
543524
/// - Parameter withName: The framework name.
544525
/// - Parameter isCarthage: Name the temp directory differently for Carthage.
545-
/// - Parameter fromFolder: The almost complete framework folder. Includes Headers, Info.plist,
546-
/// and Resources.
547526
/// - Parameter slicedFrameworks: All the frameworks sliced by platform.
548527
/// - Parameter moduleMapContents: Module map contents for all frameworks in this pod.
549528
private func groupFrameworks(withName framework: String,
550529
isCarthage: Bool,
551-
fromFolder: URL,
552530
slicedFrameworks: [TargetPlatform: URL],
553531
moduleMapContents: String) -> ([URL]) {
554532
let fileManager = FileManager.default
555-
556-
// Create a `.framework` for each of the thinArchives using the `fromFolder` as the base.
557533
let platformFrameworksDir = fileManager.temporaryDirectory(
558534
withName: isCarthage ? "carthage_frameworks" : "platform_frameworks"
559535
)

0 commit comments

Comments
 (0)