Skip to content

Commit

Permalink
Address #6747 review comments (#6749)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Oct 16, 2020
1 parent e89fd6c commit c5ea958
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 7 additions & 5 deletions ZipBuilder/Sources/ZipBuilder/LaunchArgs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,19 @@ struct LaunchArgs {
defaults.register(defaults: [Key.buildDependencies.rawValue: true])

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

// Get the project template directory, and fail if it doesn't exist.
var templatePath = defaults.string(forKey: Key.templateDir.rawValue)
if templatePath == nil, repoPath != nil {
templatePath = repoPath! + "/ZipBuilder/Template"
if templatePath == nil, let repoDir = repoDir {
templatePath = repoDir.path + "/ZipBuilder/Template"
} else {
LaunchArgs.exitWithUsageAndLog("Missing required key: `\(Key.templateDir)` for the folder " +
"containing all required files to build frameworks.")
Expand Down
6 changes: 2 additions & 4 deletions ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,9 @@ struct ZipBuilder {
/// - Returns: Information related to the built artifacts.
/// - Throws: One of many errors that could have happened during the build phase.
func buildAndAssembleFirebaseRelease(inProjectDir projectDir: URL) throws -> ReleaseArtifacts {
var podsToInstall: [CocoaPodUtils.VersionedPod] = []
let manifest = FirebaseManifest.shared
for pod in (manifest.pods.filter { $0.zip }) {
podsToInstall.append(CocoaPodUtils.VersionedPod(name: pod.name,
version: manifest.versionString(pod)))
var podsToInstall = manifest.pods.filter { $0.zip }.map {
CocoaPodUtils.VersionedPod(name: $0.name, version: manifest.versionString($0))
}
guard !podsToInstall.isEmpty else {
fatalError("Failed to find versions for Firebase release")
Expand Down

0 comments on commit c5ea958

Please sign in to comment.