File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ def _platform_prerequisites(
7272 objc_fragment ,
7373 platform_type_string ,
7474 uses_swift ,
75- xcode_version_config ):
75+ xcode_version_config ,
76+ environment = None ):
7677 """Returns a struct containing information on the platform being targeted.
7778
7879 Args:
@@ -88,12 +89,21 @@ def _platform_prerequisites(
8889 platform_type_string: The platform type for the current target as a string.
8990 uses_swift: Boolean value to indicate if this target uses Swift.
9091 xcode_version_config: The `apple_common.XcodeVersionConfig` provider from the current context.
91-
92+ environment: Specific environment (`device` or `simulator`) for iOS platfrom type. Optional.
9293 Returns:
9394 A struct representing the collected platform information.
9495 """
9596 platform_type_attr = getattr (apple_common .platform_type , platform_type_string )
96- platform = apple_fragment .multi_arch_platform (platform_type_attr )
97+
98+ if platform_type_attr == apple_common .platform_type .ios and environment :
99+ if environment == "simulator" :
100+ platform = apple_common .platform .ios_simulator
101+ elif environment == "device" :
102+ platform = apple_common .platform .ios_device
103+ else :
104+ fail ("Unknown iOS environment: %s. It should be either `device` or `simulator`" % environment )
105+ else :
106+ platform = apple_fragment .multi_arch_platform (platform_type_attr )
97107
98108 if explicit_minimum_os :
99109 minimum_os = explicit_minimum_os
Original file line number Diff line number Diff line change @@ -561,6 +561,7 @@ def _apple_xcframework_impl(ctx):
561561 platform_type_string = link_output .platform ,
562562 uses_swift = link_output .uses_swift ,
563563 xcode_version_config = ctx .attr ._xcode_config [apple_common .XcodeVersionConfig ],
564+ environment = link_output .environment ,
564565 )
565566
566567 overridden_predeclared_outputs = struct (
@@ -1040,6 +1041,7 @@ def _apple_static_xcframework_impl(ctx):
10401041 platform_type_string = link_output .platform ,
10411042 uses_swift = link_output .uses_swift ,
10421043 xcode_version_config = ctx .attr ._xcode_config [apple_common .XcodeVersionConfig ],
1044+ environment = link_output .environment ,
10431045 )
10441046 resource_deps = _unioned_attrs (
10451047 attr_names = ["deps" ],
You can’t perform that action at this time.
0 commit comments