bazelbuild / bazelbuild/rules_apple
macos_unit_test CPU Architecture Selection
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
Hello! I've been using [macos_unit_test](https://github.com/bazelbuild/rules_apple/blob/master/apple/macos.bzl#L303) in my projects, and I recently noticed that it does not respect the `macos_cpus` configuration flag when invoked via `bazelisk test`. Although this has no impact on my Intel machine, my Apple Silicon machine is unable to invoke tests using `arm64`.
---
## Setup
- Bazel 4.2.0
- Xcode 12.5.1
- rules_apple version 0.31.3
---
## Demo Repository
I've created a public repository that demonstrates this issue: [rules-apple-demo](https://github.com/tinder-cwybranowski/rules-apple-demo).
Everything should be detailed in the `README` of that repository, but I'll post some information below for visibility.
---
## Issue
As described in the demo repository (mentioned above), the test output of the `bazelisk test` invocation indicates that the underlying xcodebuild invocation used the `x86_64` architecture, despite explicitly passing `arm64`:
```
Command line invocation:
/Applications/Xcode12.5.1.app/Contents/Developer/usr/bin/xcodebuild test-without-building -destination platform=macOS,arch=x86_64 -xctestrun /var/folders/d2/26js2mt159n948c9ry6mt60c0000gp/T//test_tmp_dir.KXf4bB/tests.xctestrun
```
Contributor guide
Research direction
Start with the macos_unit_test definition linked in apple/macos.bzl and reproduce the behavior using the rules-apple-demo README and bazelisk test invocation. Compare the requested macos_cpus setting with the xcodebuild destination shown in the issue. Done means the test invocation uses arm64 when that architecture is selected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100