Skip to content

Commit 2221f9c

Browse files
authored
Rollup merge of rust-lang#42306 - efyang:rls-packaging, r=alexcrichton
Add the RLS to .exe, .msi, and .pkg installers This directly addresses issue rust-lang#42157, adding the RLS as a non-default component in the mentioned installers. The windows installers appear to have the right functionality added, but I don't have a machine that runs OSX, so it would be great if someone could test whether my .pkg commit adds the RLS correctly. The final commit also fixes some formatting issues I'd noticed while working on the installers, but I don't know if that's within the scope of this PR, so input would be appreciated.
2 parents a3b842e + f3b29d3 commit 2221f9c

File tree

4 files changed

+99
-29
lines changed

4 files changed

+99
-29
lines changed

src/bootstrap/dist.rs

+46
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
914914
t!(fs::create_dir_all(pkg.join("cargo")));
915915
t!(fs::create_dir_all(pkg.join("rust-docs")));
916916
t!(fs::create_dir_all(pkg.join("rust-std")));
917+
t!(fs::create_dir_all(pkg.join("rls")));
918+
t!(fs::create_dir_all(pkg.join("rust-analysis")));
917919

918920
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)),
919921
&pkg.join("rustc"));
@@ -923,11 +925,17 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
923925
&pkg.join("rust-docs"));
924926
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target)),
925927
&pkg.join("rust-std"));
928+
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target)),
929+
&pkg.join("rls"));
930+
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target)),
931+
&pkg.join("rust-analysis"));
926932

927933
install(&etc.join("pkg/postinstall"), &pkg.join("rustc"), 0o755);
928934
install(&etc.join("pkg/postinstall"), &pkg.join("cargo"), 0o755);
929935
install(&etc.join("pkg/postinstall"), &pkg.join("rust-docs"), 0o755);
930936
install(&etc.join("pkg/postinstall"), &pkg.join("rust-std"), 0o755);
937+
install(&etc.join("pkg/postinstall"), &pkg.join("rls"), 0o755);
938+
install(&etc.join("pkg/postinstall"), &pkg.join("rust-analysis"), 0o755);
931939

932940
let pkgbuild = |component: &str| {
933941
let mut cmd = Command::new("pkgbuild");
@@ -941,6 +949,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
941949
pkgbuild("cargo");
942950
pkgbuild("rust-docs");
943951
pkgbuild("rust-std");
952+
pkgbuild("rls");
953+
pkgbuild("rust-analysis");
944954

945955
// create an 'uninstall' package
946956
install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755);
@@ -964,6 +974,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
964974
let _ = fs::remove_dir_all(&exe);
965975
t!(fs::create_dir_all(exe.join("rustc")));
966976
t!(fs::create_dir_all(exe.join("cargo")));
977+
t!(fs::create_dir_all(exe.join("rls")));
978+
t!(fs::create_dir_all(exe.join("rust-analysis")));
967979
t!(fs::create_dir_all(exe.join("rust-docs")));
968980
t!(fs::create_dir_all(exe.join("rust-std")));
969981
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
@@ -978,11 +990,19 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
978990
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target))
979991
.join(format!("rust-std-{}", target)),
980992
&exe.join("rust-std"));
993+
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target))
994+
.join("rls"),
995+
&exe.join("rls"));
996+
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target))
997+
.join(format!("rust-analysis-{}", target)),
998+
&exe.join("rust-analysis"));
981999

9821000
t!(fs::remove_file(exe.join("rustc/manifest.in")));
9831001
t!(fs::remove_file(exe.join("cargo/manifest.in")));
9841002
t!(fs::remove_file(exe.join("rust-docs/manifest.in")));
9851003
t!(fs::remove_file(exe.join("rust-std/manifest.in")));
1004+
t!(fs::remove_file(exe.join("rls/manifest.in")));
1005+
t!(fs::remove_file(exe.join("rust-analysis/manifest.in")));
9861006

