Skip to content

Commit 223b280

Browse files
committed
Reviewer changes
1 parent c55325e commit 223b280

File tree

4 files changed

+19
-73
lines changed

4 files changed

+19
-73
lines changed

rls

Submodule rls updated from e24fc84 to 88fc39b

src/bootstrap/dist.rs

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn pkgname(build: &Build, component: &str) -> String {
4040
if component == "cargo" {
4141
format!("{}-{}", component, build.cargo_package_vers())
4242
} else {
43-
assert!(component.starts_with("rust"));
43+
assert!(component.starts_with("rust") || component == "rls");
4444
format!("{}-{}", component, build.rust_package_vers())
4545
}
4646
}
@@ -540,7 +540,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
540540

541541
let src = build.src.join("cargo");
542542
let etc = src.join("src/etc");
543-
let release_num = build.cargo_release_num();
543+
let release_num = build.release_num("cargo");
544544
let name = pkgname(build, "cargo");
545545
let version = build.cargo_info.version(build, &release_num);
546546

@@ -599,7 +599,7 @@ pub fn rls(build: &Build, stage: u32, target: &str) {
599599
let compiler = Compiler::new(stage, &build.config.build);
600600

601601
let src = build.src.join("rls");
602-
let release_num = build.rls_release_num();
602+
let release_num = build.release_num("rls");
603603
let name = format!("rls-{}", build.package_vers(&release_num));
604604

605605
let tmp = tmpdir(build);
@@ -642,8 +642,9 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
642642
let cargo_installer = dist.join(format!("{}-{}.tar.gz",
643643
pkgname(build, "cargo"),
644644
target));
645-
let rls_installer = dist.join(format!("{}.tar.gz",
646-
pkgname(build, "rls")));
645+
let rls_installer = dist.join(format!("{}-{}.tar.gz",
646+
pkgname(build, "rls"),
647+
target));
647648
let analysis_installer = dist.join(format!("{}-{}.tar.gz",
648649
pkgname(build, "rust-analysis"),
649650
target));
@@ -720,28 +721,20 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
720721
let _ = fs::remove_dir_all(&pkg);
721722
t!(fs::create_dir_all(pkg.join("rustc")));
722723
t!(fs::create_dir_all(pkg.join("cargo")));
723-
t!(fs::create_dir_all(pkg.join("rls")));
724-
t!(fs::create_dir_all(pkg.join("rust-analysis")));
725724
t!(fs::create_dir_all(pkg.join("rust-docs")));
726725
t!(fs::create_dir_all(pkg.join("rust-std")));
727726

728727
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)),
729728
&pkg.join("rustc"));
730729
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)),
731730
&pkg.join("cargo"));
732-
cp_r(&work.join(pkgname(build, "rls")),
733-
&pkg.join("rls"));
734-
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target)),
735-
&pkg.join("rust-analysis"));
736731
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)),
737732
&pkg.join("rust-docs"));
738733
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target)),
739734
&pkg.join("rust-std"));
740735

741736
install(&etc.join("pkg/postinstall"), &pkg.join("rustc"), 0o755);
742737
install(&etc.join("pkg/postinstall"), &pkg.join("cargo"), 0o755);
743-
install(&etc.join("pkg/postinstall"), &pkg.join("rls"), 0o755);
744-
install(&etc.join("pkg/postinstall"), &pkg.join("rust-analysis"), 0o755);
745738
install(&etc.join("pkg/postinstall"), &pkg.join("rust-docs"), 0o755);
746739
install(&etc.join("pkg/postinstall"), &pkg.join("rust-std"), 0o755);
747740

@@ -755,8 +748,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
755748
};
756749
pkgbuild("rustc");
757750
pkgbuild("cargo");
758-
pkgbuild("rls");
759-
pkgbuild("rust-analysis");
760751
pkgbuild("rust-docs");
761752
pkgbuild("rust-std");
762753

@@ -782,8 +773,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
782773
let _ = fs::remove_dir_all(&exe);
783774
t!(fs::create_dir_all(exe.join("rustc")));
784775
t!(fs::create_dir_all(exe.join("cargo")));
785-
t!(fs::create_dir_all(exe.join("rls")));
786-
t!(fs::create_dir_all(exe.join("rust-analysis")));
787776
t!(fs::create_dir_all(exe.join("rust-docs")));
788777
t!(fs::create_dir_all(exe.join("rust-std")));
789778
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
@@ -792,12 +781,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
792781
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target))
793782
.join("cargo"),
794783
&exe.join("cargo"));
795-
cp_r(&work.join(pkgname(build, "rls"))
796-
.join("rls"),
797-
&exe.join("rls"));
798-
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target))
799-
.join("rust-analysis"),
800-
&exe.join("rust-analysis"));
801784
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target))
802785
.join("rust-docs"),
803786
&exe.join("rust-docs"));
@@ -807,8 +790,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
807790

808791
t!(fs::remove_file(exe.join("rustc/manifest.in")));
809792
t!(fs::remove_file(exe.join("cargo/manifest.in")));
810-
t!(fs::remove_file(exe.join("rls/manifest.in")));
811-
t!(fs::remove_file(exe.join("rust-analysis/manifest.in")));
812793
t!(fs::remove_file(exe.join("rust-docs/manifest.in")));
813794
t!(fs::remove_file(exe.join("rust-std/manifest.in")));
814795

