Skip to content

Commit d6928e3

Browse files
authored
Added docs for rust bzlmod extensions. (#3336)
1 parent a002c94 commit d6928e3

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

docs/BUILD.bazel

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ stardoc(
6868
deps = [":all_docs"],
6969
)
7070

71+
stardoc(
72+
name = "rust_bzlmod",
73+
out = "src/rust_bzlmod.md",
74+
input = "@rules_rust//rust:extensions.bzl",
75+
table_of_contents_template = "@stardoc//stardoc:templates/markdown_tables/table_of_contents.vm",
76+
deps = [":all_docs"],
77+
)
78+
7179
stardoc(
7280
name = "rust_unpretty",
7381
out = "src/rust_unpretty.md",
@@ -178,7 +186,7 @@ stardoc(
178186

179187
stardoc(
180188
name = "crate_universe_workspace",
181-
out = "src/crate_universe.md",
189+
out = "src/crate_universe_workspace.md",
182190
input = "@rules_rust//crate_universe:defs.bzl",
183191
deps = [":all_docs"],
184192
)
@@ -275,6 +283,7 @@ mdbook(
275283
":rust",
276284
":rust_analyzer",
277285
":rust_bindgen",
286+
":rust_bzlmod",
278287
":rust_clippy",
279288
":rust_doc",
280289
":rust_fmt",

docs/src/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
- [Rust Settings](./rust_settings.md)
1717
- [Cargo Settings](./cargo_settings.md)
1818
- [Toolchains](./rust_toolchains.md)
19+
- [Bzlmod](./rust_bzlmod.md)
1920
- [Repositories](./rust_repositories.md)
2021
- [External Crates](./external_crates.md)
2122
- [crate_universe (bzlmod)](crate_universe_bzlmod.md)
22-
- [crate_universe (WORKSPACE)](crate_universe.md)
23+
- [crate_universe (WORKSPACE)](crate_universe_workspace.md)
2324
- [Upstream Tooling](./upstream_tooling.md)
2425
- [Extensions](./extensions.md)
2526
- [bindgen](./rust_bindgen.md)

rust/extensions.bzl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,12 @@ _RUST_REPOSITORY_SET_TAG_ATTRS = {
183183
} | _COMMON_TAG_KWARGS
184184

185185
_RUST_REPOSITORY_SET_TAG = tag_class(
186+
doc = "Tags for defining rust repository sets (where toolchains are defined).",
186187
attrs = _RUST_REPOSITORY_SET_TAG_ATTRS,
187188
)
188189

189190
_RUST_TOOLCHAIN_TAG = tag_class(
191+
doc = "Tags for defining rust toolchains (where toolchain tools are fetched).",
190192
attrs = {
191193
"aliases": attr.string_dict(
192194
doc = (
@@ -223,6 +225,15 @@ _RUST_TOOLCHAIN_TAG = tag_class(
223225
} | _COMMON_TAG_KWARGS,
224226
)
225227

228+
rust = module_extension(
229+
doc = "Rust toolchain extension.",
230+
implementation = _rust_impl,
231+
tag_classes = {
232+
"repository_set": _RUST_REPOSITORY_SET_TAG,
233+
"toolchain": _RUST_TOOLCHAIN_TAG,
234+
},
235+
)
236+
226237
_RUST_HOST_TOOLS_TAG = tag_class(
227238
attrs = {
228239
"name": attr.string(
@@ -236,15 +247,6 @@ _RUST_HOST_TOOLS_TAG = tag_class(
236247
} | _COMMON_TAG_KWARGS,
237248
)
238249

239-
rust = module_extension(
240-
doc = "Rust toolchain extension.",
241-
implementation = _rust_impl,
242-
tag_classes = {
243-
"repository_set": _RUST_REPOSITORY_SET_TAG,
244-
"toolchain": _RUST_TOOLCHAIN_TAG,
245-
},
246-
)
247-
248250
# This is a separate module extension so that only the host tools are
249251
# marked as reproducible and os and arch dependent
250252
def _rust_host_tools_impl(module_ctx):

0 commit comments

Comments
 (0)