bazelbuild / bazelbuild/rules_apple

apple_common.multi_arch_split should transition on platforms instead of crosstool

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

Description

# Description of the problem / feature request:

Let `apple_common.multi_arch_split` transition on `platforms`/constraints instead of `crosstool_top`/`cpu`.

### Feature requests: what underlying problem are you trying to solve with this feature?

According to [osx_archs.bzl](https://github.com/bazelbuild/bazel/blob/3.0.0/tools/osx/crosstool/osx_archs.bzl), Apple toolchains are already constraint aware and thus can be selected by specifying a platform.

However, according to [AppleCrosstoolTransition](https://github.com/bazelbuild/bazel/blob/3.0.0/src/main/java/com/google/devtools/build/lib/rules/objc/AppleCrosstoolTransition.java), `apple_common.multi_arch_split` is still implemented by transiting `crosstool_top` and `cpu` instead of platforms.

This creates weird cases for downstream rules which have to transition on `crosstool_top`/`cpu` instead of letting the constraints apply directly to their toolchains as well.
For instance, rules could expose `CcInfo` and thus be used as dependencies of a rule using `multi_arch_split`.
See https://github.com/bazelbuild/rules_go/pull/2451.

Looking at `rules_apple`, I see the starlark transitions are are implemented but `apple_common.multi_arch_split` is still used.

### What operating system are you running Bazel on?

macOS

### What's the output of `bazel info release`?

```
release 3.0.0
```

### Any other information, logs, or outputs that you want to share?

1. https://github.com/bazelbuild/rules_go/pull/2451

Contributor guide

Open the contributing guide

Research direction

Start with AppleCrosstoolTransition and tools/osx/crosstool/osx_archs.bzl, then compare the Starlark transitions in rules_apple and the linked rules_go pull request. Done means apple_common.multi_arch_split transitions on platforms and constraints rather than crosstool_top and cpu, while preserving the intended downstream toolchain behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.