From 997d9f79dc9b12da9ed8e6dac458a01a061c99b4 Mon Sep 17 00:00:00 2001 From: Alex Kirszenberg Date: Fri, 11 Oct 2024 18:01:22 +0200 Subject: [PATCH] Pass along output_base to bazel invocations --- tools/rust_analyzer/lib.rs | 2 ++ tools/rust_analyzer/main.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/tools/rust_analyzer/lib.rs b/tools/rust_analyzer/lib.rs index 55f1946071..e75a6e029d 100644 --- a/tools/rust_analyzer/lib.rs +++ b/tools/rust_analyzer/lib.rs @@ -10,6 +10,7 @@ mod rust_project; pub fn generate_crate_info( bazel: impl AsRef, + output_base: impl AsRef, workspace: impl AsRef, rules_rust: impl AsRef, targets: &[String], @@ -21,6 +22,7 @@ pub fn generate_crate_info( .env_remove("BAZELISK_SKIP_WRAPPER") .env_remove("BUILD_WORKING_DIRECTORY") .env_remove("BUILD_WORKSPACE_DIRECTORY") + .arg(format!("--output_base={}", output_base.as_ref().display())) .arg("build") .arg("--norun_validations") .arg(format!( diff --git a/tools/rust_analyzer/main.rs b/tools/rust_analyzer/main.rs index df4b2f9bde..b55248d687 100644 --- a/tools/rust_analyzer/main.rs +++ b/tools/rust_analyzer/main.rs @@ -36,6 +36,7 @@ fn main() -> anyhow::Result<()> { // Generate the crate specs. generate_crate_info( &config.bazel, + output_base, workspace_root, rules_rust_name, &config.targets, @@ -65,6 +66,11 @@ fn parse_config() -> anyhow::Result { // We need some info from `bazel info`. Fetch it now. let mut bazel_info_command = Command::new(&config.bazel); + + if let Some(output_base) = &config.output_base { + bazel_info_command.arg(format!("--output_base={}", output_base.display())); + } + bazel_info_command .env_remove("BAZELISK_SKIP_WRAPPER") .env_remove("BUILD_WORKING_DIRECTORY")