Skip to content

Commit 749b487

Browse files
committed
Auto merge of rust-lang#109880 - ehuss:fix-macos-installer-rust-docs, r=Mark-Simulacrum
Fix macOS and Windows installers when rust-docs is not available. This fixes the macOS `.pkg` and Windows `.msi` installers to work when rust-docs is not available. If the rust-docs component is not built, then the installer would fail. This adds the rust-docs component to the filtering mechanism so that the rust-docs line of the distribution definition aren't included. I tested installing and uninstalling both with and without the rust-docs component available. This happens on the aarch64-apple-darwin distribution provided by rust-lang since we currently disable the rust-docs component due to long build times. An alternate solution would be to just enable the rust-docs component on aarch64-apple-darwin since there are faster build systems. Fixes rust-lang#109877
2 parents 3c2e2dd + 6b57a34 commit 749b487

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

src/bootstrap/dist.rs

+30-23
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ impl Step for Extended {
14881488

14891489
let xform = |p: &Path| {
14901490
let mut contents = t!(fs::read_to_string(p));
1491-
for tool in &["rust-demangler", "miri"] {
1491+
for tool in &["rust-demangler", "miri", "rust-docs"] {
14921492
if !built_tools.contains(tool) {
14931493
contents = filter(&contents, tool);
14941494
}
@@ -1585,11 +1585,10 @@ impl Step for Extended {
15851585
prepare("rustc");
15861586
prepare("cargo");
15871587
prepare("rust-analysis");
1588-
prepare("rust-docs");
15891588
prepare("rust-std");
15901589
prepare("clippy");
15911590
prepare("rust-analyzer");
1592-
for tool in &["rust-demangler", "miri"] {
1591+
for tool in &["rust-docs", "rust-demangler", "miri"] {
15931592
if built_tools.contains(tool) {
15941593
prepare(tool);
15951594
}
@@ -1624,23 +1623,25 @@ impl Step for Extended {
16241623
.arg("-out")
16251624
.arg(exe.join("RustcGroup.wxs")),
16261625
);
1627-
builder.run(
1628-
Command::new(&heat)
1629-
.current_dir(&exe)
1630-
.arg("dir")
1631-
.arg("rust-docs")
1632-
.args(&heat_flags)
1633-
.arg("-cg")
1634-
.arg("DocsGroup")
1635-
.arg("-dr")
1636-
.arg("Docs")
1637-
.arg("-var")
1638-
.arg("var.DocsDir")
1639-
.arg("-out")
1640-
.arg(exe.join("DocsGroup.wxs"))
1641-
.arg("-t")
1642-
.arg(etc.join("msi/squash-components.xsl")),
1643-
);
1626+
if built_tools.contains("rust-docs") {
1627+
builder.run(
1628+
Command::new(&heat)
1629+
.current_dir(&exe)
1630+
.arg("dir")
1631+
.arg("rust-docs")
1632+
.args(&heat_flags)
1633+
.arg("-cg")
1634+
.arg("DocsGroup")
1635+
.arg("-dr")
1636+
.arg("Docs")
1637+
.arg("-var")
1638+
.arg("var.DocsDir")
1639+
.arg("-out")
1640+
.arg(exe.join("DocsGroup.wxs"))
1641+
.arg("-t")
1642+
.arg(etc.join("msi/squash-components.xsl")),
1643+
);
1644+
}
16441645
builder.run(
16451646
Command::new(&heat)
16461647
.current_dir(&exe)
@@ -1787,7 +1788,6 @@ impl Step for Extended {
17871788
cmd.current_dir(&exe)
17881789
.arg("-nologo")
17891790
.arg("-dRustcDir=rustc")
1790-
.arg("-dDocsDir=rust-docs")
17911791
.arg("-dCargoDir=cargo")
17921792
.arg("-dStdDir=rust-std")
17931793
.arg("-dAnalysisDir=rust-analysis")
@@ -1799,6 +1799,9 @@ impl Step for Extended {
17991799
.arg(&input);
18001800
add_env(builder, &mut cmd, target);
18011801

1802+
if built_tools.contains("rust-docs") {
1803+
cmd.arg("-dDocsDir=rust-docs");
1804+
}
18021805
if built_tools.contains("rust-demangler") {
18031806
cmd.arg("-dRustDemanglerDir=rust-demangler");
18041807
}
@@ -1817,7 +1820,9 @@ impl Step for Extended {
18171820
candle(&etc.join("msi/ui.wxs"));
18181821
candle(&etc.join("msi/rustwelcomedlg.wxs"));
18191822
candle("RustcGroup.wxs".as_ref());
1820-
candle("DocsGroup.wxs".as_ref());
1823+
if built_tools.contains("rust-docs") {
1824+
candle("DocsGroup.wxs".as_ref());
1825+
}
18211826
candle("CargoGroup.wxs".as_ref());
18221827
candle("StdGroup.wxs".as_ref());
18231828
candle("ClippyGroup.wxs".as_ref());
@@ -1854,7 +1859,6 @@ impl Step for Extended {
18541859
.arg("ui.wixobj")
18551860
.arg("rustwelcomedlg.wixobj")
18561861
.arg("RustcGroup.wixobj")
1857-
.arg("DocsGroup.wixobj")
18581862
.arg("CargoGroup.wixobj")
18591863
.arg("StdGroup.wixobj")
18601864
.arg("AnalysisGroup.wixobj")
@@ -1870,6 +1874,9 @@ impl Step for Extended {
18701874
if built_tools.contains("rust-demangler") {
18711875
cmd.arg("RustDemanglerGroup.wixobj");
18721876
}
1877+
if built_tools.contains("rust-docs") {
1878+
cmd.arg("DocsGroup.wixobj");
1879+
}
18731880

18741881
if target.ends_with("windows-gnu") {
18751882
cmd.arg("GccGroup.wixobj");

src/etc/installer/msi/rust.wxs

+6
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@
167167
<?if $(env.CFG_MINGW)="1" ?>
168168
<Directory Id="Gcc" Name="." />
169169
<?endif?>
170+
<!-- tool-rust-docs-start -->
170171
<Directory Id="Docs" Name="." />
172+
<!-- tool-rust-docs-end -->
171173
<Directory Id="Cargo" Name="." />
172174
<Directory Id="Std" Name="." />
173175
</Directory>
@@ -209,6 +211,7 @@
209211
<RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustShell" Type="integer" Value="1" KeyPath="yes" />
210212
<RemoveFolder Id="ApplicationProgramsFolder1" On="uninstall" />
211213
</Component>
214+
<!-- tool-rust-docs-start -->
212215
<Component Id="DocIndexShortcut" Guid="*">
213216
<Shortcut Id="RustDocs"
214217
Name="$(var.ProductName) Documentation"
@@ -217,6 +220,7 @@
217220
<RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustDocs" Type="integer" Value="1" KeyPath="yes" />
218221
<RemoveFolder Id="ApplicationProgramsFolder2" On="uninstall" />
219222
</Component>
223+
<!-- tool-rust-docs-end -->
220224
</Directory>
221225
</Directory>
222226

@@ -256,6 +260,7 @@
256260
<ComponentGroupRef Id="GccGroup" />
257261
</Feature>
258262
<?endif?>
263+
<!-- tool-rust-docs-start -->
259264
<Feature Id="Docs"
260265
Title="HTML documentation"
261266
Display="5"
@@ -264,6 +269,7 @@
264269
<ComponentGroupRef Id="DocsGroup" />
265270
<ComponentRef Id="DocIndexShortcut" />
266271
</Feature>
272+
<!-- tool-rust-docs-end -->
267273
<Feature Id="Path"
268274
Title="Add to PATH"
269275
Description="Add Rust to PATH environment variable"

src/etc/installer/pkg/Distribution.xml

+6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
<line choice="rustc"/>
1616
<line choice="rust-std"/>
1717
<line choice="cargo"/>
18+
<!-- tool-rust-docs-start -->
1819
<line choice="rust-docs"/>
20+
<!-- tool-rust-docs-end -->
1921
</line>
2022
<line choice="uninstall" />
2123
</choices-outline>
@@ -55,15 +57,19 @@
5557
>
5658
<pkg-ref id="org.rust-lang.rust-std"/>
5759
</choice>
60+
<!-- tool-rust-docs-start -->
5861
<choice id="rust-docs" visible="true"
5962
title="Documentation" description="HTML documentation."
6063
selected="(!choices.uninstall.selected &amp;&amp; choices['rust-docs'].selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
6164
>
6265
<pkg-ref id="org.rust-lang.rust-docs"/>
6366
</choice>
67+
<!-- tool-rust-docs-end -->
6468
<pkg-ref id="org.rust-lang.rustc" version="0" onConclusion="none">rustc.pkg</pkg-ref>
6569
<pkg-ref id="org.rust-lang.cargo" version="0" onConclusion="none">cargo.pkg</pkg-ref>
70+
<!-- tool-rust-docs-start -->
6671
<pkg-ref id="org.rust-lang.rust-docs" version="0" onConclusion="none">rust-docs.pkg</pkg-ref>
72+
<!-- tool-rust-docs-end -->
6773
<pkg-ref id="org.rust-lang.rust-std" version="0" onConclusion="none">rust-std.pkg</pkg-ref>
6874
<pkg-ref id="org.rust-lang.uninstall" version="0" onConclusion="none">uninstall.pkg</pkg-ref>
6975
<background file="rust-logo.png" mime-type="image/png"

0 commit comments

Comments
 (0)