@@ -184,9 +184,22 @@ def _apple_resource_aspect_impl(target, ctx):
184184 default_action = apple_resource_hint_action .resources
185185 module_names = [x .name for x in target [SwiftInfo ].direct_modules if x .swift ]
186186 bucketize_args ["swift_module" ] = module_names [0 ] if module_names else None
187- collect_args ["res_attrs" ] = ["data" ]
188187 owner = str (ctx .label )
189188
189+ # TODO: older versions of rules_swift used to have mixed_language_library
190+ # with `data` attr, this remains for backward compatibility, but should be removed
191+ # when our min rules_swift becomes 3.5+.
192+ collect_args ["res_attrs" ] = ["data" ]
193+
194+ # The mixed_language_library macro passes data to its clang_target and
195+ # swift_target sub-targets. Collect their resource providers so resources
196+ # propagate even when the rule itself does not have a data attribute.
197+ for attr in ("clang_target" , "swift_target" ):
198+ if hasattr (ctx .rule .attr , attr ):
199+ dep = getattr (ctx .rule .attr , attr )
200+ if AppleResourceInfo in dep :
201+ apple_resource_infos .append (dep [AppleResourceInfo ])
202+
190203 elif ctx .rule .kind in ["apple_static_framework_import" , "apple_static_xcframework_import" ]:
191204 default_action = apple_resource_hint_action .resources
192205 if AppleFrameworkImportBundleInfo in target :
@@ -429,7 +442,7 @@ def _apple_resource_aspect_impl(target, ctx):
429442
430443apple_resource_aspect = aspect (
431444 implementation = _apple_resource_aspect_impl ,
432- attr_aspects = ["data" , "deps" , "implementation_deps" , "private_deps" , "resources" , "structured_resources" ],
445+ attr_aspects = ["clang_target" , " data" , "deps" , "implementation_deps" , "private_deps" , "resources" , "structured_resources" , "swift_target " ],
433446 attrs = dicts .add (
434447 apple_support .action_required_attrs (),
435448 apple_support .platform_constraint_attrs (),
0 commit comments