Skip to content

Commit 5344857

Browse files
authored
Fix 32bit Firebase Distro build regression (#9202)
1 parent 2ec7515 commit 5344857

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ struct FrameworkBuilder {
2222
/// Platforms to be included in the built frameworks.
2323
private let targetPlatforms: [TargetPlatform]
2424

25-
/// Minimum Version
26-
private let minimumVersion: Float
27-
2825
/// The directory containing the Xcode project and Pods folder.
2926
private let projectDir: URL
3027

@@ -37,13 +34,9 @@ struct FrameworkBuilder {
3734
}
3835

3936
/// Default initializer.
40-
init(projectDir: URL, platform: Platform, dynamicFrameworks: Bool) {
37+
init(projectDir: URL, targetPlatforms: [TargetPlatform], dynamicFrameworks: Bool) {
4138
self.projectDir = projectDir
42-
targetPlatforms = platform.platformTargets
43-
guard let minVersion = Float(platform.minimumVersion) else {
44-
fatalError("Invalid minimum version: \(platform.minimumVersion)")
45-
}
46-
minimumVersion = minVersion
39+
self.targetPlatforms = targetPlatforms
4740
self.dynamicFrameworks = dynamicFrameworks
4841
}
4942

@@ -196,7 +189,7 @@ struct FrameworkBuilder {
196189

197190
var archs = targetPlatform.archs.map { $0.rawValue }.joined(separator: " ")
198191
// The 32 bit archs do not build for iOS 11.
199-
if framework == "FirebaseAppCheck" || minimumVersion >= 11.0 {
192+
if framework == "FirebaseAppCheck" {
200193
if targetPlatform == .iOSDevice {
201194
archs = "arm64"
202195
} else if targetPlatform == .iOSSimulator {

ReleaseTooling/Sources/ZipBuilder/TargetPlatform.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ enum TargetPlatform: CaseIterable {
3434
/// Valid architectures to be built for the platform.
3535
var archs: [Architecture] {
3636
switch self {
37-
case .iOSDevice: return [.armv7, .arm64]
37+
case .iOSDevice: return Included32BitIOS.include32 ? [.armv7, .arm64] : [.arm64]
3838
// Include arm64 slices in the simulator for Apple silicon Macs.
39-
case .iOSSimulator: return [.i386, .x86_64, .arm64]
39+
case .iOSSimulator: return Included32BitIOS
40+
.include32 ? [.i386, .x86_64, .arm64] : [.x86_64, .arm64]
4041
// TODO: Evaluate x86_64h slice. Previous builds were limited to x86_64.
4142
case .catalyst: return [.x86_64, .arm64]
4243
case .macOS: return [.x86_64, .arm64]
@@ -97,3 +98,10 @@ enum Architecture: String, CaseIterable {
9798
case x86_64
9899
case x86_64h // x86_64h, Haswell, used for Mac Catalyst
99100
}
101+
102+
class Included32BitIOS {
103+
fileprivate static var include32 = false
104+
static func set() {
105+
include32 = true
106+
}
107+
}

ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct ZipBuilder {
129129
/// Paths needed throughout the process of packaging the Zip file.
130130
public let paths: FilesystemPaths
131131

132-
/// The targetPlatforms to target for the builds.
132+
/// The platforms to target for the builds.
133133
public let platforms: [Platform]
134134

135135
/// Specifies if the builder is building dynamic frameworks instead of static frameworks.
@@ -231,7 +231,7 @@ struct ZipBuilder {
231231
// Don't build the Firebase pod.
232232
} else if podInfo.isSourcePod {
233233
let builder = FrameworkBuilder(projectDir: projectDir,
234-
platform: platform,
234+
targetPlatforms: platform.platformTargets,
235235
dynamicFrameworks: dynamicFrameworks)
236236
let (frameworks, resourceContents) =
237237
builder.compileFrameworkAndResources(withName: podName,

ReleaseTooling/Sources/ZipBuilder/main.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,14 @@ struct ZipBuilderTool: ParsableCommand {
229229
SkipCatalyst.set()
230230
}
231231

232+
// 32 bit iOS slices should only be built if the minimum iOS version is less than 11.
233+
guard let minVersion = Float(minimumIOSVersion) else {
234+
fatalError("Invalid minimum iOS version: \(minimumIOSVersion)")
235+
}
236+
if minVersion < 11.0 {
237+
Included32BitIOS.set()
238+
}
239+
232240
let paths = ZipBuilder.FilesystemPaths(repoDir: repoDir,
233241
buildRoot: buildRoot,
234242
outputDir: outputDir,

0 commit comments

Comments
 (0)