Skip to content

Commit 6e7b29c

Browse files
authored
Don't build Carthage CoreDiagnostics for non-Firebase (#8116)
1 parent f9929d0 commit 6e7b29c

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,13 @@ struct ZipBuilder {
160160
/// Builds and assembles the contents for the zip build.
161161
///
162162
/// - Parameter podsToInstall: All pods to install.
163+
/// - Parameter includeCarthage: Build Carthage distribution as well.
164+
/// - Parameter includeDependencies: Include dependencies of requested pod in distribution.
163165
/// - Returns: Arrays of pod install info and the frameworks installed.
164166
func buildAndAssembleZip(podsToInstall: [CocoaPodUtils.VersionedPod],
167+
includeCarthage: Bool,
165168
includeDependencies: Bool) ->
166-
([String: CocoaPodUtils.PodInfo], [String: [URL]], URL) {
169+
([String: CocoaPodUtils.PodInfo], [String: [URL]], URL?) {
167170
// Remove CocoaPods cache so the build gets updates after a version is rebuilt during the
168171
// release process. Always do this, since it can be the source of subtle failures on rebuilds.
169172
CocoaPodUtils.cleanPodCache()
@@ -237,7 +240,7 @@ struct ZipBuilder {
237240
podInfo: podInfo)
238241
groupedFrameworks[podName] = (groupedFrameworks[podName] ?? []) + frameworks
239242

240-
if podName == "FirebaseCoreDiagnostics" {
243+
if includeCarthage, podName == "FirebaseCoreDiagnostics" {
241244
let (cdFrameworks, _) = builder.compileFrameworkAndResources(withName: podName,
242245
logsOutputDir: paths
243246
.logsOutputDir,
@@ -271,13 +274,6 @@ struct ZipBuilder {
271274
} catch {
272275
fatalError("Could not create XCFrameworks directory: \(error)")
273276
}
274-
let xcframeworksCarthageDir = FileManager.default.temporaryDirectory(withName: "xcf-carthage")
275-
do {
276-
try FileManager.default.createDirectory(at: xcframeworksCarthageDir,
277-
withIntermediateDirectories: false)
278-
} catch {
279-
fatalError("Could not create XCFrameworks Carthage directory: \(error)")
280-
}
281277

282278
for groupedFramework in groupedFrameworks {
283279
let name = groupedFramework.key
@@ -290,6 +286,18 @@ struct ZipBuilder {
290286
for (framework, paths) in xcframeworks {
291287
print("Frameworks for pod: \(framework) were compiled at \(paths)")
292288
}
289+
guard includeCarthage else {
290+
// No Carthage build necessary, return now.
291+
return (podsBuilt, xcframeworks, nil)
292+
}
293+
let xcframeworksCarthageDir = FileManager.default.temporaryDirectory(withName: "xcf-carthage")
294+
do {
295+
try FileManager.default.createDirectory(at: xcframeworksCarthageDir,
296+
withIntermediateDirectories: false)
297+
} catch {
298+
fatalError("Could not create XCFrameworks Carthage directory: \(error)")
299+
}
300+
293301
let carthageCoreDiagnosticsXcframework = FrameworkBuilder.makeXCFramework(
294302
withName: "FirebaseCoreDiagnostics",
295303
frameworks: carthageCoreDiagnosticsFrameworks,
@@ -324,8 +332,9 @@ struct ZipBuilder {
324332
platforms: ["ios"]))
325333

326334
print("Final expected versions for the Zip file: \(podsToInstall)")
327-
let (installedPods, frameworks, carthageCoreDiagnosticsXcframework) =
335+
let (installedPods, frameworks, carthageCoreDiagnosticsXcframeworkFirebase) =
328336
buildAndAssembleZip(podsToInstall: podsToInstall,
337+
includeCarthage: true,
329338
// Always include dependencies for Firebase zips.
330339
includeDependencies: true)
331340

@@ -336,6 +345,10 @@ struct ZipBuilder {
336345
"installed: \(installedPods)")
337346
}
338347

348+
guard let carthageCoreDiagnosticsXcframework = carthageCoreDiagnosticsXcframeworkFirebase else {
349+
fatalError("CoreDiagnosticsXcframework is missing")
350+
}
351+
339352
let zipDir = try assembleDistributions(withPackageKind: "Firebase",
340353
podsToInstall: podsToInstall,
341354
installedPods: installedPods,

ReleaseTooling/Sources/ZipBuilder/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ struct ZipBuilderTool: ParsableCommand {
268268

269269
let (installedPods, frameworks, _) =
270270
builder.buildAndAssembleZip(podsToInstall: podsToBuild,
271+
includeCarthage: false,
271272
includeDependencies: buildDependencies)
272273
let staging = FileManager.default.temporaryDirectory(withName: "Binaries")
273274
try builder.copyFrameworks(fromPods: Array(installedPods.keys), toDirectory: staging,

0 commit comments

Comments
 (0)