Skip to content

Commit c5ea958

Browse files
authored
Address #6747 review comments (#6749)
1 parent e89fd6c commit c5ea958

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ZipBuilder/Sources/ZipBuilder/LaunchArgs.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,19 @@ struct LaunchArgs {
169169
defaults.register(defaults: [Key.buildDependencies.rawValue: true])
170170

171171
// Get the project repo directory, and fail if it doesn't exist and we're building Firebase.
172-
let repoPath = defaults.string(forKey: Key.repoDir.rawValue)
173-
if defaults.string(forKey: Key.zipPods.rawValue) != nil {
172+
if let repoPath = defaults.string(forKey: Key.repoDir.rawValue) {
173+
repoDir = URL(fileURLWithPath: repoPath)
174+
} else if defaults.string(forKey: Key.zipPods.rawValue) != nil {
174175
LaunchArgs.exitWithUsageAndLog("Missing required key: `\(Key.repoDir)` for the folder " +
175176
"containing the repository from which we're building the zip.")
177+
} else {
178+
repoDir = nil
176179
}
177-
repoDir = repoPath != nil ? URL(fileURLWithPath: repoPath!) : nil
178180

179181
// Get the project template directory, and fail if it doesn't exist.
180182
var templatePath = defaults.string(forKey: Key.templateDir.rawValue)
181-
if templatePath == nil, repoPath != nil {
182-
templatePath = repoPath! + "/ZipBuilder/Template"
183+
if templatePath == nil, let repoDir = repoDir {
184+
templatePath = repoDir.path + "/ZipBuilder/Template"
183185
} else {
184186
LaunchArgs.exitWithUsageAndLog("Missing required key: `\(Key.templateDir)` for the folder " +
185187
"containing all required files to build frameworks.")

ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,9 @@ struct ZipBuilder {
162162
/// - Returns: Information related to the built artifacts.
163163
/// - Throws: One of many errors that could have happened during the build phase.
164164
func buildAndAssembleFirebaseRelease(inProjectDir projectDir: URL) throws -> ReleaseArtifacts {
165-
var podsToInstall: [CocoaPodUtils.VersionedPod] = []
166165
let manifest = FirebaseManifest.shared
167-
for pod in (manifest.pods.filter { $0.zip }) {
168-
podsToInstall.append(CocoaPodUtils.VersionedPod(name: pod.name,
169-
version: manifest.versionString(pod)))
166+
var podsToInstall = manifest.pods.filter { $0.zip }.map {
167+
CocoaPodUtils.VersionedPod(name: $0.name, version: manifest.versionString($0))
170168
}
171169
guard !podsToInstall.isEmpty else {
172170
fatalError("Failed to find versions for Firebase release")

0 commit comments

Comments
 (0)