File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ the version string.
1313
1414Create a file named ` my_rule.bzl ` :
1515
16- ``` text
16+ ``` starlark
1717# my_rule.bzl
1818def _my_rule_impl (ctx ):
1919 toolchain = ctx.toolchains[" @rules_python//python:toolchain_type" ]
@@ -39,7 +39,7 @@ my_rule = rule(
3939
4040In your ` BUILD.bazel ` file, you can use the rule like this:
4141
42- ``` text
42+ ``` starlark
4343# BUILD.bazel
4444load(" :my_rule.bzl" , " my_rule" )
4545
@@ -51,7 +51,7 @@ my_rule(
5151When you build this target, it will generate a file named
5252` show_python_version.txt ` containing the Python version (e.g., ` 3.9 ` ).
5353
54- ``` text
54+ ``` starlark
5555bazel build :show_python_version
5656cat bazel- bin / show_python_version.txt
57- ```
57+ ```
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ other C/C++ rules via the `CcInfo` provider.
2020
2121Here's an example of a rule that creates the ` -lpython<version> ` flag:
2222
23- ``` text
23+ ``` starlark
2424# python_libs.bzl
2525load(" @bazel_tools//tools/cpp:toolchain_utils.bzl" , " cc_common" )
2626
@@ -47,7 +47,7 @@ python_libs = rule(
4747In your ` BUILD.bazel ` file, define a target using this rule and add it to the
4848` deps ` of your ` cc_binary ` or ` cc_library ` .
4949
50- ``` text
50+ ``` starlark
5151# BUILD.bazel
5252load(" :python_libs.bzl" , " python_libs" )
5353
@@ -63,4 +63,4 @@ cc_binary(
6363 # Other dependencies
6464 ],
6565)
66- ```
66+ ```
You can’t perform that action at this time.
0 commit comments