-
Notifications
You must be signed in to change notification settings - Fork 4.4k
incompatible_override_toolchain_transition: Migrate rules to use the toolchain transition #11584
Copy link
Copy link
Closed
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)incompatible-changeIncompatible/breaking changeIncompatible/breaking changeteam-Configurabilityplatforms, toolchains, cquery, select(), config transitionsplatforms, toolchains, cquery, select(), config transitionstype: feature request
Description
This flag unconditionally makes all rule uses the new toolchain transition. This means that any rule that uses toolchain resolution to fetch tools will need to migrate so that tools are in the correct configuration.
Flag: --incompatible_override_toolchain_transition
Migration:
First, wait for the new feature to be released (presumably in the release after 3.3.0).
See toolchain transition migration for details, but the process is fairly simple:
- For rules that create toolchains (i.e.,
cc_toolchain,go_toolchain,java_toolchain), add the propercfgattribute.- If the attribute is a tool used in builds (a compiler, a linker, anything that is executed), add
cfg = 'exec'so that it will be built for the correct execution platform. - If the attribute is intended to be part of the final target (a library, included source, anything else), add
cfg = 'target', so that it will be built in the correct target configuration. - At this point, there will be no change, because toolchains still use the host transition, and that overrides anything set on the toolchain rule itself.
- If the attribute is a tool used in builds (a compiler, a linker, anything that is executed), add
- For each rule that uses a toolchain (i.e.,
cc_library,go_binary,java_test), add theincompatible_use_toolchain_transition = Trueparameter to the rule definition in Starlark.- This enables the toolchain transition, instead of the host transition, when this rule type depends on a toolchain.
- Every toolchain type this rule uses should have been migrated in step 1 above.
- Once every rule has been migrated, wait for Bazel to flip the value of the
--incompatible_override_toolchain_transitionflag. This will take several releases for all rules to finish steps 1. and 2. - Once the flag has flipped, remove the
incompatible_use_toolchain_transitionparameter from the rule declaration. - Bazel will eventually deprecate the flag and rule parameter and remove them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)incompatible-changeIncompatible/breaking changeIncompatible/breaking changeteam-Configurabilityplatforms, toolchains, cquery, select(), config transitionsplatforms, toolchains, cquery, select(), config transitionstype: feature request