@@ -294,16 +294,20 @@ def objc_compile_requirements(args, deps, objc_fragment):
294294 inputs .append (objc .static_framework_file )
295295 inputs .append (objc .dynamic_framework_file )
296296
297- inputs .append (objc .module_map )
298- module_maps .append (objc .module_map )
299-
300297 defines .append (objc .define )
301298 includes .append (objc .include )
302299
303300 static_frameworks .append (objc .framework_dir )
304301 all_frameworks .append (objc .framework_dir )
305302 all_frameworks .append (objc .dynamic_framework_dir )
306303
304+ # Collect module maps for dependencies. These must be pulled from a combined transitive
305+ # provider to get the correct strict propagation behavior that we use to workaround command-line
306+ # length issues until Swift 4.2 is available.
307+ transitive_objc_provider = apple_common .new_objc_provider (providers = objc_providers )
308+ module_maps = transitive_objc_provider .module_map
309+ inputs .append (module_maps )
310+
307311 # Add the objc dependencies' header search paths so that imported modules can find their
308312 # headers.
309313 args .add_all (depset (transitive = includes ), format_each = "-I%s" )
@@ -341,11 +345,7 @@ def objc_compile_requirements(args, deps, objc_fragment):
341345 # is needed to avoid a case where Clang may load the same header in modular and non-modular
342346 # contexts, leading to duplicate definitions in the same file.
343347 # <https://llvm.org/bugs/show_bug.cgi?id=19501>
344- args .add_all (
345- depset (transitive = module_maps ),
346- before_each = "-Xcc" ,
347- format_each = "-fmodule-map-file=%s" ,
348- )
348+ args .add_all (module_maps , before_each = "-Xcc" , format_each = "-fmodule-map-file=%s" )
349349
350350 # Add any copts required by the `objc` configuration fragment.
351351 args .add_all (_clang_copts (objc_fragment ), before_each = "-Xcc" )
0 commit comments