Skip to content

Commit 8ea606f

Browse files
committed
Build rust-analyzer with specific target for install/pgo xtask
1 parent f0b496c commit 8ea606f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

xtask/src/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
145145
);
146146

147147
if let Some(train_crate) = opts.pgo {
148+
let target = detect_target(sh);
148149
let build_cmd = cmd!(
149150
sh,
150-
"cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --profile={profile} --locked --features force-always-assert {features...}"
151+
"cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --profile={profile} --locked --features force-always-assert {features...}"
151152
);
152153

153-
let target = detect_target(sh);
154154
let profile = crate::pgo::gather_pgo_profile(sh, build_cmd, &target, train_crate)?;
155155
install_cmd = crate::pgo::apply_pgo_to_cmd(install_cmd, &profile);
156156
}

xtask/src/pgo.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ pub(crate) fn gather_pgo_profile<'a>(
6060
} else {
6161
None
6262
}
63-
});
63+
}).collect::<Vec<_>>();
64+
65+
if profile_files.is_empty() {
66+
anyhow::bail!("rust-analyzer analysis-stats produced no pgo files. This is a bug in rust-analyzer; please file an issue.");
67+
}
68+
6469
cmd!(sh, "{llvm_profdata} merge {profile_files...} -o {merged_profile}").run().context(
6570
"cannot merge PGO profiles. Do you have the rustup `llvm-tools` component installed?",
6671
)?;

0 commit comments

Comments
 (0)