bazelbuild / bazelbuild/rules_rust
gen_rust_project SUPPORT transparent transmission of compilation_mode or config
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
There are some raw bazel cmds in gen_rust_project binary:
1. aquery: https://github.com/bazelbuild/rules_rust/blob/main/tools/rust_analyzer/aquery.rs#L78
2. info: https://github.com/bazelbuild/rules_rust/blob/main/tools/rust_analyzer/main.rs#L68
3. build: https://github.com/bazelbuild/rules_rust/blob/main/tools/rust_analyzer/lib.rs#L23
The default compilation_mode in bazel is `fastbuild`. So the `root_module` value in `rust-project.json` looks like "xxx/bazel-out/k8-fastbuild/bin/xxx"
In our usage scenario, we manage build commands through bazel config, like:
```bazel
build:scene1 -c opt
build:scene2 -c fastbuild
```
When we build the target using opt mode, the generated content of rust-project.json will not match.
So, is there a way for us to support the transparent compilation_mode or config so that the internal bazel commands can also be built using the same mode?
```bash
bazel run --config:scene1 @rules_rust//tools/rust_analyzer:gen_rust_project -- {target}
# or
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project -- --inner_comilation_mode=opt {target}
```
Contributor guide
Assessment
This issue has not been assessed yet.