Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tools/rust_analyzer/aquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,22 @@ pub fn get_crate_specs(
) -> anyhow::Result<BTreeSet<CrateSpec>> {
log::info!("running bazel aquery...");
log::debug!("Get crate specs with targets: {:?}", targets);
let target_pattern = format!("deps({})", targets.join("+"));
let target_pattern = format!(
"deps({})",
targets
.iter()
.map(|t| {
if let Some(stripped) = t.strip_prefix('-') {
format!(" - {stripped}")
} else {
format!(" + {t}")
}
})
.collect::<Vec<_>>()
.join("")
.trim_start_matches(" + ")
.to_owned()
);

let mut aquery_command = bazel_command(bazel, Some(workspace), Some(output_base));
aquery_command
Expand Down
1 change: 1 addition & 0 deletions tools/rust_analyzer/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ fn generate_crate_info(
"--aspects={rules_rust}//rust:defs.bzl%rust_analyzer_aspect"
))
.arg("--output_groups=rust_analyzer_crate_spec,rust_generated_srcs,rust_analyzer_proc_macro_dylib,rust_analyzer_src")
.arg("--")
.args(targets)
.output()?;

Expand Down