Skip to content

Commit 8ca46fc

Browse files
committed
bootstrap: convert rustc-docs to use Tarball
1 parent c768ce1 commit 8ca46fc

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

src/bootstrap/dist.rs

+8-34
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub struct RustcDocs {
9595
}
9696

9797
impl Step for RustcDocs {
98-
type Output = PathBuf;
98+
type Output = Option<PathBuf>;
9999
const DEFAULT: bool = true;
100100

101101
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -107,47 +107,21 @@ impl Step for RustcDocs {
107107
}
108108

109109
/// Builds the `rustc-docs` installer component.
110-
fn run(self, builder: &Builder<'_>) -> PathBuf {
110+
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
111111
let host = self.host;
112-
113-
let name = pkgname(builder, "rustc-docs");
114-
115112
if !builder.config.compiler_docs {
116-
return distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple));
113+
return None;
117114
}
118115

119116
builder.default_doc(None);
120-
121-
let image = tmpdir(builder).join(format!("{}-{}-image", name, host.triple));
122-
let _ = fs::remove_dir_all(&image);
123-
124-
let dst = image.join("share/doc/rust/html/rustc");
125-
t!(fs::create_dir_all(&dst));
126-
let src = builder.compiler_doc_out(host);
127-
builder.cp_r(&src, &dst);
128-
129-
let mut cmd = rust_installer(builder);
130-
cmd.arg("generate")
131-
.arg("--product-name=Rustc-Documentation")
132-
.arg("--rel-manifest-dir=rustlib")
133-
.arg("--success-message=Rustc-documentation-is-installed.")
134-
.arg("--image-dir")
135-
.arg(&image)
136-
.arg("--work-dir")
137-
.arg(&tmpdir(builder))
138-
.arg("--output-dir")
139-
.arg(&distdir(builder))
140-
.arg(format!("--package-name={}-{}", name, host.triple))
141-
.arg("--component-name=rustc-docs")
142-
.arg("--legacy-manifest-dirs=rustlib,cargo")
143-
.arg("--bulk-dirs=share/doc/rust/html/rustc");
144-
145117
builder.info(&format!("Dist compiler docs ({})", host));
146118
let _time = timeit(builder);
147-
builder.run(&mut cmd);
148-
builder.remove_dir(&image);
149119

150-
distdir(builder).join(format!("{}-{}.tar.gz", name, host.triple))
120+
let mut tarball = Tarball::new(builder, "rustc-docs", &host.triple);
121+
tarball.set_product_name("Rustc Documentation");
122+
tarball.add_dir(&builder.compiler_doc_out(host), "share/doc/rust/html/rustc");
123+
124+
Some(tarball.generate())
151125
}
152126
}
153127

0 commit comments

Comments
 (0)