Skip to content

Commit d9b7155

Browse files
committed
docs: mention calling register_toolchains in custom toolchain docs
1 parent 084865d commit d9b7155

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/toolchains.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,17 @@ toolchain(
444444
],
445445
exec_comaptible_with = ["@platforms/os:linux"]
446446
)
447+
448+
# File: MODULE.bazel or WORKSPACE.bazel
449+
# These toolchains will considered before others
450+
register_toolchains("//toolchains:all")
447451
```
448452

453+
When registering custom toolchains, be aware of the the [toolchain registration
454+
order](https://bazel.build/extending/toolchains#toolchain-resolution). In brief,
455+
toolchain order is the BFS-order of the modules; see the bazel docs for a more
456+
detailed description.
457+
449458
:::{note}
450459
The toolchain() calls should be in a separate BUILD file from everything else.
451460
This avoids Bazel having to perform unnecessary work when it discovers the list

0 commit comments

Comments
 (0)