Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'xtask/src/install.rs')
| -rw-r--r-- | xtask/src/install.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/xtask/src/install.rs b/xtask/src/install.rs index f0cc445dfa..975e361ba5 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -39,6 +39,18 @@ pub(crate) struct ServerOpt { pub(crate) malloc: Malloc, pub(crate) dev_rel: bool, pub(crate) pgo: Option<PgoTrainingCrate>, + pub(crate) force_always_assert: bool, +} + +impl ServerOpt { + fn to_features(&self) -> Vec<&'static str> { + let mut features = Vec::new(); + features.extend(self.malloc.to_features()); + if self.force_always_assert { + features.extend(["--features", "force-always-assert"]); + } + features + } } pub(crate) struct ProcMacroServerOpt { @@ -136,7 +148,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> { } fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> { - let features = opts.malloc.to_features(); + let features = &opts.to_features(); let profile = if opts.dev_rel { "dev-rel" } else { "release" }; let mut install_cmd = cmd!( @@ -145,12 +157,12 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> { ); if let Some(train_crate) = opts.pgo { + let target = detect_target(sh); let build_cmd = cmd!( sh, - "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --profile={profile} --locked --features force-always-assert {features...}" + "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --profile={profile} --locked {features...}" ); - let target = detect_target(sh); let profile = crate::pgo::gather_pgo_profile(sh, build_cmd, &target, train_crate)?; install_cmd = crate::pgo::apply_pgo_to_cmd(install_cmd, &profile); } |