Skip to content

Commit 88b99de

Browse files
committed
Auto merge of rust-lang#84289 - andersk:bootstrap-bulk-dir, r=Mark-Simulacrum
bootstrap: Restore missing --bulk-dirs for rust-docs, rustc-docs The `--bulk-dirs` argument was removed for rust-docs in commit c768ce1 and rustc-docs in commit 8ca46fc (rust-lang#79788), presumably by mistake; that slowed down installation of rust-docs from under a second to some twenty *minutes*. Restoring `--bulk-dirs` reverses this slowdown. Fixes rust-lang#80684. Cc `@pietroalbini.`
2 parents 71965ab + 6dfd700 commit 88b99de

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/bootstrap/dist.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl Step for Docs {
7474

7575
let mut tarball = Tarball::new(builder, "rust-docs", &host.triple);
7676
tarball.set_product_name("Rust Documentation");
77-
tarball.add_dir(&builder.doc_out(host), dest);
77+
tarball.add_bulk_dir(&builder.doc_out(host), dest);
7878
tarball.add_file(&builder.src.join("src/doc/robots.txt"), dest, 0o644);
7979
Some(tarball.generate())
8080
}
@@ -107,7 +107,7 @@ impl Step for RustcDocs {
107107

108108
let mut tarball = Tarball::new(builder, "rustc-docs", &host.triple);
109109
tarball.set_product_name("Rustc Documentation");
110-
tarball.add_dir(&builder.compiler_doc_out(host), "share/doc/rust/html/rustc");
110+
tarball.add_bulk_dir(&builder.compiler_doc_out(host), "share/doc/rust/html/rustc");
111111
Some(tarball.generate())
112112
}
113113
}

src/bootstrap/tarball.rs

+17
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pub(crate) struct Tarball<'a> {
9999
temp_dir: PathBuf,
100100
image_dir: PathBuf,
101101
overlay_dir: PathBuf,
102+
bulk_dirs: Vec<PathBuf>,
102103

103104
include_target_in_component_name: bool,
104105
is_preview: bool,
@@ -137,6 +138,7 @@ impl<'a> Tarball<'a> {
137138
temp_dir,
138139
image_dir,
139140
overlay_dir,
141+
bulk_dirs: Vec::new(),
140142

141143
include_target_in_component_name: false,
142144
is_preview: false,
@@ -201,6 +203,11 @@ impl<'a> Tarball<'a> {
201203
self.builder.cp_r(src.as_ref(), &dest);
202204
}
203205

206+
pub(crate) fn add_bulk_dir(&mut self, src: impl AsRef<Path>, dest: impl AsRef<Path>) {
207+
self.bulk_dirs.push(dest.as_ref().to_path_buf());
208+
self.add_dir(src, dest);
209+
}
210+
204211
pub(crate) fn generate(self) -> GeneratedTarball {
205212
let mut component_name = self.component.clone();
206213
if self.is_preview {
@@ -221,6 +228,16 @@ impl<'a> Tarball<'a> {
221228
.arg("--image-dir")
222229
.arg(&this.image_dir)
223230
.arg(format!("--component-name={}", &component_name));
231+
232+
if let Some((dir, dirs)) = this.bulk_dirs.split_first() {
233+
let mut arg = dir.as_os_str().to_os_string();
234+
for dir in dirs {
235+
arg.push(",");
236+
arg.push(dir);
237+
}
238+
cmd.arg("--bulk-dirs").arg(&arg);
239+
}
240+
224241
this.non_bare_args(cmd);
225242
})
226243
}

0 commit comments

Comments
 (0)