bazelbuild / bazelbuild/rules_apple

apple_xcframework: Invalid Info.plist generated for xcframework supporting both device and simulator

Open
#2,524 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

I'm using apple_xcframework to generate a xcframework for ios (arm64 + arm64 simulator). But Info.plist for frameworks is always generated same for simulator and device with same value in CFBundleSupportedPlatforms, DTPlatformName and DTSDKName.
It depends what is passed to build command in `--ios_multi_cpus` or not passed at all, but anyway it is always either `iphonesimulator` or `iphoneos` for both ios and simulator frameworks.

```
apple_xcframework(
name = "SwiftProtobuf",
deps = [":SwiftProtobufLib"],
bundle_id = "org.swift.protobuf.SwiftProtobuf",
extension_safe = True,
infoplists = [":Info.plist"],
ios = {"device": ["arm64"], "simulator": ["arm64"]},
minimum_os_versions = {"ios": "15.0"},
minimum_deployment_os_versions = {"ios": "15.0"},
)

swift_library(
name = "SwiftProtobufLib",
srcs = glob(["*.swift"]),
module_name = "SwiftProtobuf",
features = [
SWIFT_FEATURE_ENABLE_LIBRARY_EVOLUTION,
]
)
```

`bazel build //Sources/SwiftProtobuf:SwiftProtobuf --apple_platform_type=ios --ios_multi_cpus=sim_arm64,arm64`

I've found that issue is in platform_support.bzl in `_platform_prerequisites` method which returns same `platform` for any environment.
Maybe I'm doing something wrong in configuration and some fix already exists?

Contributor guide

Open the contributing guide

Research direction

Start with platform_support.bzl and the _platform_prerequisites method identified in the issue. Reproduce with the provided apple_xcframework configuration and build command using both sim_arm64 and arm64; done means the device and simulator frameworks have distinct, correct CFBundleSupportedPlatforms, DTPlatformName, and DTSDKName values in their Info.plist files.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.