Skip to content

Commit acbbdef

Browse files
committed
wix: allow to skip more components
1 parent 9c87288 commit acbbdef

File tree

2 files changed

+78
-34
lines changed

2 files changed

+78
-34
lines changed

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

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ impl Step for Extended {
18631863
.arg("-out")
18641864
.arg(&output)
18651865
.arg(input);
1866-
add_env(builder, &mut cmd, target);
1866+
add_env(builder, &mut cmd, target, &built_tools);
18671867

18681868
if built_tools.contains("clippy") {
18691869
cmd.arg("-dClippyDir=clippy");
@@ -1967,7 +1967,14 @@ impl Step for Extended {
19671967
}
19681968
}
19691969

1970-
fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSelection) {
1970+
fn add_env(
1971+
builder: &Builder<'_>,
1972+
cmd: &mut BootstrapCommand,
1973+
target: TargetSelection,
1974+
built_tools: &HashSet<&'static str>,
1975+
) {
1976+
// envs for wix should be always defined, even if not used
1977+
// FIXME: is they affect ccache?
19711978
let mut parts = builder.version.split('.');
19721979
cmd.env("CFG_RELEASE_INFO", builder.rust_version())
19731980
.env("CFG_RELEASE_NUM", &builder.version)
@@ -1988,6 +1995,27 @@ fn add_env(builder: &Builder<'_>, cmd: &mut BootstrapCommand, target: TargetSele
19881995
} else {
19891996
cmd.env("CFG_MINGW", "0").env("CFG_ABI", "MSVC");
19901997
}
1998+
1999+
if built_tools.contains("rustfmt") {
2000+
cmd.env("CFG_RUSTFMT", "1");
2001+
} else {
2002+
cmd.env("CFG_RUSTFMT", "0");
2003+
}
2004+
if built_tools.contains("clippy") {
2005+
cmd.env("CFG_CLIPPY", "1");
2006+
} else {
2007+
cmd.env("CFG_CLIPPY", "0");
2008+
}
2009+
if built_tools.contains("miri") {
2010+
cmd.env("CFG_MIRI", "1");
2011+
} else {
2012+
cmd.env("CFG_MIRI", "0");
2013+
}
2014+
if built_tools.contains("rust-analyzer") {
2015+
cmd.env("CFG_RA", "1");
2016+
} else {
2017+
cmd.env("CFG_RA", "0");
2018+
}
19912019
}
19922020

19932021
fn install_llvm_file(

src/etc/installer/msi/rust.wxs

Lines changed: 48 additions & 32 deletions
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)