@@ -209,12 +209,33 @@ struct ZipBuilder {
209
209
// Create an array that has the Pod name as the key and the array of frameworks needed - this
210
210
// will be used as the source of truth for all frameworks to be copied in each product's
211
211
// directory.
212
- let frameworks = filesToInstall. mapValues { $0. frameworks }
212
+ var frameworks = filesToInstall. mapValues { $0. frameworks }
213
213
for (framework, paths) in frameworks {
214
214
print ( " Frameworks for pod: \( framework) were compiled at \( paths) " )
215
215
}
216
216
217
- // TODO: Overwrite the `CoreDiagnostics.framework` in the generated framework.
217
+ // Overwrite the `FirebaseCoreDiagnostics.framework` in the `FirebaseAnalytics` folder. This is
218
+ // needed because it was compiled specifically with the `ZIP` bit enabled, helping us understand
219
+ // the distribution of CocoaPods vs Zip file integrations.
220
+ if subspecsToInstall. contains ( . analytics) {
221
+ let overriddenAnalytics : [ URL ] = {
222
+ guard let currentFrameworks = frameworks [ " FirebaseAnalytics " ] else {
223
+ fatalError ( " Attempted to replace CoreDiagnostics framework but the FirebaseAnalytics " +
224
+ " directory does not exist. Existing directories: \( frameworks. keys) " )
225
+ }
226
+
227
+ // Filter out any CoreDiagnostics directories from the frameworks to install. There should
228
+ // only be one.
229
+ let withoutDiagnostics : [ URL ] = currentFrameworks. filter { url in
230
+ url. lastPathComponent != " FirebaseCoreDiagnostics.framework "
231
+ }
232
+
233
+ return withoutDiagnostics + [ paths. coreDiagnosticsDir]
234
+ } ( )
235
+
236
+ // Set the newly required framework paths for Analytics.
237
+ frameworks [ " FirebaseAnalytics " ] = overriddenAnalytics
238
+ }
218
239
219
240
// TODO: The folder heirarchy should change in Firebase 6.
220
241
// Time to assemble the folder structure of the Zip file. In order to get the frameworks
0 commit comments