Commit 2f03f47
committed
Add rust_system_toolchain_repository for pre-installed toolchains
Introduce a repository rule that probes the system for an installed Rust
toolchain and generates BUILD targets with sysroot_path set. This follows
the cc_configure pattern from rules_cc: the repository rule runs at fetch
time, discovers the toolchain, and generates appropriate targets.
Changes:
- New rust/private/system_rust_configure.bzl with:
- rust_system_toolchain_repository repository rule
- system_rust_ext module extension for bzlmod
- System probing (rustc --print sysroot, --version, --print target-libdir)
- BUILD file generation with rust_toolchain + toolchain targets
- rust/toolchain.bzl: Add sysroot_path attribute to rust_toolchain. When
set, sysroot files are excluded from action inputs and --sysroot is
passed to rustc pointing at the system installation.
- rust/private/rustc.bzl: Use system rustc path when sysroot_path is set
- rust/private/clippy.bzl: Use system clippy-driver when sysroot_path is set
- rust/private/rustdoc.bzl: Use system rustdoc when sysroot_path is set
- rust/private/unpretty.bzl: Use system rustc when sysroot_path is set
- cargo/private/cargo_build_script.bzl: Use system tool paths for CARGO,
RUSTC, RUSTDOC env vars when sysroot_path is set
This replaces the previous system_sysroot boolean approach with a cleaner
separation: the repository rule handles system probing, and the toolchain
rule simply accepts a sysroot_path string for path redirection.1 parent 3f4f431 commit 2f03f47
7 files changed
Lines changed: 457 additions & 27 deletions
File tree
- cargo/private
- rust
- private
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
420 | 423 | | |
421 | 424 | | |
422 | 425 | | |
| |||
425 | 428 | | |
426 | 429 | | |
427 | 430 | | |
428 | | - | |
429 | | - | |
| 431 | + | |
| 432 | + | |
430 | 433 | | |
431 | 434 | | |
432 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
168 | | - | |
| 170 | + | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1193 | 1193 | | |
1194 | 1194 | | |
1195 | 1195 | | |
1196 | | - | |
1197 | | - | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1198 | 1200 | | |
1199 | 1201 | | |
1200 | 1202 | | |
| |||
1400 | 1402 | | |
1401 | 1403 | | |
1402 | 1404 | | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
1403 | 1409 | | |
1404 | 1410 | | |
1405 | 1411 | | |
1406 | 1412 | | |
1407 | 1413 | | |
1408 | | - | |
| 1414 | + | |
1409 | 1415 | | |
1410 | 1416 | | |
1411 | 1417 | | |
| |||
1432 | 1438 | | |
1433 | 1439 | | |
1434 | 1440 | | |
1435 | | - | |
| 1441 | + | |
1436 | 1442 | | |
1437 | 1443 | | |
1438 | 1444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
134 | | - | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
0 commit comments