Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass along output_base to bazel invocations in gen_rust_project #2933

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Loading