9871007
if target.contains("windows-gnu") {
9881008
t!(fs::create_dir_all(exe.join("rust-mingw")));
@@ -1056,6 +1076,26 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
10561076
.arg("-dr").arg("Std")
10571077
.arg("-var").arg("var.StdDir")
10581078
.arg("-out").arg(exe.join("StdGroup.wxs")));
1079+
build.run(Command::new(&heat)
1080+
.current_dir(&exe)
1081+
.arg("dir")
1082+
.arg("rls")
1083+
.args(&heat_flags)
1084+
.arg("-cg").arg("RlsGroup")
1085+
.arg("-dr").arg("Rls")
1086+
.arg("-var").arg("var.RlsDir")
1087+
.arg("-out").arg(exe.join("RlsGroup.wxs"))
1088+
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
1089+
build.run(Command::new(&heat)
1090+
.current_dir(&exe)
1091+
.arg("dir")
1092+
.arg("rust-analysis")
1093+
.args(&heat_flags)
1094+
.arg("-cg").arg("AnalysisGroup")
1095+
.arg("-dr").arg("Analysis")
1096+
.arg("-var").arg("var.AnalysisDir")
1097+
.arg("-out").arg(exe.join("AnalysisGroup.wxs"))
1098+
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
10591099
if target.contains("windows-gnu") {
10601100
build.run(Command::new(&heat)
10611101
.current_dir(&exe)
@@ -1079,6 +1119,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
10791119
.arg("-dDocsDir=rust-docs")
10801120
.arg("-dCargoDir=cargo")
10811121
.arg("-dStdDir=rust-std")
1122+
.arg("-dRlsDir=rls")
1123+
.arg("-dAnalysisDir=rust-analysis")
10821124
.arg("-arch").arg(&arch)
10831125
.arg("-out").arg(&output)
10841126
.arg(&input);
@@ -1096,6 +1138,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
10961138
candle("DocsGroup.wxs".as_ref());
10971139
candle("CargoGroup.wxs".as_ref());
10981140
candle("StdGroup.wxs".as_ref());
1141+
candle("RlsGroup.wxs".as_ref());
1142+
candle("AnalysisGroup.wxs".as_ref());
10991143

11001144
if target.contains("windows-gnu") {
11011145
candle("GccGroup.wxs".as_ref());
@@ -1118,6 +1162,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
11181162
.arg("DocsGroup.wixobj")
11191163
.arg("CargoGroup.wixobj")
11201164
.arg("StdGroup.wixobj")
1165+
.arg("RlsGroup.wixobj")
1166+
.arg("AnalysisGroup.wixobj")
11211167
.current_dir(&exe);
11221168

11231169
if target.contains("windows-gnu") {

src/etc/installer/exe/rust.iss

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Name: gcc; Description: "Linker and platform libraries"; Types: full
4646
Name: docs; Description: "HTML documentation"; Types: full
4747
Name: cargo; Description: "Cargo, the Rust package manager"; Types: full
4848
Name: std; Description: "The Rust Standard Library"; Types: full
49+
Name: rls; Description: "RLS, the Rust Language Server"
4950

5051
[Files]
5152
Source: "rustc/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rust
@@ -55,6 +56,8 @@ Source: "rust-mingw/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs;
5556
Source: "rust-docs/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: docs
5657
Source: "cargo/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: cargo
5758
Source: "rust-std/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: std
59+
Source: "rls/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rls
60+
Source: "rust-analysis/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rls
5861

5962
[Code]
6063
const

src/etc/installer/msi/rust.wxs

+10
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@
170170
<Directory Id="Docs" Name="." />
171171
<Directory Id="Cargo" Name="." />
172172
<Directory Id="Std" Name="." />
173+
<Directory Id="Rls" Name="." />
174+
<Directory Id="Analysis" Name="." />
173175
</Directory>
174176
</Directory>
175177

@@ -273,6 +275,14 @@
273275
<ComponentRef Id="PathEnvPerMachine" />
274276
<ComponentRef Id="PathEnvPerUser" />
275277
</Feature>
278+
<Feature Id="RLS"
279+
Title="RLS, the Rust Language Server"
280+
Display="7"
281+
Level="2"
282+
AllowAdvertise="no">
283+
<ComponentGroupRef Id="RlsGroup" />
284+
<ComponentGroupRef Id="AnalysisGroup" />
285+
</Feature>
276286

277287
<UIRef Id="RustUI" />
278288
</Product>

src/etc/installer/pkg/Distribution.xml

+40-29
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,70 @@
1212
</volume-check>
1313
<choices-outline>
1414
<line choice="install">
15-
<line choice="rustc"/>
16-
<line choice="rust-std"/>
17-
<line choice="cargo"/>
18-
<line choice="rust-docs"/>
15+
<line choice="rustc"/>
16+
<line choice="rust-std"/>
17+
<line choice="cargo"/>
18+
<line choice="rust-docs"/>
19+
<line choice="rls"/>
1920
</line>
2021
<line choice="uninstall" />
2122
</choices-outline>
2223
<!--
23-
These 'selected' scripts ensure that install and uninstall can never be selected at
24-
the same time. Exectly how they work is pretty mysterious, tied to the unspecified algorithm
25-
the installer uses to traverse the options after one is toggled.
24+
These 'selected' scripts ensure that install and uninstall can never be selected at
25+
the same time. Exectly how they work is pretty mysterious, tied to the unspecified algorithm
26+
the installer uses to traverse the options after one is toggled.
2627
-->
2728
<choice id="install" visible="true"
28-
title="Install Rust" description="Install the Rust compiler, package manager and documentation."
29-
customLocation="/usr/local"
30-
selected="!choices.uninstall.selected"
31-
/>
29+
title="Install Rust" description="Install the Rust compiler, package manager and documentation."
30+
customLocation="/usr/local"
31+
selected="!choices.uninstall.selected"
32+
/>
3233
<choice id="uninstall" visible="true"
33-
title="Uninstall Rust" description="Select this option to uninstall an existing Rust installation."
34-
customLocation="/usr/local"
35-
selected="!(choices.install.selected || choices.rustc.selected || choices.cargo.selected || choices['rust-docs'].selected)"
36-
start_selected="false"
37-
>
38-
<pkg-ref id="org.rust-lang.uninstall" />
34+
title="Uninstall Rust" description="Select this option to uninstall an existing Rust installation."
35+
customLocation="/usr/local"
36+
selected="!(choices.install.selected || choices.rustc.selected || choices.cargo.selected || choices['rust-docs'].selected)"
37+
start_selected="false"
38+
>
39+
<pkg-ref id="org.rust-lang.uninstall"/>
3940
</choice>
4041
<choice id="rustc" visible="true"
41-
title="Compiler" description="rustc, the Rust compiler, and rustdoc, the API documentation tool."
42-
selected="(!choices.uninstall.selected &amp;&amp; choices.rustc.selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
43-
>
42+
title="Compiler" description="rustc, the Rust compiler, and rustdoc, the API documentation tool."
43+
selected="(!choices.uninstall.selected &amp;&amp; choices.rustc.selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
44+
>
4445
<pkg-ref id="org.rust-lang.rustc"/>
4546
</choice>
4647
<choice id="cargo" visible="true"
47-
title="Cargo" description="cargo, the Rust package manager."
48-
selected="(!choices.uninstall.selected &amp;&amp; choices.cargo.selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
49-
>
48+
title="Cargo" description="cargo, the Rust package manager."
49+
selected="(!choices.uninstall.selected &amp;&amp; choices.cargo.selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
50+
>
5051
<pkg-ref id="org.rust-lang.cargo"/>
5152
</choice>
5253
<choice id="rust-std" visible="true"
53-
title="Standard Library" description="The Rust standard library."
54-
selected="(!choices.uninstall.selected &amp;&amp; choices['rust-std'].selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
55-
>
54+
title="Standard Library" description="The Rust standard library."
55+
selected="(!choices.uninstall.selected &amp;&amp; choices['rust-std'].selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
56+
>
5657
<pkg-ref id="org.rust-lang.rust-std"/>
5758
</choice>
5859
<choice id="rust-docs" visible="true"
59-
title="Documentation" description="HTML documentation."
60-
selected="(!choices.uninstall.selected &amp;&amp; choices['rust-docs'].selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
61-
>
60+
title="Documentation" description="HTML documentation."
61+
selected="(!choices.uninstall.selected &amp;&amp; choices['rust-docs'].selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
62+
>
6263
<pkg-ref id="org.rust-lang.rust-docs"/>
6364
</choice>
65+
<choice id="rls" visible="true"
66+
title="RLS" description="RLS, the Rust Language Server"
67+
selected="(!choices.uninstall.selected &amp;&amp; choices['rls'].selected) || (choices.uninstall.selected &amp;&amp; choices.install.selected)"
68+
start_selected="false"
69+
>
70+
<pkg-ref id="org.rust-lang.rls"/>
71+
<pkg-ref id="org.rust-lang.rust-analysis"/>
72+
</choice>
6473
<pkg-ref id="org.rust-lang.rustc" version="0" onConclusion="none">rustc.pkg</pkg-ref>
6574
<pkg-ref id="org.rust-lang.cargo" version="0" onConclusion="none">cargo.pkg</pkg-ref>
6675
<pkg-ref id="org.rust-lang.rust-docs" version="0" onConclusion="none">rust-docs.pkg</pkg-ref>
6776
<pkg-ref id="org.rust-lang.rust-std" version="0" onConclusion="none">rust-std.pkg</pkg-ref>
77+
<pkg-ref id="org.rust-lang.rls" version="0" onConclusion="none">rls.pkg</pkg-ref>
78+
<pkg-ref id="org.rust-lang.rust-analysis" version="0" onConclusion="none">rust-analysis.pkg</pkg-ref>
6879
<pkg-ref id="org.rust-lang.uninstall" version="0" onConclusion="none">uninstall.pkg</pkg-ref>
6980
<background file="rust-logo.png" mime-type="image/png"
7081
alignment="bottomleft"/>

0 commit comments

Comments
 (0)