@@ -220,6 +220,7 @@ def new_objc_provider(
220
220
additional_objc_infos = [],
221
221
alwayslink = False ,
222
222
deps ,
223
+ private_deps ,
223
224
feature_configuration ,
224
225
is_test ,
225
226
libraries_to_link ,
@@ -239,6 +240,9 @@ def new_objc_provider(
239
240
deps: The dependencies of the target being built, whose `Objc` providers
240
241
will be passed to the new one in order to propagate the correct
241
242
transitive fields.
243
+ private_deps: The private dependencies of the target being built,
244
+ whose `Objc` providers will be passed to the new one in order to
245
+ propagate the correct transitive fields.
242
246
feature_configuration: The Swift feature configuration.
243
247
is_test: Represents if the `testonly` value of the context.
244
248
libraries_to_link: A list (typically of one element) of the
@@ -263,7 +267,8 @@ def new_objc_provider(
263
267
# the Obj-C and C++ rules, we need to collect libraries from `CcInfo` and
264
268
# put them into the new `Objc` provider.
265
269
transitive_cc_libs = []
266
- for cc_info in get_providers (deps , CcInfo ):
270
+ all_deps = deps + private_deps
271
+ for cc_info in get_providers (all_deps , CcInfo ):
267
272
static_libs = []
268
273
for linker_input in cc_info .linking_context .linker_inputs .to_list ():
269
274
for library_to_link in linker_input .libraries :
@@ -302,6 +307,26 @@ def new_objc_provider(
302
307
):
303
308
extra_linkopts .append ("-ObjC" )
304
309
310
+ providers = get_providers (
311
+ deps ,
312
+ apple_common .Objc ,
313
+ )
314
+ for private_dep in private_deps :
315
+ if apple_common .Objc in private_dep :
316
+ # For private deps, we only need to propagate linker inputs with Objc provider, but no compilation artifacts (eg module_map, umbrella_header).
317
+ private_dep_objc_provider_kwargs = {
318
+ "force_load_library" : private_dep [apple_common .Objc ].force_load_library ,
319
+ "imported_library" : private_dep [apple_common .Objc ].imported_library ,
320
+ "library" : private_dep [apple_common .Objc ].library ,
321
+ "linkopt" : private_dep [apple_common .Objc ].linkopt ,
322
+ "sdk_dylib" : private_dep [apple_common .Objc ].sdk_dylib ,
323
+ "sdk_framework" : private_dep [apple_common .Objc ].sdk_framework ,
324
+ "source" : private_dep [apple_common .Objc ].source ,
325
+ "weak_sdk_framework" : private_dep [apple_common .Objc ].weak_sdk_framework ,
326
+ }
327
+ objc_provider = apple_common .new_objc_provider (** private_dep_objc_provider_kwargs )
328
+ providers .append (objc_provider )
329
+
305
330
return apple_common .new_objc_provider (
306
331
force_load_library = depset (
307
332
force_load_libraries ,
@@ -314,10 +339,7 @@ def new_objc_provider(
314
339
),
315
340
link_inputs = depset (additional_link_inputs + debug_link_inputs ),
316
341
linkopt = depset (user_link_flags + extra_linkopts ),
317
- providers = get_providers (
318
- deps ,
319
- apple_common .Objc ,
320
- ) + additional_objc_infos ,
342
+ providers = providers + additional_objc_infos ,
321
343
)
322
344
323
345
def register_link_binary_action (
0 commit comments