Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address #6747 review comments #6749

Merged
merged 2 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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