Skip to content

Commit b6f4236

Browse files
authored
Use correct framework names in README. (#2969)
1 parent ae65e4a commit b6f4236

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,22 @@ struct ZipBuilder {
335335
/// - frameworkLocations: A dictionary containing the pod name as the key and a location to
336336
/// the compiled frameworks.
337337
/// - ignoreFrameworks: A list of Pod
338+
/// - Returns: The filenames of the frameworks that were copied.
338339
/// - Throws: Various FileManager errors in case the copying fails, or an error if the framework
339340
// doesn't exist in `frameworkLocations`.
340341
private func copyFrameworks(fromPods installedPods: [CocoaPodUtils.PodInfo],
341342
toDirectory dir: URL,
342343
frameworkLocations: [String: [URL]],
343344
podsToIgnore: [String],
344-
foldersToIgnore: [String]) throws {
345+
foldersToIgnore: [String]) throws -> [String] {
345346
let fileManager = FileManager.default
346347
if !fileManager.directoryExists(at: dir) {
347348
try fileManager.createDirectory(at: dir, withIntermediateDirectories: false, attributes: nil)
348349
}
349350

351+
// Keep track of the names of the frameworks copied over.
352+
var copiedFrameworkNames: [String] = []
353+
350354
// Loop through each InstalledPod item and get the name so we can fetch the framework and copy
351355
// it to the destination directory.
352356
for pod in installedPods {
@@ -375,8 +379,11 @@ struct ZipBuilder {
375379

376380
let destination = dir.appendingPathComponent(frameworkName)
377381
try fileManager.copyItem(at: framework, to: destination)
382+
copiedFrameworkNames.append(frameworkName.replacingOccurrences(of: ".framework", with: ""))
378383
}
379384
}
385+
386+
return copiedFrameworkNames
380387
}
381388

382389
/// Copies required files from the Firebase pod (i.e. `Firebase.h`, `module.modulemap`, etc) into
@@ -525,14 +532,12 @@ struct ZipBuilder {
525532
let installedPods = CocoaPodUtils.installPods([pod], inDir: projectDir, customSpecRepos: customSpecRepos)
526533
// Copy the frameworks into the proper product directory.
527534
let productDir = rootZipDir.appendingPathComponent(pod.rawValue)
528-
try copyFrameworks(fromPods: installedPods,
529-
toDirectory: productDir,
530-
frameworkLocations: builtFrameworks,
531-
podsToIgnore: podsToIgnore,
532-
foldersToIgnore: pod.duplicateFrameworksToRemove())
533-
534-
// Return the names of all the installed frameworks.
535-
let namedFrameworks = installedPods.map { $0.name }
535+
let namedFrameworks = try copyFrameworks(fromPods: installedPods,
536+
toDirectory: productDir,
537+
frameworkLocations: builtFrameworks,
538+
podsToIgnore: podsToIgnore,
539+
foldersToIgnore: pod.duplicateFrameworksToRemove())
540+
536541
let copiedFrameworks = namedFrameworks.filter {
537542
// Only return the frameworks that aren't contained in the "podsToIgnore" array, aren't an
538543
// interop framework (since they don't compile to frameworks), or the Firebase pod itself.

0 commit comments

Comments
 (0)