@@ -865,26 +846,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
865846
.arg("-var").arg("var.DocsDir")
866847
.arg("-out").arg(exe.join("DocsGroup.wxs"))
867848
.arg("-t").arg(etc.join("msi/squash-components.xsl")));
868-
build.run(Command::new(&heat)
869-
.current_dir(&exe)
870-
.arg("dir")
871-
.arg("rls")
872-
.args(&heat_flags)
873-
.arg("-cg").arg("RlsGroup")
874-
.arg("-dr").arg("Rls")
875-
.arg("-var").arg("var.RlsDir")
876-
.arg("-out").arg(exe.join("RlsGroup.wxs"))
877-
.arg("-t").arg(etc.join("msi/squash-components.xsl")));
878-
build.run(Command::new(&heat)
879-
.current_dir(&exe)
880-
.arg("dir")
881-
.arg("rust-analysis")
882-
.args(&heat_flags)
883-
.arg("-cg").arg("AnalysisGroup")
884-
.arg("-dr").arg("Analysis")
885-
.arg("-var").arg("var.AnalysisDir")
886-
.arg("-out").arg(exe.join("AnalysisGroup.wxs"))
887-
.arg("-t").arg(etc.join("msi/squash-components.xsl")));
888849
build.run(Command::new(&heat)
889850
.current_dir(&exe)
890851
.arg("dir")
@@ -925,8 +886,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
925886
.arg("-nologo")
926887
.arg("-dRustcDir=rustc")
927888
.arg("-dDocsDir=rust-docs")
928-
.arg("-dRlsDir=rls")
929-
.arg("-dAnalysisDir=rust-analysis")
930889
.arg("-dCargoDir=cargo")
931890
.arg("-dStdDir=rust-std")
932891
.arg("-arch").arg(&arch)
@@ -944,8 +903,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
944903
candle(&etc.join("msi/rustwelcomedlg.wxs"));
945904
candle("RustcGroup.wxs".as_ref());
946905
candle("DocsGroup.wxs".as_ref());
947-
candle("RlsGroup.wxs".as_ref());
948-
candle("AnalysisGroup.wxs".as_ref());
949906
candle("CargoGroup.wxs".as_ref());
950907
candle("StdGroup.wxs".as_ref());
951908

@@ -968,8 +925,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
968925
.arg("rustwelcomedlg.wixobj")
969926
.arg("RustcGroup.wixobj")
970927
.arg("DocsGroup.wixobj")
971-
.arg("RlsGroup.wixobj")
972-
.arg("AnalysisGroup.wixobj")
973928
.arg("CargoGroup.wixobj")
974929
.arg("StdGroup.wixobj")
975930
.current_dir(&exe);
@@ -1037,7 +992,7 @@ pub fn hash_and_sign(build: &Build) {
1037992
cmd.arg(distdir(build));
1038993
cmd.arg(today.trim());
1039994
cmd.arg(build.rust_package_vers());
1040-
cmd.arg(build.package_vers(&build.cargo_release_num()));
995+
cmd.arg(build.package_vers(&build.release_num("cargo")));
1041996
cmd.arg(addr);
1042997

1043998
t!(fs::create_dir_all(distdir(build)));

src/bootstrap/lib.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ impl Build {
10171017

10181018
/// Returns the value of `package_vers` above for Cargo
10191019
fn cargo_package_vers(&self) -> String {
1020-
self.package_vers(&self.cargo_release_num())
1020+
self.package_vers(&self.release_num("cargo"))
10211021
}
10221022

10231023
/// Returns the `version` string associated with this compiler for Rust
@@ -1029,10 +1029,11 @@ impl Build {
10291029
self.rust_info.version(self, channel::CFG_RELEASE_NUM)
10301030
}
10311031

1032-
/// Returns the `a.b.c` version that Cargo is at.
1033-
fn cargo_release_num(&self) -> String {
1032+
/// Returns the `a.b.c` version that the given package is at.
1033+
fn release_num(&self, package: &str) -> String {
10341034
let mut toml = String::new();
1035-
t!(t!(File::open(self.src.join("cargo/Cargo.toml"))).read_to_string(&mut toml));
1035+
let toml_file_name = self.src.join(&format!("{}/Cargo.toml", package));
1036+
t!(t!(File::open(toml_file_name)).read_to_string(&mut toml));
10361037
for line in toml.lines() {
10371038
let prefix = "version = \"";
10381039
let suffix = "\"";
@@ -1041,22 +1042,7 @@ impl Build {
10411042
}
10421043
}
10431044

1044-
panic!("failed to find version in cargo's Cargo.toml")
1045-
}
1046-
1047-
/// Returns the `a.b.c` version that the RLS is at.
1048-
fn rls_release_num(&self) -> String {
1049-
let mut toml = String::new();
1050-
t!(t!(File::open(self.src.join("rls/Cargo.toml"))).read_to_string(&mut toml));
1051-
for line in toml.lines() {
1052-
let prefix = "version = \"";
1053-
let suffix = "\"";
1054-
if line.starts_with(prefix) && line.ends_with(suffix) {
1055-
return line[prefix.len()..line.len() - suffix.len()].to_string()
1056-
}
1057-
}
1058-
1059-
panic!("failed to find version in the RLS's Cargo.toml")
1045+
panic!("failed to find version in {}'s Cargo.toml", package)
10601046
}
10611047

10621048
/// Returns whether unstable features should be enabled for the compiler

src/tools/build-manifest/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ impl Builder {
225225
self.package("rust-src", &mut manifest.pkg, &["*"]);
226226

227227
if self.rust_release == "nightly" {
228+
self.package("rls", &mut manifest.pkg, HOSTS);
228229
self.package("rust-analysis", &mut manifest.pkg, TARGETS);
229230
}
230231

@@ -277,6 +278,10 @@ impl Builder {
277278
pkg: "rust-analysis".to_string(),
278279
target: target.to_string(),
279280
});
281+
extensions.push(Component {
282+
pkg: "rls".to_string(),
283+
target: host.to_string(),
284+
});
280285
}
281286
}
282287
extensions.push(Component {

0 commit comments

Comments
 (0)