@@ -160,10 +160,13 @@ struct ZipBuilder {
160
160
/// Builds and assembles the contents for the zip build.
161
161
///
162
162
/// - Parameter podsToInstall: All pods to install.
163
+ /// - Parameter includeCarthage: Build Carthage distribution as well.
164
+ /// - Parameter includeDependencies: Include dependencies of requested pod in distribution.
163
165
/// - Returns: Arrays of pod install info and the frameworks installed.
164
166
func buildAndAssembleZip( podsToInstall: [ CocoaPodUtils . VersionedPod ] ,
167
+ includeCarthage: Bool ,
165
168
includeDependencies: Bool ) ->
166
- ( [ String : CocoaPodUtils . PodInfo ] , [ String : [ URL ] ] , URL ) {
169
+ ( [ String : CocoaPodUtils . PodInfo ] , [ String : [ URL ] ] , URL ? ) {
167
170
// Remove CocoaPods cache so the build gets updates after a version is rebuilt during the
168
171
// release process. Always do this, since it can be the source of subtle failures on rebuilds.
169
172
CocoaPodUtils . cleanPodCache ( )
@@ -237,7 +240,7 @@ struct ZipBuilder {
237
240
podInfo: podInfo)
238
241
groupedFrameworks [ podName] = ( groupedFrameworks [ podName] ?? [ ] ) + frameworks
239
242
240
- if podName == " FirebaseCoreDiagnostics " {
243
+ if includeCarthage , podName == " FirebaseCoreDiagnostics " {
241
244
let ( cdFrameworks, _) = builder. compileFrameworkAndResources ( withName: podName,
242
245
logsOutputDir: paths
243
246
. logsOutputDir,
@@ -271,13 +274,6 @@ struct ZipBuilder {
271
274
} catch {
272
275
fatalError ( " Could not create XCFrameworks directory: \( error) " )
273
276
}
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
- }
281
277
282
278
for groupedFramework in groupedFrameworks {
283
279
let name = groupedFramework. key
@@ -290,6 +286,18 @@ struct ZipBuilder {
290
286
for (framework, paths) in xcframeworks {
291
287
print ( " Frameworks for pod: \( framework) were compiled at \( paths) " )
292
288
}
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
+
293
301
let carthageCoreDiagnosticsXcframework = FrameworkBuilder . makeXCFramework (
294
302
withName: " FirebaseCoreDiagnostics " ,
295
303
frameworks: carthageCoreDiagnosticsFrameworks,
@@ -324,8 +332,9 @@ struct ZipBuilder {
324
332
platforms: [ " ios " ] ) )
325
333
326
334
print ( " Final expected versions for the Zip file: \( podsToInstall) " )
327
- let ( installedPods, frameworks, carthageCoreDiagnosticsXcframework ) =
335
+ let ( installedPods, frameworks, carthageCoreDiagnosticsXcframeworkFirebase ) =
328
336
buildAndAssembleZip ( podsToInstall: podsToInstall,
337
+ includeCarthage: true ,
329
338
// Always include dependencies for Firebase zips.
330
339
includeDependencies: true )
331
340
@@ -336,6 +345,10 @@ struct ZipBuilder {
336
345
" installed: \( installedPods) " )
337
346
}
338
347
348
+ guard let carthageCoreDiagnosticsXcframework = carthageCoreDiagnosticsXcframeworkFirebase else {
349
+ fatalError ( " CoreDiagnosticsXcframework is missing " )
350
+ }
351
+
339
352
let zipDir = try assembleDistributions ( withPackageKind: " Firebase " ,
340
353
podsToInstall: podsToInstall,
341
354
installedPods: installedPods,
0 commit comments