Skip to content

Commit 43152ad

Browse files
klensyheiseish
authored andcommitted
wix: allow to skip more components
1 parent a0abd61 commit 43152ad

File tree

2 files changed

+78
-34
lines changed

2 files changed

+78
-34
lines changed

src/bootstrap/src/core/build_steps/dist.rs

+30-2
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ impl Step for Extended {
18561856
.arg("-out")
18571857
.arg(&output)
18581858
.arg(input);
1859-
add_env(builder, &mut cmd, target);
1859+
add_env(builder, &mut cmd, target, &built_tools);
18601860

18611861
if built_tools.contains("clippy") {
18621862
cmd.arg("-dClippyDir=clippy");
@@ -1960,7 +1960,14 @@ impl Step for Extended {
19601960
}
19611961
}
19621962

1963-
fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSelection) {
1963+
fn add_env(
1964+
builder: &Builder<'_>,
1965+
cmd: &mut BootstrapCommand,
1966+
target: TargetSelection,
1967+
built_tools: &HashSet<&'static str>,
1968+
) {
1969+
// envs for wix should be always defined, even if not used
1970+
// FIXME: is they affect ccache?
19641971
let mut parts = builder.version.split('.');
19651972
cmd.env("CFG_RELEASE_INFO", builder.rust_version())
19661973
.env("CFG_RELEASE_NUM", &builder.version)
@@ -1981,6 +1988,27 @@ fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSele
19811988
} else {
19821989
cmd.env("CFG_MINGW", "0").env("CFG_ABI", "MSVC");
19831990
}
1991+
1992+
if built_tools.contains("rustfmt") {
1993+
cmd.env("CFG_RUSTFMT", "1");
1994+
} else {
1995+
cmd.env("CFG_RUSTFMT", "0");
1996+
}
1997+
if built_tools.contains("clippy") {
1998+
cmd.env("CFG_CLIPPY", "1");
1999+
} else {
2000+
cmd.env("CFG_CLIPPY", "0");
2001+
}
2002+
if built_tools.contains("miri") {
2003+
cmd.env("CFG_MIRI", "1");
2004+
} else {
2005+
cmd.env("CFG_MIRI", "0");
2006+
}
2007+
if built_tools.contains("rust-analyzer") {
2008+
cmd.env("CFG_RA", "1");
2009+
} else {
2010+
cmd.env("CFG_RA", "0");
2011+
}
19842012
}
19852013

19862014
fn install_llvm_file(

src/etc/installer/msi/rust.wxs

+48-32
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,19 @@
172172
<!-- tool-rust-docs-end -->
173173
<Directory Id="Cargo" Name="." />
174174
<Directory Id="Std" Name="." />
175-
<Directory Id="RustFmt" Name="." />
176-
<Directory Id="RustAnalyzer" Name="." />
177-
<Directory Id="Miri" Name="." />
175+
<?if $(env.CFG_RUSTFMT)="1" ?>
176+
<Directory Id="RustFmt" Name="." />
177+
<?endif?>
178+
<?if $(env.CFG_RA)="1" ?>
179+
<Directory Id="RustAnalyzer" Name="." />
180+
<?endif?>
181+
<?if $(env.CFG_MIRI)="1" ?>
182+
<Directory Id="Miri" Name="." />
183+
<?endif?>
178184
<Directory Id="Analysis" Name="." />
179-
<Directory Id="Clippy" Name="." />
185+
<?if $(env.CFG_CLIPPY)="1" ?>
186+
<Directory Id="Clippy" Name="." />
187+
<?endif?>
180188
</Directory>
181189
</Directory>
182190

@@ -284,34 +292,42 @@
284292
<ComponentRef Id="PathEnvPerMachine" />
285293
<ComponentRef Id="PathEnvPerUser" />
286294
</Feature>
287-
<Feature Id="RustFmt"
288-
Title="Formatter for rust"
289-
Display="7"
290-
Level="1"
291-
AllowAdvertise="no">
292-
<ComponentGroupRef Id="RustFmtGroup" />
293-
</Feature>
294-
<Feature Id="Clippy"
295-
Title="Formatter and checker for rust"
296-
Display="8"
297-
Level="1"
298-
AllowAdvertise="no">
299-
<ComponentGroupRef Id="ClippyGroup" />
300-
</Feature>
301-
<Feature Id="Miri"
302-
Title="Soundness checker for rust"
303-
Display="9"
304-
Level="1"
305-
AllowAdvertise="no">
306-
<ComponentGroupRef Id="MiriGroup" />
307-
</Feature>
308-
<Feature Id="RustAnalyzer"
309-
Title="Analyzer for rust"
310-
Display="10"
311-
Level="1"
312-
AllowAdvertise="no">
313-
<ComponentGroupRef Id="RustAnalyzerGroup" />
314-
</Feature>
295+
<?if $(env.CFG_RUSTFMT)="1" ?>
296+
<Feature Id="RustFmt"
297+
Title="Formatter for rust"
298+
Display="7"
299+
Level="1"
300+
AllowAdvertise="no">
301+
<ComponentGroupRef Id="RustFmtGroup" />
302+
</Feature>
303+
<?endif?>
304+
<?if $(env.CFG_CLIPPY)="1" ?>
305+
<Feature Id="Clippy"
306+
Title="Formatter and checker for rust"
307+
Display="8"
308+
Level="1"
309+
AllowAdvertise="no">
310+
<ComponentGroupRef Id="ClippyGroup" />
311+
</Feature>
312+
<?endif?>
313+
<?if $(env.CFG_MIRI)="1" ?>
314+
<Feature Id="Miri"
315+
Title="Soundness checker for rust"
316+
Display="9"
317+
Level="1"
318+
AllowAdvertise="no">
319+
<ComponentGroupRef Id="MiriGroup" />
320+
</Feature>
321+
<?endif?>
322+
<?if $(env.CFG_RA)="1" ?>
323+
<Feature Id="RustAnalyzer"
324+
Title="Analyzer for rust"
325+
Display="10"
326+
Level="1"
327+
AllowAdvertise="no">
328+
<ComponentGroupRef Id="RustAnalyzerGroup" />
329+
</Feature>
330+
<?endif?>
315331
<Feature Id="Analysis"
316332
Title="Analysis for rust"
317333
Display="11"

0 commit comments

Comments
 (0)