const DEFAULT: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- run.path("src/libstd")
+ run.path("library/std")
}
fn make_run(run: RunConfig<'_>) {
}
}
-fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str], dst_dir: &Path) {
+/// Use the `builder` to make a filtered copy of `base`/X for X in (`src_dirs` - `exclude_dirs`) to
+/// `dst_dir`.
+fn copy_src_dirs(
+ builder: &Builder<'_>,
+ base: &Path,
+ src_dirs: &[&str],
+ exclude_dirs: &[&str],
+ dst_dir: &Path,
+) {
fn filter_fn(exclude_dirs: &[&str], dir: &str, path: &Path) -> bool {
let spath = match path.to_str() {
Some(path) => path,
for item in src_dirs {
let dst = &dst_dir.join(item);
t!(fs::create_dir_all(dst));
- builder
- .cp_filtered(&builder.src.join(item), dst, &|path| filter_fn(exclude_dirs, item, path));
+ builder.cp_filtered(&base.join(item), dst, &|path| filter_fn(exclude_dirs, item, path));
}
}
let image = tmpdir(builder).join(format!("{}-image", name));
let _ = fs::remove_dir_all(&image);
- let dst = image.join("lib/rustlib/src");
- let dst_src = dst.join("rust");
+ // A lot of tools expect the rust-src component to be entirely in this directory, so if you
+ // change that (e.g. by adding another directory `lib/rustlib/src/foo` or
+ // `lib/rustlib/src/rust/foo`), you will need to go around hunting for implicit assumptions
+ // and fix them...
+ //
+ // NOTE: if you update the paths here, you also should update the "virtual" path
+ // translation code in `imported_source_files` in `src/librustc_metadata/rmeta/decoder.rs`
+ let dst_src = image.join("lib/rustlib/src/rust");
t!(fs::create_dir_all(&dst_src));
let src_files = ["Cargo.lock"];
// This is the reduced set of paths which will become the rust-src component
- // (essentially libstd and all of its path dependencies)
- let std_src_dirs = [
- "src/build_helper",
- "src/liballoc",
- "src/libcore",
- "src/libpanic_abort",
- "src/libpanic_unwind",
- "src/libstd",
- "src/libunwind",
- "src/libtest",
- "src/libterm",
- "src/libprofiler_builtins",
- "src/stdarch",
- "src/libproc_macro",
- "src/tools/rustc-std-workspace-core",
- "src/tools/rustc-std-workspace-alloc",
- "src/tools/rustc-std-workspace-std",
- ];
-
- copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src);
+ // (essentially libstd and all of its path dependencies).
+ copy_src_dirs(
+ builder,
+ &builder.src,
+ &["library"],
+ &[
+ // not needed and contains symlinks which rustup currently
+ // chokes on when unpacking.
+ "library/backtrace/crates",
+ ],
+ &dst_src,
+ );
for file in src_files.iter() {
builder.copy(&builder.src.join(file), &dst_src.join(file));
}
"Cargo.toml",
"Cargo.lock",
];
- let src_dirs = ["src"];
+ let src_dirs = ["src", "library"];
- copy_src_dirs(builder, &src_dirs[..], &[], &plain_dst_src);
+ copy_src_dirs(builder, &builder.src, &src_dirs, &[], &plain_dst_src);
// Copy the files normally
for item in &src_files {
}
impl Step for RustAnalyzer {
- type Output = PathBuf;
+ type Output = Option<PathBuf>;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
});
}
- fn run(self, builder: &Builder<'_>) -> PathBuf {
+ fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
let compiler = self.compiler;
let target = self.target;
assert!(builder.config.extended);
+ if target.contains("riscv64") {
+ // riscv64 currently has an LLVM bug that makes rust-analyzer unable
+ // to build. See #74813 for details.
+ return None;
+ }
+
let src = builder.src.join("src/tools/rust-analyzer");
let release_num = builder.release_num("rust-analyzer/crates/rust-analyzer");
let name = pkgname(builder, "rust-analyzer");
builder.info(&format!("Dist rust-analyzer stage{} ({})", compiler.stage, target));
let _time = timeit(builder);
builder.run(&mut cmd);
- distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple))
+ Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)))
}
}
tarballs.push(rustc_installer);
tarballs.push(cargo_installer);
tarballs.extend(rls_installer.clone());
- tarballs.push(rust_analyzer_installer.clone());
+ tarballs.extend(rust_analyzer_installer.clone());
tarballs.push(clippy_installer);
tarballs.extend(miri_installer.clone());
tarballs.extend(rustfmt_installer.clone());
if rls_installer.is_none() {
contents = filter(&contents, "rls");
}
- contents = filter(&contents, "rust-analyzer");
+ if rust_analyzer_installer.is_none() {
+ contents = filter(&contents, "rust-analyzer");
+ }
if miri_installer.is_none() {
contents = filter(&contents, "miri");
}
if rls_installer.is_some() {
prepare("rls");
}
- prepare("rust-analyzer");
+ if rust_analyzer_installer.is_some() {
+ prepare("rust-analyzer");
+ }
if miri_installer.is_some() {
prepare("miri");
}
if rls_installer.is_some() {
prepare("rls");
}
- prepare("rust-analyzer");
+ if rust_analyzer_installer.is_some() {
+ prepare("rust-analyzer");
+ }
if miri_installer.is_some() {
prepare("miri");
}
.arg(etc.join("msi/remove-duplicates.xsl")),
);
}
- builder.run(
- Command::new(&heat)
- .current_dir(&exe)
- .arg("dir")
- .arg("rust-analyzer")
- .args(&heat_flags)
- .arg("-cg")
- .arg("RustAnalyzerGroup")
- .arg("-dr")
- .arg("RustAnalyzer")
- .arg("-var")
- .arg("var.RustAnalyzerDir")
- .arg("-out")
- .arg(exe.join("RustAnalyzerGroup.wxs"))
- .arg("-t")
- .arg(etc.join("msi/remove-duplicates.xsl")),
- );
+ if rust_analyzer_installer.is_some() {
+ builder.run(
+ Command::new(&heat)
+ .current_dir(&exe)
+ .arg("dir")
+ .arg("rust-analyzer")
+ .args(&heat_flags)
+ .arg("-cg")
+ .arg("RustAnalyzerGroup")
+ .arg("-dr")
+ .arg("RustAnalyzer")
+ .arg("-var")
+ .arg("var.RustAnalyzerDir")
+ .arg("-out")
+ .arg(exe.join("RustAnalyzerGroup.wxs"))
+ .arg("-t")
+ .arg(etc.join("msi/remove-duplicates.xsl")),
+ );
+ }
builder.run(
Command::new(&heat)
.current_dir(&exe)
if rls_installer.is_some() {
cmd.arg("-dRlsDir=rls");
}
- cmd.arg("-dRustAnalyzerDir=rust-analyzer");
+ if rust_analyzer_installer.is_some() {
+ cmd.arg("-dRustAnalyzerDir=rust-analyzer");
+ }
if miri_installer.is_some() {
cmd.arg("-dMiriDir=miri");
}
if rls_installer.is_some() {
candle("RlsGroup.wxs".as_ref());
}
- candle("RustAnalyzerGroup.wxs".as_ref());
+ if rust_analyzer_installer.is_some() {
+ candle("RustAnalyzerGroup.wxs".as_ref());
+ }
if miri_installer.is_some() {
candle("MiriGroup.wxs".as_ref());
}
if rls_installer.is_some() {
cmd.arg("RlsGroup.wixobj");
}
- cmd.arg("RustAnalyzerGroup.wixobj");
+ if rust_analyzer_installer.is_some() {
+ cmd.arg("RustAnalyzerGroup.wixobj");
+ }
if miri_installer.is_some() {
cmd.arg("MiriGroup.wixobj");
}