docs: give some general guidance on how to define custom toolchains#2220
Merged
rickeylev merged 1 commit intobazel-contrib:mainfrom Sep 15, 2024
Merged
Conversation
bea9e30 to
66691b5
Compare
66691b5 to
a199dc9
Compare
aignas
approved these changes
Sep 15, 2024
| Python toolchains can be utilized in other bazel rules, such as `genrule()`, by adding the `toolchains=["@rules_python//python:current_py_toolchain"]` attribute. You can obtain the path to the Python interpreter using the `$(PYTHON2)` and `$(PYTHON3)` ["Make" Variables](https://bazel.build/reference/be/make-variables). See the | ||
| {gh-path}`test_current_py_toolchain <tests/load_from_macro/BUILD.bazel>` target for an example. | ||
|
|
||
| Python toolchains can be utilized in other bazel rules, such as `genrule()`, by |
Collaborator
There was a problem hiding this comment.
nit, should we have a link to the bazel docs here?
Suggested change
| Python toolchains can be utilized in other bazel rules, such as `genrule()`, by | |
| Python toolchains can be utilized in other bazel rules, such as `genrule()`, by |
| attribute. You can obtain the path to the Python interpreter using the | ||
| `$(PYTHON2)` and `$(PYTHON3)` ["Make" | ||
| Variables](https://bazel.build/reference/be/make-variables). See the | ||
| {gh-path}`test_current_py_toolchain <tests/load_from_macro/BUILD.bazel>` target |
|
|
||
| Defining toolchains for this might look something like this: | ||
|
|
||
| ``` |
Collaborator
There was a problem hiding this comment.
Do our docs support this sort of highlighting?
Suggested change
| ``` | |
| ```starlark |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the discussion in #2216, it's clear that some better docs are needed to help people
figure out how to define a toolchain and what the different pieces me.
This gives some more explanation of the toolchain types, what they do, and how to
define them.
Along the way:
foo()