Skip to content

Commit 31307cd

Browse files
authored
Skip armv7 for iOS11+ AppCheck (#7983)
1 parent 8be7fa5 commit 31307cd

File tree

6 files changed

+38
-9
lines changed

6 files changed

+38
-9
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public let shared = Manifest(
2626
Pod("FirebaseCoreDiagnostics"),
2727
Pod("FirebaseCore"),
2828
Pod("FirebaseInstallations"),
29-
Pod("FirebaseInstanceID"),
3029
Pod("GoogleAppMeasurement", isClosedSource: true, platforms: ["ios"]),
3130
Pod("FirebaseAnalytics", isClosedSource: true, platforms: ["ios"], zip: true),
3231
Pod("FirebaseAnalyticsSwift", isBeta: true, platforms: ["ios"]),

ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,15 +502,14 @@ enum CocoaPodUtils {
502502
podfile += "\n"
503503
}
504504

505-
// If we're using local pods, explicitly add FirebaseInstanceID, FirebaseInstallations,
505+
// If we're using local pods, explicitly add FirebaseInstallations,
506506
// and any Google* podspecs if they exist and there are no explicit versions in the Podfile.
507507
// Note there are versions for local podspecs if we're doing the secondary install for module
508508
// map building.
509509
if !versionsSpecified, let localURL = localPodspecPath {
510510
let podspecs = try! FileManager.default.contentsOfDirectory(atPath: localURL.path)
511511
for podspec in podspecs {
512-
if podspec == "FirebaseInstanceID.podspec" ||
513-
podspec == "FirebaseInstallations.podspec" ||
512+
if podspec == "FirebaseInstallations.podspec" ||
514513
podspec == "FirebaseCoreDiagnostics.podspec" ||
515514
podspec == "FirebaseCore.podspec" ||
516515
podspec == "FirebaseRemoteConfig.podspec" ||

ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,18 @@ struct FrameworkBuilder {
184184
let distributionFlag = setCarthage ? "-DFIREBASE_BUILD_CARTHAGE" :
185185
"-DFIREBASE_BUILD_ZIP_FILE"
186186
let cFlags = "OTHER_CFLAGS=$(value) \(distributionFlag)"
187-
let archs = targetPlatform.archs.map { $0.rawValue }.joined(separator: " ")
187+
188+
var archs = targetPlatform.archs.map { $0.rawValue }.joined(separator: " ")
189+
// The 32 bit archs do not build for iOS 11.
190+
// TODO: Make a more robust solution if we need to support more of a mix between iOS 11 and
191+
// under.
192+
if framework == "FirebaseAppCheck" {
193+
if targetPlatform == .iOSDevice {
194+
archs = "arm64"
195+
} else if targetPlatform == .iOSSimulator {
196+
archs = "x86_64 arm64"
197+
}
198+
}
188199

189200
var args = ["build",
190201
"-configuration", "release",
@@ -815,6 +826,12 @@ struct FrameworkBuilder {
815826
archs.removeAll(where: { $0 == .arm64 })
816827
}
817828

829+
// lipo doesn't work if only one architecture.
830+
if archs.count == 1 {
831+
slices[archs.first!] = binary
832+
continue
833+
}
834+
818835
// Loop through the architectures and strip out each by using `lipo`.
819836
for arch in archs {
820837
// Create the path where the thin slice will reside, ensure it's non-existent.

ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,20 @@ struct ZipBuilder {
212212
platformPods.map { $0.name.components(separatedBy: "/").first }.contains($0.key)
213213
}
214214

215-
for (podName, podInfo) in podsToBuild {
215+
// Build in a sorted order to make the build deterministic and to avoid exposing random
216+
// build order bugs.
217+
// Also AppCheck must be built after other pods so that its restricted architecture
218+
// selection does not restrict any of its dependencies.
219+
var sortedPods = podsToBuild.keys.sorted()
220+
sortedPods.removeAll(where: { value in
221+
value == "FirebaseAppCheck"
222+
})
223+
sortedPods.append("FirebaseAppCheck")
224+
225+
for podName in sortedPods {
226+
guard let podInfo = podsToBuild[podName] else {
227+
continue
228+
}
216229
if podName == "Firebase" {
217230
// Don't build the Firebase pod.
218231
} else if podInfo.isSourcePod {
@@ -322,7 +335,7 @@ struct ZipBuilder {
322335
frameworksToAssemble: frameworks,
323336
firebasePod: firebasePod)
324337
var carthageDir: URL?
325-
if let carthageFrameworks = carthageFrameworks {
338+
if let carthageFrameworks = carthageFrameworks, carthageFrameworks.count > 0 {
326339
carthageDir = try assembleDistributions(withPackageKind: "CarthageFirebase",
327340
podsToInstall: podsToInstall,
328341
installedPods: installedPods,
@@ -377,7 +390,7 @@ struct ZipBuilder {
377390
let analyticsDir: URL
378391
do {
379392
// This returns the Analytics directory and a list of framework names that Analytics requires.
380-
/// Example: ["FirebaseInstanceID", "GoogleAppMeasurement", "nanopb", <...>]
393+
/// Example: ["FirebaseInstallations, "GoogleAppMeasurement", "nanopb", <...>]
381394
let (dir, frameworks) = try installAndCopyFrameworks(forPod: "FirebaseAnalytics",
382395
withInstalledPods: installedPods,
383396
rootZipDir: zipDir,

SymbolCollisionTest/Podfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ target 'SymbolCollisionTest' do
2222
pod 'FirebaseFirestore', :path => '../'
2323
pod 'FirebaseFunctions', :path => '../'
2424
pod 'FirebaseInAppMessaging', :path => '../'
25-
pod 'FirebaseInstanceID', :path => '../'
2625
pod 'FirebaseInstallations', :path => '../'
2726
pod 'FirebaseMessaging', :path => '../'
2827
pod 'FirebasePerformance', :path => '../'

0 commit comments

Comments
 (0)