@@ -180,7 +180,6 @@ def _ios_application_impl(ctx):
180180 shared_capabilities = ctx .attr .shared_capabilities ,
181181 )
182182 bundle_verification_targets = [struct (target = ext ) for ext in ctx .attr .extensions ]
183- cc_toolchain = find_cpp_toolchain (ctx )
184183 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
185184 embeddable_targets = (
186185 ctx .attr .frameworks +
@@ -236,9 +235,7 @@ def _ios_application_impl(ctx):
236235 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
237236 bundle_id = bundle_id ,
238237 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
239- cc_toolchain = cc_toolchain ,
240- disabled_features = ctx .disabled_features ,
241- enabled_features = ctx .features ,
238+ cc_toolchains = cc_toolchain_forwarder ,
242239 entitlements_file = ctx .file .entitlements ,
243240 platform_prerequisites = platform_prerequisites ,
244241 product_type = rule_descriptor .product_type ,
@@ -580,7 +577,6 @@ def _ios_app_clip_impl(ctx):
580577 suffix_default = ctx .attr ._bundle_id_suffix_default ,
581578 shared_capabilities = ctx .attr .shared_capabilities ,
582579 )
583- cc_toolchain = find_cpp_toolchain (ctx )
584580 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
585581 bundle_verification_targets = [struct (target = ext ) for ext in ctx .attr .extensions ]
586582 embeddable_targets = (
@@ -632,9 +628,7 @@ def _ios_app_clip_impl(ctx):
632628 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
633629 bundle_id = bundle_id ,
634630 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
635- cc_toolchain = cc_toolchain ,
636- disabled_features = ctx .disabled_features ,
637- enabled_features = ctx .features ,
631+ cc_toolchains = cc_toolchain_forwarder ,
638632 entitlements_file = ctx .file .entitlements ,
639633 platform_prerequisites = platform_prerequisites ,
640634 product_type = rule_descriptor .product_type ,
@@ -919,7 +913,6 @@ def _ios_framework_impl(ctx):
919913 bundle_name = bundle_name ,
920914 suffix_default = ctx .attr ._bundle_id_suffix_default ,
921915 )
922- cc_toolchain = find_cc_toolchain (ctx )
923916 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
924917 executable_name = ctx .attr .executable_name
925918 features = features_support .compute_enabled_features (
@@ -1073,9 +1066,7 @@ def _ios_framework_impl(ctx):
10731066 bundle_only = ctx .attr .bundle_only ,
10741067 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
10751068 cc_linking_contexts = linking_contexts ,
1076- cc_toolchain = cc_toolchain ,
1077- features = features ,
1078- disabled_features = ctx .disabled_features ,
1069+ cc_toolchain = find_cpp_toolchain (ctx ),
10791070 rule_label = label ,
10801071 ),
10811072 partials .resources_partial (
@@ -1174,7 +1165,6 @@ def _ios_extension_impl(ctx):
11741165 suffix_default = ctx .attr ._bundle_id_suffix_default ,
11751166 shared_capabilities = ctx .attr .shared_capabilities ,
11761167 )
1177- cc_toolchain = find_cpp_toolchain (ctx )
11781168 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
11791169 features = features_support .compute_enabled_features (
11801170 requested_features = ctx .features ,
@@ -1221,9 +1211,7 @@ def _ios_extension_impl(ctx):
12211211 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
12221212 bundle_id = bundle_id ,
12231213 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
1224- cc_toolchain = cc_toolchain ,
1225- disabled_features = ctx .disabled_features ,
1226- enabled_features = ctx .features ,
1214+ cc_toolchains = cc_toolchain_forwarder ,
12271215 entitlements_file = ctx .file .entitlements ,
12281216 platform_prerequisites = platform_prerequisites ,
12291217 product_type = rule_descriptor .product_type ,
@@ -1657,8 +1645,6 @@ def _ios_dynamic_framework_impl(ctx):
16571645 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
16581646 cc_linking_contexts = linking_contexts ,
16591647 cc_toolchain = cc_toolchain ,
1660- features = features ,
1661- disabled_features = ctx .disabled_features ,
16621648 rule_label = label ,
16631649 ),
16641650 partials .resources_partial (
@@ -1899,6 +1885,22 @@ def _ios_static_framework_impl(ctx):
18991885
19001886def _ios_imessage_application_impl (ctx ):
19011887 """Experimental implementation of ios_imessage_application."""
1888+
1889+ # Using "deps" to compute binary architectures, entitlements and features, but we're using a
1890+ # stub binary to handle the actual binary, just like a rule for a watchOS 2 app bundle.
1891+ if ctx .attr .deps :
1892+ fail ("""
1893+ ios_imessage_application does not support `deps`.
1894+
1895+ This rule is merely a container for an iMessage extension with limited functionality. If this \
1896+ iMessage extension requires a hosting binary, it should be assigned as one of the `extensions` \
1897+ of an `ios_application` rather than an `ios_imessage_application`.
1898+
1899+ If you mean to use this for packaging an iMessage extension and nothing more, please assign a \
1900+ reference to an ios_imessage_extension target to the `extension` attribute instead, to give this \
1901+ app an implementation.
1902+ """ )
1903+
19021904 rule_descriptor = rule_support .rule_descriptor (
19031905 platform_type = ctx .attr .platform_type ,
19041906 product_type = apple_product_type .messages_application ,
@@ -1925,7 +1927,7 @@ def _ios_imessage_application_impl(ctx):
19251927 unsupported_features = ctx .disabled_features ,
19261928 )
19271929 bundle_verification_targets = [struct (target = ctx .attr .extension )]
1928- cc_toolchain = find_cpp_toolchain ( ctx )
1930+ cc_toolchain_forwarder = ctx . split_attr . _cc_toolchain_forwarder
19291931 embeddable_targets = [ctx .attr .extension ]
19301932 label = ctx .label
19311933 platform_prerequisites = platform_support .platform_prerequisites (
@@ -1966,9 +1968,7 @@ def _ios_imessage_application_impl(ctx):
19661968 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
19671969 bundle_id = bundle_id ,
19681970 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
1969- cc_toolchain = cc_toolchain ,
1970- disabled_features = ctx .disabled_features ,
1971- enabled_features = ctx .features ,
1971+ cc_toolchains = cc_toolchain_forwarder ,
19721972 entitlements_file = ctx .file .entitlements ,
19731973 platform_prerequisites = platform_prerequisites ,
19741974 product_type = rule_descriptor .product_type ,
@@ -2136,7 +2136,6 @@ def _ios_imessage_extension_impl(ctx):
21362136 shared_capabilities = ctx .attr .shared_capabilities ,
21372137 )
21382138 executable_name = ctx .attr .executable_name
2139- cc_toolchain = find_cpp_toolchain (ctx )
21402139 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
21412140 features = features_support .compute_enabled_features (
21422141 requested_features = ctx .features ,
@@ -2181,9 +2180,7 @@ def _ios_imessage_extension_impl(ctx):
21812180 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
21822181 bundle_id = bundle_id ,
21832182 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
2184- cc_toolchain = cc_toolchain ,
2185- disabled_features = ctx .disabled_features ,
2186- enabled_features = ctx .features ,
2183+ cc_toolchains = cc_toolchain_forwarder ,
21872184 entitlements_file = ctx .file .entitlements ,
21882185 platform_prerequisites = platform_prerequisites ,
21892186 product_type = rule_descriptor .product_type ,
@@ -2415,7 +2412,7 @@ def _ios_sticker_pack_extension_impl(ctx):
24152412 suffix_default = ctx .attr ._bundle_id_suffix_default ,
24162413 shared_capabilities = ctx .attr .shared_capabilities ,
24172414 )
2418- cc_toolchain = find_cpp_toolchain ( ctx )
2415+ cc_toolchain_forwarder = ctx . split_attr . _cc_toolchain_forwarder
24192416 executable_name = ctx .attr .executable_name
24202417 features = features_support .compute_enabled_features (
24212418 requested_features = ctx .features ,
@@ -2460,9 +2457,7 @@ def _ios_sticker_pack_extension_impl(ctx):
24602457 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
24612458 bundle_id = bundle_id ,
24622459 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
2463- cc_toolchain = cc_toolchain ,
2464- disabled_features = ctx .disabled_features ,
2465- enabled_features = ctx .features ,
2460+ cc_toolchains = cc_toolchain_forwarder ,
24662461 entitlements_file = ctx .file .entitlements ,
24672462 platform_prerequisites = platform_prerequisites ,
24682463 product_type = rule_descriptor .product_type ,
@@ -3108,6 +3103,15 @@ for either an iOS iMessage extension or a Sticker Pack extension.""",
31083103 icon_extension = ".appiconset" ,
31093104 icon_parent_extension = ".xcassets" ,
31103105 ),
3106+ rule_attrs .binary_linking_attrs (
3107+ deps_cfg = transition_support .apple_platform_split_transition ,
3108+ extra_deps_aspects = [
3109+ apple_resource_aspect ,
3110+ framework_provider_aspect ,
3111+ ],
3112+ is_test_supporting_rule = False ,
3113+ requires_legacy_cc_toolchain = True ,
3114+ ),
31113115 rule_attrs .common_bundle_attrs (deps_cfg = transition_support .apple_platform_split_transition ),
31123116 rule_attrs .common_tool_attrs (),
31133117 rule_attrs .device_family_attrs (
0 commit comments