Skip to content

Commit

Permalink
Make rust-docs optional for the Windows MSI installer.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Apr 4, 2023
1 parent 7b9aa5f commit 6b57a34
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
51 changes: 29 additions & 22 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,11 +1585,10 @@ impl Step for Extended {
prepare("rustc");
prepare("cargo");
prepare("rust-analysis");
prepare("rust-docs");
prepare("rust-std");
prepare("clippy");
prepare("rust-analyzer");
for tool in &["rust-demangler", "miri"] {
for tool in &["rust-docs", "rust-demangler", "miri"] {
if built_tools.contains(tool) {
prepare(tool);
}
Expand Down Expand Up @@ -1624,23 +1623,25 @@ impl Step for Extended {
.arg("-out")
.arg(exe.join("RustcGroup.wxs")),
);
builder.run(
Command::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-docs")
.args(&heat_flags)
.arg("-cg")
.arg("DocsGroup")
.arg("-dr")
.arg("Docs")
.arg("-var")
.arg("var.DocsDir")
.arg("-out")
.arg(exe.join("DocsGroup.wxs"))
.arg("-t")
.arg(etc.join("msi/squash-components.xsl")),
);
if built_tools.contains("rust-docs") {
builder.run(
Command::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-docs")
.args(&heat_flags)
.arg("-cg")
.arg("DocsGroup")
.arg("-dr")
.arg("Docs")
.arg("-var")
.arg("var.DocsDir")
.arg("-out")
.arg(exe.join("DocsGroup.wxs"))
.arg("-t")
.arg(etc.join("msi/squash-components.xsl")),
);
}
builder.run(
Command::new(&heat)
.current_dir(&exe)
Expand Down Expand Up @@ -1787,7 +1788,6 @@ impl Step for Extended {
cmd.current_dir(&exe)
.arg("-nologo")
.arg("-dRustcDir=rustc")
.arg("-dDocsDir=rust-docs")
.arg("-dCargoDir=cargo")
.arg("-dStdDir=rust-std")
.arg("-dAnalysisDir=rust-analysis")
Expand All @@ -1799,6 +1799,9 @@ impl Step for Extended {
.arg(&input);
add_env(builder, &mut cmd, target);

if built_tools.contains("rust-docs") {
cmd.arg("-dDocsDir=rust-docs");
}
if built_tools.contains("rust-demangler") {
cmd.arg("-dRustDemanglerDir=rust-demangler");
}
Expand All @@ -1817,7 +1820,9 @@ impl Step for Extended {
candle(&etc.join("msi/ui.wxs"));
candle(&etc.join("msi/rustwelcomedlg.wxs"));
candle("RustcGroup.wxs".as_ref());
candle("DocsGroup.wxs".as_ref());
if built_tools.contains("rust-docs") {
candle("DocsGroup.wxs".as_ref());
}
candle("CargoGroup.wxs".as_ref());
candle("StdGroup.wxs".as_ref());
candle("ClippyGroup.wxs".as_ref());
Expand Down Expand Up @@ -1854,7 +1859,6 @@ impl Step for Extended {
.arg("ui.wixobj")
.arg("rustwelcomedlg.wixobj")
.arg("RustcGroup.wixobj")
.arg("DocsGroup.wixobj")
.arg("CargoGroup.wixobj")
.arg("StdGroup.wixobj")
.arg("AnalysisGroup.wixobj")
Expand All @@ -1870,6 +1874,9 @@ impl Step for Extended {
if built_tools.contains("rust-demangler") {
cmd.arg("RustDemanglerGroup.wixobj");
}
if built_tools.contains("rust-docs") {
cmd.arg("DocsGroup.wixobj");
}

if target.ends_with("windows-gnu") {
cmd.arg("GccGroup.wixobj");
Expand Down
6 changes: 6 additions & 0 deletions src/etc/installer/msi/rust.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@
<?if $(env.CFG_MINGW)="1" ?>
<Directory Id="Gcc" Name="." />
<?endif?>
<!-- tool-rust-docs-start -->
<Directory Id="Docs" Name="." />
<!-- tool-rust-docs-end -->
<Directory Id="Cargo" Name="." />
<Directory Id="Std" Name="." />
</Directory>
Expand Down Expand Up @@ -209,6 +211,7 @@
<RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustShell" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Id="ApplicationProgramsFolder1" On="uninstall" />
</Component>
<!-- tool-rust-docs-start -->
<Component Id="DocIndexShortcut" Guid="*">
<Shortcut Id="RustDocs"
Name="$(var.ProductName) Documentation"
Expand All @@ -217,6 +220,7 @@
<RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustDocs" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Id="ApplicationProgramsFolder2" On="uninstall" />
</Component>
<!-- tool-rust-docs-end -->
</Directory>
</Directory>

Expand Down Expand Up @@ -256,6 +260,7 @@
<ComponentGroupRef Id="GccGroup" />
</Feature>
<?endif?>
<!-- tool-rust-docs-start -->
<Feature Id="Docs"
Title="HTML documentation"
Display="5"
Expand All @@ -264,6 +269,7 @@
<ComponentGroupRef Id="DocsGroup" />
<ComponentRef Id="DocIndexShortcut" />
</Feature>
<!-- tool-rust-docs-end -->
<Feature Id="Path"
Title="Add to PATH"
Description="Add Rust to PATH environment variable"
Expand Down

0 comments on commit 6b57a34

Please sign in to comment.