Skip to content

Commit 68949a6

Browse files
authored
Use pre-release versions from release manifests. (#4715)
* Use pre-release versions from release manifests. This will allow installing pre-release versions since CocoaPods complains otherwise. Note: this removes any version validation since we're hardcoding the expected version as the version to install. * Style * Also release candidates.
1 parent 847dcf3 commit 68949a6

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

ZipBuilder/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ import Foundation
2121
enum CocoaPodUtils {
2222
// MARK: - Public API
2323

24-
struct VersionedPod: Decodable {
24+
struct VersionedPod: Decodable, CustomDebugStringConvertible {
2525
/// Public name of the pod.
2626
let name: String
2727

2828
/// The version of the requested pod.
2929
let version: String?
30+
31+
/// The debug description as required by `CustomDebugStringConvertible`.
32+
var debugDescription: String {
33+
var desc = name
34+
if let version = version {
35+
desc.append(" v\(version)")
36+
}
37+
38+
return desc
39+
}
3040
}
3141

3242
/// Information associated with an installed pod.

ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,20 @@ struct ZipBuilder {
185185
// install a subset of pods, like the following line:
186186
// let inputPods: [String] = ["Firebase", "FirebaseCore", "FirebaseAnalytics", "FirebaseStorage"]
187187
let inputPods = FirebasePods.allCases.map { $0.rawValue }
188-
let podsToInstall = inputPods.map { CocoaPodUtils.VersionedPod(name: $0, version: nil) }
188+
189+
// Get the expected versions based on the release manifests, if there are any. If there are any
190+
// versions with `alpha` or `beta` in it, we'll need to explicitly specify the version here so
191+
// CocoaPods installs it properly.
192+
let prereleases = expectedVersions().filter { _, version in
193+
version.contains("alpha") || version.contains("beta") || version.contains("rc")
194+
}
195+
196+
let podsToInstall: [CocoaPodUtils.VersionedPod] = inputPods.map { name in
197+
// If there's a pre-release version, include it here. Otherwise don't pass a version since we
198+
// want the latest.
199+
let version: String? = prereleases[name]
200+
return CocoaPodUtils.VersionedPod(name: name, version: version)
201+
}
189202

190203
let (installedPods, frameworks) = buildAndAssembleZip(podsToInstall: podsToInstall)
191204

0 commit comments

Comments
 (0)