bazelbuild / rules_apple

Bazel rules to build apps for Apple platforms.
Apache License 2.0
511 stars 268 forks source link

apple_common.multi_arch_split should transition on platforms instead of crosstool #767

Open steeve opened 4 years ago

steeve commented 4 years ago

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, Apple toolchains are already constraint aware and thus can be selected by specifying a platform.

However, according to AppleCrosstoolTransition, 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
aiuto commented 4 years ago

cc: @katre maybe we should track this too?

jmmv commented 4 years ago

This looks like an incomplete dup of bazelbuild/bazel#11181. Am I reading things wrong? If yes, the differences are very subtle...

steeve commented 4 years ago

@jmmv github's been having issues for the last 3 days, and I think it created the ticket twice when I was updating it. I'll close bazelbuild/bazel#11181 and update this one. Sorry for the noise.

(or maybe the issue was the chair-keyboard interface of my computer)

katre commented 4 years ago

The work here is larger than just multi_arch_split: almost all of the Apple rules need to switch away from using --cpu and --crosstool_top and to using --platforms.

UebelAndre commented 4 years ago

Any updates here?