Skip to content

Commit

Permalink
Pass along output_base to bazel invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkirsz committed Oct 17, 2024
1 parent ded96a9 commit 997d9f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/rust_analyzer/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mod rust_project;

pub fn generate_crate_info(
bazel: impl AsRef<Path>,
output_base: impl AsRef<Path>,
workspace: impl AsRef<Path>,
rules_rust: impl AsRef<str>,
targets: &[String],
Expand All @@ -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!(
Expand Down
6 changes: 6 additions & 0 deletions tools/rust_analyzer/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -65,6 +66,11 @@ fn parse_config() -> anyhow::Result<Config> {

// 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")
Expand Down

0 comments on commit 997d9f7

Please sign in to comment.