Skip to content

wix: allow to skip more components #135255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this referring to? I don't think we use (s?)ccache for Wix invocations?

It's also not clear to me what we mean by "should always be defined even if not used". Can you elaborate? What happens if we get that wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference to sccache because this comment from pr with attempt to bump sccache, should be deleted.

As for "defined" - wix fails to build if it can't find all associated with components env vars. i.e. for rustfmt - which is optional, env var CFG_RUSTFMT should be always set (with 1 or 0 value), doesn't matter if it rustfmt component build or not. Hmm, need rephrase this.

let mut parts = builder.version.split('.');
cmd.env("CFG_RELEASE_INFO", builder.rust_version())
.env("CFG_RELEASE_NUM", &builder.version)
Expand All @@ -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(
Expand Down
80 changes: 48 additions & 32 deletions src/etc/installer/msi/rust.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,19 @@
<!-- tool-rust-docs-end -->
<Directory Id="Cargo" Name="." />
<Directory Id="Std" Name="." />
<Directory Id="RustFmt" Name="." />
<Directory Id="RustAnalyzer" Name="." />
<Directory Id="Miri" Name="." />
<?if $(env.CFG_RUSTFMT)="1" ?>
<Directory Id="RustFmt" Name="." />
<?endif?>
<?if $(env.CFG_RA)="1" ?>
<Directory Id="RustAnalyzer" Name="." />
<?endif?>
<?if $(env.CFG_MIRI)="1" ?>
<Directory Id="Miri" Name="." />
<?endif?>
<Directory Id="Analysis" Name="." />
<Directory Id="Clippy" Name="." />
<?if $(env.CFG_CLIPPY)="1" ?>
<Directory Id="Clippy" Name="." />
<?endif?>
</Directory>
</Directory>

Expand Down Expand Up @@ -284,34 +292,42 @@
<ComponentRef Id="PathEnvPerMachine" />
<ComponentRef Id="PathEnvPerUser" />
</Feature>
<Feature Id="RustFmt"
Title="Formatter for rust"
Display="7"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="RustFmtGroup" />
</Feature>
<Feature Id="Clippy"
Title="Formatter and checker for rust"
Display="8"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="ClippyGroup" />
</Feature>
<Feature Id="Miri"
Title="Soundness checker for rust"
Display="9"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="MiriGroup" />
</Feature>
<Feature Id="RustAnalyzer"
Title="Analyzer for rust"
Display="10"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="RustAnalyzerGroup" />
</Feature>
<?if $(env.CFG_RUSTFMT)="1" ?>
<Feature Id="RustFmt"
Title="Formatter for rust"
Display="7"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="RustFmtGroup" />
</Feature>
<?endif?>
<?if $(env.CFG_CLIPPY)="1" ?>
<Feature Id="Clippy"
Title="Formatter and checker for rust"
Display="8"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="ClippyGroup" />
</Feature>
<?endif?>
<?if $(env.CFG_MIRI)="1" ?>
<Feature Id="Miri"
Title="Soundness checker for rust"
Display="9"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="MiriGroup" />
</Feature>
<?endif?>
<?if $(env.CFG_RA)="1" ?>
<Feature Id="RustAnalyzer"
Title="Analyzer for rust"
Display="10"
Level="1"
AllowAdvertise="no">
<ComponentGroupRef Id="RustAnalyzerGroup" />
</Feature>
<?endif?>
<Feature Id="Analysis"
Title="Analysis for rust"
Display="11"
Expand Down
Loading