Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix apple_xcframework framework plist generated for invalid platform #2526

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions apple/internal/platform_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def _platform_prerequisites(
objc_fragment,
platform_type_string,
uses_swift,
xcode_version_config):
xcode_version_config,
environment = None):
"""Returns a struct containing information on the platform being targeted.

Args:
Expand All @@ -88,12 +89,21 @@ def _platform_prerequisites(
platform_type_string: The platform type for the current target as a string.
uses_swift: Boolean value to indicate if this target uses Swift.
xcode_version_config: The `apple_common.XcodeVersionConfig` provider from the current context.

environment: Specific environment (`device` or `simulator`) for iOS platfrom type. Optional.
Returns:
A struct representing the collected platform information.
"""
platform_type_attr = getattr(apple_common.platform_type, platform_type_string)
platform = apple_fragment.multi_arch_platform(platform_type_attr)

if platform_type_attr == apple_common.platform_type.ios and environment:
if environment == "simulator":
platform = apple_common.platform.ios_simulator
elif environment == "device":
platform = apple_common.platform.ios_device
else:
fail("Unknown iOS environment: %s. It should be either `device` or `simulator`" % environment)
else:
platform = apple_fragment.multi_arch_platform(platform_type_attr)

if explicit_minimum_os:
minimum_os = explicit_minimum_os
Expand Down
2 changes: 2 additions & 0 deletions apple/internal/xcframework_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ def _apple_xcframework_impl(ctx):
platform_type_string = link_output.platform,
uses_swift = link_output.uses_swift,
xcode_version_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig],
environment = link_output.environment,
)

overridden_predeclared_outputs = struct(
Expand Down Expand Up @@ -1040,6 +1041,7 @@ def _apple_static_xcframework_impl(ctx):
platform_type_string = link_output.platform,
uses_swift = link_output.uses_swift,
xcode_version_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig],
environment = link_output.environment,
)
resource_deps = _unioned_attrs(
attr_names = ["deps"],
Expand Down