bazel-ios / rules_ios

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

Fix import_middleman broken with Bazel 7 + sandbox mode #910

Closed gyfelton closed 1 week ago

gyfelton commented 2 weeks ago

What changed and why:

  1. added test case that broke with main, under sandbox mode and bazel 7 and arm64_simulator_use_device_deps feature turned on : To repro locally, run bazel build //tests/ios/unit-test/test-imports-app:TestImports-App --config=ios --features apple.arm64_simulator_use_device_deps and it fails. But success if change .bazelversion to 6.4.0 The error is "unable to find header basic.h" which is the same issue with what our own repo has. Also this only break Objc side not swift side (probably because CcInfo is more used by objc_library?)

  2. To fix above: use the compilation_context generated originally. The original fix https://github.com/bazel-ios/rules_ios/pull/873 is missing fields inside compilation_context such as headers. So might as well use the original CcInfo collected, and only recreate the linking context. BTW i believe the original PR aims to fix this kind of error in bazel 7:

    ld: building for 'iOS-simulator', but linking in object file (/path/to/someframework.framework[arm64][2] built for 'iOS'

    Which is the error we got if trying to just use the original CcInfo.

  3. Update the test matrix to have sandbox mode for the tests for arm64_simulator_use_device_deps feature

Tests done: Without the change from https://github.com/bazel-ios/rules_ios/pull/903 some checks should still fail but the ones using arm64_simulator_use_device_deps should be green