`rust-analyzer` discoverConfig integration (#3073)
Adds a target that can be used for project auto-discovery by using the
`discoverConfig` settings as described in the `rust-analyzer` user
manual.
Unlike the `gen_rust_project` target, this can be used for dynamic
project discovery, and passing `{arg}` to `discoverConfig.command` can
split big repositories into multiple, smaller workspaces that
`rust-analyzer` switches between as needed. Large repositories can make
it OOM.
At amo, we've used a similar implementation for a while with great
success, which is why we figured we might upstream it. The changes also
include two additional output groups to ensure that proc-macros and
build script targets are built, as `rust-analyzer` depends on these to
provide complete IDE support.
Additionally, the PR makes use of the `output_base` value in `bazel`
invocations. We found it helpful to have tools such as `rust-analyzer`
and `clippy` run on a separate bazel server than the one used for
building. And a `config_group` argument was added to provide the ability
to provide a config group to `bazel` invocations.
An attempt to get codelens actions to work was done as well,
particularly around tests and binaries. They seem to work, but I'm not
100% sure whether the approach taken is the right one.
Closes #2755 .
---------
Co-authored-by: Krasimir Georgiev <krasimir@google.com>This repository provides rules for building Rust projects with Bazel.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.
Please refer to the full documentation.