@@ -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 ,
@@ -583,7 +580,6 @@ def _ios_app_clip_impl(ctx):
583580 suffix_default = ctx .attr ._bundle_id_suffix_default ,
584581 shared_capabilities = ctx .attr .shared_capabilities ,
585582 )
586- cc_toolchain = find_cpp_toolchain (ctx )
587583 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
588584 bundle_verification_targets = [struct (target = ext ) for ext in ctx .attr .extensions ]
589585 embeddable_targets = (
@@ -635,9 +631,7 @@ def _ios_app_clip_impl(ctx):
635631 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
636632 bundle_id = bundle_id ,
637633 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
638- cc_toolchain = cc_toolchain ,
639- disabled_features = ctx .disabled_features ,
640- enabled_features = ctx .features ,
634+ cc_toolchains = cc_toolchain_forwarder ,
641635 entitlements_file = ctx .file .entitlements ,
642636 platform_prerequisites = platform_prerequisites ,
643637 product_type = rule_descriptor .product_type ,
@@ -913,7 +907,6 @@ def _ios_framework_impl(ctx):
913907 bundle_name = bundle_name ,
914908 suffix_default = ctx .attr ._bundle_id_suffix_default ,
915909 )
916- cc_toolchain = find_cpp_toolchain (ctx )
917910 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
918911 executable_name = ctx .attr .executable_name
919912 features = features_support .compute_enabled_features (
@@ -1067,9 +1060,7 @@ def _ios_framework_impl(ctx):
10671060 bundle_only = ctx .attr .bundle_only ,
10681061 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
10691062 cc_linking_contexts = linking_contexts ,
1070- cc_toolchain = cc_toolchain ,
1071- features = features ,
1072- disabled_features = ctx .disabled_features ,
1063+ cc_toolchain = find_cpp_toolchain (ctx ),
10731064 rule_label = label ,
10741065 ),
10751066 partials .resources_partial (
@@ -1168,7 +1159,6 @@ def _ios_extension_impl(ctx):
11681159 suffix_default = ctx .attr ._bundle_id_suffix_default ,
11691160 shared_capabilities = ctx .attr .shared_capabilities ,
11701161 )
1171- cc_toolchain = find_cpp_toolchain (ctx )
11721162 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
11731163 features = features_support .compute_enabled_features (
11741164 requested_features = ctx .features ,
@@ -1215,9 +1205,7 @@ def _ios_extension_impl(ctx):
12151205 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
12161206 bundle_id = bundle_id ,
12171207 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
1218- cc_toolchain = cc_toolchain ,
1219- disabled_features = ctx .disabled_features ,
1220- enabled_features = ctx .features ,
1208+ cc_toolchains = cc_toolchain_forwarder ,
12211209 entitlements_file = ctx .file .entitlements ,
12221210 platform_prerequisites = platform_prerequisites ,
12231211 product_type = rule_descriptor .product_type ,
@@ -1654,8 +1642,6 @@ def _ios_dynamic_framework_impl(ctx):
16541642 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
16551643 cc_linking_contexts = linking_contexts ,
16561644 cc_toolchain = cc_toolchain ,
1657- features = features ,
1658- disabled_features = ctx .disabled_features ,
16591645 rule_label = label ,
16601646 ),
16611647 partials .resources_partial (
@@ -1896,6 +1882,22 @@ def _ios_static_framework_impl(ctx):
18961882
18971883def _ios_imessage_application_impl (ctx ):
18981884 """Experimental implementation of ios_imessage_application."""
1885+
1886+ # Using "deps" to compute binary architectures, entitlements and features, but we're using a
1887+ # stub binary to handle the actual binary, just like a rule for a watchOS 2 app bundle.
1888+ if ctx .attr .deps :
1889+ fail ("""
1890+ ios_imessage_application does not support `deps`.
1891+
1892+ This rule is merely a container for an iMessage extension with limited functionality. If this \
1893+ iMessage extension requires a hosting binary, it should be assigned as one of the `extensions` \
1894+ of an `ios_application` rather than an `ios_imessage_application`.
1895+
1896+ If you mean to use this for packaging an iMessage extension and nothing more, please assign a \
1897+ reference to an ios_imessage_extension target to the `extension` attribute instead, to give this \
1898+ app an implementation.
1899+ """ )
1900+
18991901 rule_descriptor = rule_support .rule_descriptor (
19001902 platform_type = ctx .attr .platform_type ,
19011903 product_type = apple_product_type .messages_application ,
@@ -1922,7 +1924,7 @@ def _ios_imessage_application_impl(ctx):
19221924 unsupported_features = ctx .disabled_features ,
19231925 )
19241926 bundle_verification_targets = [struct (target = ctx .attr .extension )]
1925- cc_toolchain = find_cpp_toolchain ( ctx )
1927+ cc_toolchain_forwarder = ctx . split_attr . _cc_toolchain_forwarder
19261928 embeddable_targets = [ctx .attr .extension ]
19271929 label = ctx .label
19281930 platform_prerequisites = platform_support .platform_prerequisites (
@@ -1963,9 +1965,7 @@ def _ios_imessage_application_impl(ctx):
19631965 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
19641966 bundle_id = bundle_id ,
19651967 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
1966- cc_toolchain = cc_toolchain ,
1967- disabled_features = ctx .disabled_features ,
1968- enabled_features = ctx .features ,
1968+ cc_toolchains = cc_toolchain_forwarder ,
19691969 entitlements_file = ctx .file .entitlements ,
19701970 platform_prerequisites = platform_prerequisites ,
19711971 product_type = rule_descriptor .product_type ,
@@ -2133,7 +2133,6 @@ def _ios_imessage_extension_impl(ctx):
21332133 shared_capabilities = ctx .attr .shared_capabilities ,
21342134 )
21352135 executable_name = ctx .attr .executable_name
2136- cc_toolchain = find_cpp_toolchain (ctx )
21372136 cc_toolchain_forwarder = ctx .split_attr ._cc_toolchain_forwarder
21382137 features = features_support .compute_enabled_features (
21392138 requested_features = ctx .features ,
@@ -2178,9 +2177,7 @@ def _ios_imessage_extension_impl(ctx):
21782177 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
21792178 bundle_id = bundle_id ,
21802179 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
2181- cc_toolchain = cc_toolchain ,
2182- disabled_features = ctx .disabled_features ,
2183- enabled_features = ctx .features ,
2180+ cc_toolchains = cc_toolchain_forwarder ,
21842181 entitlements_file = ctx .file .entitlements ,
21852182 platform_prerequisites = platform_prerequisites ,
21862183 product_type = rule_descriptor .product_type ,
@@ -2412,7 +2409,7 @@ def _ios_sticker_pack_extension_impl(ctx):
24122409 suffix_default = ctx .attr ._bundle_id_suffix_default ,
24132410 shared_capabilities = ctx .attr .shared_capabilities ,
24142411 )
2415- cc_toolchain = find_cpp_toolchain ( ctx )
2412+ cc_toolchain_forwarder = ctx . split_attr . _cc_toolchain_forwarder
24162413 executable_name = ctx .attr .executable_name
24172414 features = features_support .compute_enabled_features (
24182415 requested_features = ctx .features ,
@@ -2457,9 +2454,7 @@ def _ios_sticker_pack_extension_impl(ctx):
24572454 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
24582455 bundle_id = bundle_id ,
24592456 cc_configured_features_init = features_support .make_cc_configured_features_init (ctx ),
2460- cc_toolchain = cc_toolchain ,
2461- disabled_features = ctx .disabled_features ,
2462- enabled_features = ctx .features ,
2457+ cc_toolchains = cc_toolchain_forwarder ,
24632458 entitlements_file = ctx .file .entitlements ,
24642459 platform_prerequisites = platform_prerequisites ,
24652460 product_type = rule_descriptor .product_type ,
@@ -3105,6 +3100,15 @@ for either an iOS iMessage extension or a Sticker Pack extension.""",
31053100 icon_extension = ".appiconset" ,
31063101 icon_parent_extension = ".xcassets" ,
31073102 ),
3103+ rule_attrs .binary_linking_attrs (
3104+ deps_cfg = transition_support .apple_platform_split_transition ,
3105+ extra_deps_aspects = [
3106+ apple_resource_aspect ,
3107+ framework_provider_aspect ,
3108+ ],
3109+ is_test_supporting_rule = False ,
3110+ requires_legacy_cc_toolchain = True ,
3111+ ),
31083112 rule_attrs .common_bundle_attrs (deps_cfg = transition_support .apple_platform_split_transition ),
31093113 rule_attrs .common_tool_attrs (),
31103114 rule_attrs .device_family_attrs (
0 commit comments