@@ -134,7 +134,7 @@ extension CarthageUtils {
134
134
jsonManifest [ firebaseVersion] = url
135
135
136
136
// Write the updated manifest.
137
- let manifestPath = outputDir. appendingPathComponent ( " Firebase " + product + " Binary.json " )
137
+ let manifestPath = outputDir. appendingPathComponent ( getJSONFileName ( product: product ) )
138
138
139
139
// Unfortunate workaround: There's a strange issue when serializing to JSON on macOS: URLs
140
140
// will have the `/` escaped leading to an odd JSON output. Instead, let's output the
@@ -256,7 +256,7 @@ extension CarthageUtils {
256
256
/// - Returns: A dictionary with versions as keys and URLs as values.
257
257
private static func parseJSONFile( fromDir dir: URL , product: String ) -> [ String : URL ] {
258
258
// Parse the JSON manifest.
259
- let jsonFileName = " Firebase \ ( product) Binary.json "
259
+ let jsonFileName = getJSONFileName ( product: product )
260
260
let jsonFile = dir. appendingPathComponent ( jsonFileName)
261
261
guard FileManager . default. fileExists ( atPath: jsonFile. path) else {
262
262
fatalError ( " Could not find JSON manifest for \( product) during Carthage build. " +
@@ -281,4 +281,22 @@ extension CarthageUtils {
281
281
" Location: \( jsonFile) . \( error) " )
282
282
}
283
283
}
284
+
285
+ /// Get the JSON filename for a product
286
+ /// Consider using just the product name post Firebase 7. The conditions are to handle Firebase 6 compatibility.
287
+ ///
288
+ /// - Parameters:
289
+ /// - product: The name of the Firebase product.
290
+ /// - Returns: JSON file name for a product.
291
+ private static func getJSONFileName( product: String ) -> String {
292
+ var jsonFileName : String
293
+ if product == " GoogleSignIn " {
294
+ jsonFileName = " FirebaseGoogleSignIn "
295
+ } else if product == " Google-Mobile-Ads-SDK " {
296
+ jsonFileName = " FirebaseAdMob "
297
+ } else {
298
+ jsonFileName = product
299
+ }
300
+ return jsonFileName + " Binary.json "
301
+ }
284
302
}
0 commit comments