bazel-ios / rules_ios

Bazel rules for building iOS applications and frameworks
Apache License 2.0
276 stars 85 forks source link

Produce an alias for an xcframework's `ios_sim_arm64` slice if available #810

Closed jszumski closed 8 months ago

jszumski commented 9 months ago

If apple.arm64_simulator_use_device_deps is False, an xcframework providing slices for ios-arm64 and ios-arm64_x86_64-simulator wouldn't select the second slice for an ios_sim_arm64 build.

ERROR: SomeFramework/BUILD.bazel:11:15: configurable attribute "actual" in //SomeFramework:SomeFramework-import-SomeFramework.xcframeworkdefault_vfs doesn't match this configuration. Would a default condition help?

Conditions checked:
 //SomeFramework:SomeFramework-import-SomeFramework.xcframework-ios_arm64
 //SomeFramework:SomeFramework-import-SomeFramework.xcframework-ios_simulator_x86_64

The configuration being built had these values:

FragmentOptions com.google.devtools.build.lib.analysis.config.CoreOptions {
  cpu: ios_sim_arm64
  host_cpu: darwin_arm64
  ...
}

FragmentOptions com.google.devtools.build.lib.rules.apple.AppleCommandLineOptions {
  apple_platform_type: ios
  apple_split_cpu: sim_arm64
  ios_multi_cpus: [sim_arm64]
  ...
}

This change emits a new condtion for //SomeFramework:SomeFramework-import-SomeFramework.xcframework-ios_simulator_arm64 that matches @build_bazel_rules_apple//apple:ios_sim_arm64 to the SomeFrameowrk.xcframework-ios-arm64_x86_64-simulator slice.

mattrobmattrob commented 9 months ago

This is a big QOL improvement! Most folks probably won't need the apple.arm64_simulator_use_device_deps feature at this point and it hasn't worked without it for me in the past. Awesome!

mattrobmattrob commented 8 months ago

Are you ready to merge this one, @jszumski?