@@ -124,14 +124,16 @@ def arrange_frameworks(archive_output_path):
124
124
os .remove (os .path .join (root , f ))
125
125
126
126
127
- def build_universal_framework (frameworks_path ):
127
+ def build_universal_framework (frameworks_path , targets ):
128
128
"""Create universal frameworks if possible.
129
129
130
130
If all architectures (eg: arm64, armv7 etc) and platforms (device, simulator)
131
131
were built, combine all of the libraries into a single universal framework.
132
132
Args:
133
133
frameworks_path (str): Root path containing subdirectories for each
134
134
operating system and its frameworks.
135
+ targets iterable(str): List of firebase libraries to process.
136
+ (eg: [firebase_auth, firebase_remote_config])
135
137
Eg: <build_dir>/frameworks <------------- <frameworks_path>
136
138
- ios
137
139
- device-arm64
@@ -208,8 +210,11 @@ def build_universal_framework(frameworks_path):
208
210
platform_variant_architecture_dirs [0 ])
209
211
logging .debug ('Using {0} as reference path for scanning '
210
212
'targets' .format (reference_dir_path ))
213
+ # Filter only .framework directories and make sure the framework is
214
+ # in list of supported targets.
211
215
target_frameworks = [x for x in os .listdir (reference_dir_path )
212
- if x .endswith ('.framework' )]
216
+ if x .endswith ('.framework' ) and
217
+ x .split ('.' )[0 ] in targets ]
213
218
logging .debug ('Targets found: {0}' .format (' ' .join (target_frameworks )))
214
219
215
220
# Collect a list of libraries from various platform-arch combinations for
@@ -263,7 +268,8 @@ def build_universal_framework(frameworks_path):
263
268
universal_firebase_framework_headers_path )
264
269
265
270
266
- def build_xcframeworks (frameworks_path , xcframeworks_path , template_info_plist ):
271
+ def build_xcframeworks (frameworks_path , xcframeworks_path , template_info_plist ,
272
+ targets ):
267
273
"""Build xcframeworks combining libraries for different operating systems.
268
274
269
275
Combine frameworks for different operating systems (ios, tvos), architectures
@@ -276,6 +282,8 @@ def build_xcframeworks(frameworks_path, xcframeworks_path, template_info_plist):
276
282
xcframeworks_path (str): Absolute path to create xcframeworks in.
277
283
template_info_plist (str): Absolute path to a template Info.plist that
278
284
will be copied over to each xcframework and provides metadata to XCode.
285
+ targets iterable(str): List of firebase target libraries.
286
+ (eg: [firebase_auth, firebase_remote_config])
279
287
280
288
Eg: <build_dir>/frameworks <------------- <frameworks_path>
281
289
- ios <---------- <frameworks_os_path>
@@ -345,8 +353,12 @@ def build_xcframeworks(frameworks_path, xcframeworks_path, template_info_plist):
345
353
platform_variant_architecture_dirs [0 ])
346
354
logging .debug ('Using {0} as reference path for scanning '
347
355
'targets' .format (reference_dir_path ))
356
+
357
+ # Filter only .framework directories and make sure the framework is
358
+ # in list of supported targets.
348
359
target_frameworks = [x for x in os .listdir (reference_dir_path )
349
- if x .endswith ('.framework' )]
360
+ if x .endswith ('.framework' ) and
361
+ x .split ('.' )[0 ] in targets ]
350
362
logging .debug ('Targets found: {0}' .format (' ' .join (target_frameworks )))
351
363
352
364
# For each target, we collect all libraries for a specific platform variants
@@ -545,15 +557,19 @@ def main():
545
557
# Reorganize frameworks (renaming, copying over headers etc)
546
558
arrange_frameworks (archive_output_path )
547
559
560
+ # Since we renamed firebase_app.framework to firebase.framework we add that
561
+ # to our list of targets.
562
+ supported_targets .add ('firebase' )
563
+
548
564
# if we built for all architectures build universal framework as well.
549
- build_universal_framework (frameworks_path )
565
+ build_universal_framework (frameworks_path , supported_targets )
550
566
551
567
# Build xcframeworks
552
568
xcframeworks_path = os .path .join (args .build_dir , 'xcframeworks' )
553
569
template_info_plist_path = os .path .join (args .source_dir , 'build_scripts' ,
554
570
'tvos' , 'Info_ios_and_tvos.plist' )
555
571
build_xcframeworks (frameworks_path , xcframeworks_path ,
556
- template_info_plist_path )
572
+ template_info_plist_path , supported_targets )
557
573
558
574
559
575
def parse_cmdline_args ():
0 commit comments