From acbbdef9d6b61690a5a1fe2b84803c4268f65264 Mon Sep 17 00:00:00 2001 From: klensy Date: Sat, 16 Nov 2024 11:31:34 +0300 Subject: [PATCH] wix: allow to skip more components --- src/bootstrap/src/core/build_steps/dist.rs | 32 ++++++++- src/etc/installer/msi/rust.wxs | 80 +++++++++++++--------- 2 files changed, 78 insertions(+), 34 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 8bfa9cc94b341..244037291faad 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1863,7 +1863,7 @@ impl Step for Extended { .arg("-out") .arg(&output) .arg(input); - add_env(builder, &mut cmd, target); + add_env(builder, &mut cmd, target, &built_tools); if built_tools.contains("clippy") { cmd.arg("-dClippyDir=clippy"); @@ -1967,7 +1967,14 @@ impl Step for Extended { } } -fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSelection) { +fn add_env( + builder: &Builder<'_>, + cmd: &mut BootstrapCommand, + target: TargetSelection, + built_tools: &HashSet<&'static str>, +) { + // envs for wix should be always defined, even if not used + // FIXME: is they affect ccache? let mut parts = builder.version.split('.'); cmd.env("CFG_RELEASE_INFO", builder.rust_version()) .env("CFG_RELEASE_NUM", &builder.version) @@ -1988,6 +1995,27 @@ fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSele } else { cmd.env("CFG_MINGW", "0").env("CFG_ABI", "MSVC"); } + + if built_tools.contains("rustfmt") { + cmd.env("CFG_RUSTFMT", "1"); + } else { + cmd.env("CFG_RUSTFMT", "0"); + } + if built_tools.contains("clippy") { + cmd.env("CFG_CLIPPY", "1"); + } else { + cmd.env("CFG_CLIPPY", "0"); + } + if built_tools.contains("miri") { + cmd.env("CFG_MIRI", "1"); + } else { + cmd.env("CFG_MIRI", "0"); + } + if built_tools.contains("rust-analyzer") { + cmd.env("CFG_RA", "1"); + } else { + cmd.env("CFG_RA", "0"); + } } fn install_llvm_file( diff --git a/src/etc/installer/msi/rust.wxs b/src/etc/installer/msi/rust.wxs index 2d155bf0b1019..64cceccc97582 100644 --- a/src/etc/installer/msi/rust.wxs +++ b/src/etc/installer/msi/rust.wxs @@ -172,11 +172,19 @@ - - - + + + + + + + + + - + + + @@ -284,34 +292,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +