Reviewer changes

This commit is contained in:
Nick Cameron 2017-03-28 08:00:46 +13:00
parent c55325e0f7
commit 223b280f31
4 changed files with 19 additions and 73 deletions

2
rls

@ -1 +1 @@
Subproject commit e24fc84bfc4b3360a3d65d9adeab0f701140094d Subproject commit 88fc39bd654c536b4f8f1cd1fc8245706f0284ec

View File

@ -40,7 +40,7 @@ fn pkgname(build: &Build, component: &str) -> String {
if component == "cargo" { if component == "cargo" {
format!("{}-{}", component, build.cargo_package_vers()) format!("{}-{}", component, build.cargo_package_vers())
} else { } else {
assert!(component.starts_with("rust")); assert!(component.starts_with("rust") || component == "rls");
format!("{}-{}", component, build.rust_package_vers()) format!("{}-{}", component, build.rust_package_vers())
} }
} }
@ -540,7 +540,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
let src = build.src.join("cargo"); let src = build.src.join("cargo");
let etc = src.join("src/etc"); let etc = src.join("src/etc");
let release_num = build.cargo_release_num(); let release_num = build.release_num("cargo");
let name = pkgname(build, "cargo"); let name = pkgname(build, "cargo");
let version = build.cargo_info.version(build, &release_num); let version = build.cargo_info.version(build, &release_num);
@ -599,7 +599,7 @@ pub fn rls(build: &Build, stage: u32, target: &str) {
let compiler = Compiler::new(stage, &build.config.build); let compiler = Compiler::new(stage, &build.config.build);
let src = build.src.join("rls"); let src = build.src.join("rls");
let release_num = build.rls_release_num(); let release_num = build.release_num("rls");
let name = format!("rls-{}", build.package_vers(&release_num)); let name = format!("rls-{}", build.package_vers(&release_num));
let tmp = tmpdir(build); let tmp = tmpdir(build);
@ -642,8 +642,9 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
let cargo_installer = dist.join(format!("{}-{}.tar.gz", let cargo_installer = dist.join(format!("{}-{}.tar.gz",
pkgname(build, "cargo"), pkgname(build, "cargo"),
target)); target));
let rls_installer = dist.join(format!("{}.tar.gz", let rls_installer = dist.join(format!("{}-{}.tar.gz",
pkgname(build, "rls"))); pkgname(build, "rls"),
target));
let analysis_installer = dist.join(format!("{}-{}.tar.gz", let analysis_installer = dist.join(format!("{}-{}.tar.gz",
pkgname(build, "rust-analysis"), pkgname(build, "rust-analysis"),
target)); target));
@ -720,8 +721,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
let _ = fs::remove_dir_all(&pkg); let _ = fs::remove_dir_all(&pkg);
t!(fs::create_dir_all(pkg.join("rustc"))); t!(fs::create_dir_all(pkg.join("rustc")));
t!(fs::create_dir_all(pkg.join("cargo"))); t!(fs::create_dir_all(pkg.join("cargo")));
t!(fs::create_dir_all(pkg.join("rls")));
t!(fs::create_dir_all(pkg.join("rust-analysis")));
t!(fs::create_dir_all(pkg.join("rust-docs"))); t!(fs::create_dir_all(pkg.join("rust-docs")));
t!(fs::create_dir_all(pkg.join("rust-std"))); t!(fs::create_dir_all(pkg.join("rust-std")));
@ -729,10 +728,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
&pkg.join("rustc")); &pkg.join("rustc"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)), cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)),
&pkg.join("cargo")); &pkg.join("cargo"));
cp_r(&work.join(pkgname(build, "rls")),
&pkg.join("rls"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target)),
&pkg.join("rust-analysis"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)), cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)),
&pkg.join("rust-docs")); &pkg.join("rust-docs"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target)), cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target)),
@ -740,8 +735,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
install(&etc.join("pkg/postinstall"), &pkg.join("rustc"), 0o755); install(&etc.join("pkg/postinstall"), &pkg.join("rustc"), 0o755);
install(&etc.join("pkg/postinstall"), &pkg.join("cargo"), 0o755); install(&etc.join("pkg/postinstall"), &pkg.join("cargo"), 0o755);
install(&etc.join("pkg/postinstall"), &pkg.join("rls"), 0o755);
install(&etc.join("pkg/postinstall"), &pkg.join("rust-analysis"), 0o755);
install(&etc.join("pkg/postinstall"), &pkg.join("rust-docs"), 0o755); install(&etc.join("pkg/postinstall"), &pkg.join("rust-docs"), 0o755);
install(&etc.join("pkg/postinstall"), &pkg.join("rust-std"), 0o755); install(&etc.join("pkg/postinstall"), &pkg.join("rust-std"), 0o755);
@ -755,8 +748,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
}; };
pkgbuild("rustc"); pkgbuild("rustc");
pkgbuild("cargo"); pkgbuild("cargo");
pkgbuild("rls");
pkgbuild("rust-analysis");
pkgbuild("rust-docs"); pkgbuild("rust-docs");
pkgbuild("rust-std"); pkgbuild("rust-std");
@ -782,8 +773,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
let _ = fs::remove_dir_all(&exe); let _ = fs::remove_dir_all(&exe);
t!(fs::create_dir_all(exe.join("rustc"))); t!(fs::create_dir_all(exe.join("rustc")));
t!(fs::create_dir_all(exe.join("cargo"))); t!(fs::create_dir_all(exe.join("cargo")));
t!(fs::create_dir_all(exe.join("rls")));
t!(fs::create_dir_all(exe.join("rust-analysis")));
t!(fs::create_dir_all(exe.join("rust-docs"))); t!(fs::create_dir_all(exe.join("rust-docs")));
t!(fs::create_dir_all(exe.join("rust-std"))); t!(fs::create_dir_all(exe.join("rust-std")));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)) cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
@ -792,12 +781,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)) cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target))
.join("cargo"), .join("cargo"),
&exe.join("cargo")); &exe.join("cargo"));
cp_r(&work.join(pkgname(build, "rls"))
.join("rls"),
&exe.join("rls"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target))
.join("rust-analysis"),
&exe.join("rust-analysis"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)) cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target))
.join("rust-docs"), .join("rust-docs"),
&exe.join("rust-docs")); &exe.join("rust-docs"));
@ -807,8 +790,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
t!(fs::remove_file(exe.join("rustc/manifest.in"))); t!(fs::remove_file(exe.join("rustc/manifest.in")));
t!(fs::remove_file(exe.join("cargo/manifest.in"))); t!(fs::remove_file(exe.join("cargo/manifest.in")));
t!(fs::remove_file(exe.join("rls/manifest.in")));
t!(fs::remove_file(exe.join("rust-analysis/manifest.in")));
t!(fs::remove_file(exe.join("rust-docs/manifest.in"))); t!(fs::remove_file(exe.join("rust-docs/manifest.in")));
t!(fs::remove_file(exe.join("rust-std/manifest.in"))); t!(fs::remove_file(exe.join("rust-std/manifest.in")));
@ -865,26 +846,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
.arg("-var").arg("var.DocsDir") .arg("-var").arg("var.DocsDir")
.arg("-out").arg(exe.join("DocsGroup.wxs")) .arg("-out").arg(exe.join("DocsGroup.wxs"))
.arg("-t").arg(etc.join("msi/squash-components.xsl"))); .arg("-t").arg(etc.join("msi/squash-components.xsl")));
build.run(Command::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rls")
.args(&heat_flags)
.arg("-cg").arg("RlsGroup")
.arg("-dr").arg("Rls")
.arg("-var").arg("var.RlsDir")
.arg("-out").arg(exe.join("RlsGroup.wxs"))
.arg("-t").arg(etc.join("msi/squash-components.xsl")));
build.run(Command::new(&heat)
.current_dir(&exe)
.arg("dir")
.arg("rust-analysis")
.args(&heat_flags)
.arg("-cg").arg("AnalysisGroup")
.arg("-dr").arg("Analysis")
.arg("-var").arg("var.AnalysisDir")
.arg("-out").arg(exe.join("AnalysisGroup.wxs"))
.arg("-t").arg(etc.join("msi/squash-components.xsl")));
build.run(Command::new(&heat) build.run(Command::new(&heat)
.current_dir(&exe) .current_dir(&exe)
.arg("dir") .arg("dir")
@ -925,8 +886,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
.arg("-nologo") .arg("-nologo")
.arg("-dRustcDir=rustc") .arg("-dRustcDir=rustc")
.arg("-dDocsDir=rust-docs") .arg("-dDocsDir=rust-docs")
.arg("-dRlsDir=rls")
.arg("-dAnalysisDir=rust-analysis")
.arg("-dCargoDir=cargo") .arg("-dCargoDir=cargo")
.arg("-dStdDir=rust-std") .arg("-dStdDir=rust-std")
.arg("-arch").arg(&arch) .arg("-arch").arg(&arch)
@ -944,8 +903,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
candle(&etc.join("msi/rustwelcomedlg.wxs")); candle(&etc.join("msi/rustwelcomedlg.wxs"));
candle("RustcGroup.wxs".as_ref()); candle("RustcGroup.wxs".as_ref());
candle("DocsGroup.wxs".as_ref()); candle("DocsGroup.wxs".as_ref());
candle("RlsGroup.wxs".as_ref());
candle("AnalysisGroup.wxs".as_ref());
candle("CargoGroup.wxs".as_ref()); candle("CargoGroup.wxs".as_ref());
candle("StdGroup.wxs".as_ref()); candle("StdGroup.wxs".as_ref());
@ -968,8 +925,6 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
.arg("rustwelcomedlg.wixobj") .arg("rustwelcomedlg.wixobj")
.arg("RustcGroup.wixobj") .arg("RustcGroup.wixobj")
.arg("DocsGroup.wixobj") .arg("DocsGroup.wixobj")
.arg("RlsGroup.wixobj")
.arg("AnalysisGroup.wixobj")
.arg("CargoGroup.wixobj") .arg("CargoGroup.wixobj")
.arg("StdGroup.wixobj") .arg("StdGroup.wixobj")
.current_dir(&exe); .current_dir(&exe);
@ -1037,7 +992,7 @@ pub fn hash_and_sign(build: &Build) {
cmd.arg(distdir(build)); cmd.arg(distdir(build));
cmd.arg(today.trim()); cmd.arg(today.trim());
cmd.arg(build.rust_package_vers()); cmd.arg(build.rust_package_vers());
cmd.arg(build.package_vers(&build.cargo_release_num())); cmd.arg(build.package_vers(&build.release_num("cargo")));
cmd.arg(addr); cmd.arg(addr);
t!(fs::create_dir_all(distdir(build))); t!(fs::create_dir_all(distdir(build)));

View File

@ -1017,7 +1017,7 @@ impl Build {
/// Returns the value of `package_vers` above for Cargo /// Returns the value of `package_vers` above for Cargo
fn cargo_package_vers(&self) -> String { fn cargo_package_vers(&self) -> String {
self.package_vers(&self.cargo_release_num()) self.package_vers(&self.release_num("cargo"))
} }
/// Returns the `version` string associated with this compiler for Rust /// Returns the `version` string associated with this compiler for Rust
@ -1029,10 +1029,11 @@ impl Build {
self.rust_info.version(self, channel::CFG_RELEASE_NUM) self.rust_info.version(self, channel::CFG_RELEASE_NUM)
} }
/// Returns the `a.b.c` version that Cargo is at. /// Returns the `a.b.c` version that the given package is at.
fn cargo_release_num(&self) -> String { fn release_num(&self, package: &str) -> String {
let mut toml = String::new(); let mut toml = String::new();
t!(t!(File::open(self.src.join("cargo/Cargo.toml"))).read_to_string(&mut toml)); let toml_file_name = self.src.join(&format!("{}/Cargo.toml", package));
t!(t!(File::open(toml_file_name)).read_to_string(&mut toml));
for line in toml.lines() { for line in toml.lines() {
let prefix = "version = \""; let prefix = "version = \"";
let suffix = "\""; let suffix = "\"";
@ -1041,22 +1042,7 @@ impl Build {
} }
} }
panic!("failed to find version in cargo's Cargo.toml") panic!("failed to find version in {}'s Cargo.toml", package)
}
/// Returns the `a.b.c` version that the RLS is at.
fn rls_release_num(&self) -> String {
let mut toml = String::new();
t!(t!(File::open(self.src.join("rls/Cargo.toml"))).read_to_string(&mut toml));
for line in toml.lines() {
let prefix = "version = \"";
let suffix = "\"";
if line.starts_with(prefix) && line.ends_with(suffix) {
return line[prefix.len()..line.len() - suffix.len()].to_string()
}
}
panic!("failed to find version in the RLS's Cargo.toml")
} }
/// Returns whether unstable features should be enabled for the compiler /// Returns whether unstable features should be enabled for the compiler

View File

@ -225,6 +225,7 @@ impl Builder {
self.package("rust-src", &mut manifest.pkg, &["*"]); self.package("rust-src", &mut manifest.pkg, &["*"]);
if self.rust_release == "nightly" { if self.rust_release == "nightly" {
self.package("rls", &mut manifest.pkg, HOSTS);
self.package("rust-analysis", &mut manifest.pkg, TARGETS); self.package("rust-analysis", &mut manifest.pkg, TARGETS);
} }
@ -277,6 +278,10 @@ impl Builder {
pkg: "rust-analysis".to_string(), pkg: "rust-analysis".to_string(),
target: target.to_string(), target: target.to_string(),
}); });
extensions.push(Component {
pkg: "rls".to_string(),
target: host.to_string(),
});
} }
} }
extensions.push(Component { extensions.push(Component {