refactor gating of dist docs
This commit is contained in:
parent
8f3844ff07
commit
0c8baa729d
2 changed files with 11 additions and 18 deletions
|
|
@ -51,11 +51,12 @@ pub struct Docs {
|
|||
}
|
||||
|
||||
impl Step for Docs {
|
||||
type Output = Option<GeneratedTarball>;
|
||||
type Output = GeneratedTarball;
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.path("src/doc")
|
||||
let default = run.builder.config.docs;
|
||||
run.path("src/doc").default_condition(default)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
|
|
@ -63,11 +64,8 @@ impl Step for Docs {
|
|||
}
|
||||
|
||||
/// Builds the `rust-docs` installer component.
|
||||
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
||||
fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
|
||||
let host = self.host;
|
||||
if !builder.config.docs {
|
||||
return None;
|
||||
}
|
||||
builder.default_doc(&[]);
|
||||
|
||||
let dest = "share/doc/rust/html";
|
||||
|
|
@ -76,7 +74,7 @@ impl Step for Docs {
|
|||
tarball.set_product_name("Rust Documentation");
|
||||
tarball.add_bulk_dir(&builder.doc_out(host), dest);
|
||||
tarball.add_file(&builder.src.join("src/doc/robots.txt"), dest, 0o644);
|
||||
Some(tarball.generate())
|
||||
tarball.generate()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1354,6 +1352,10 @@ impl Step for Extended {
|
|||
tarballs.push(builder.ensure(Rustc { compiler: builder.compiler(stage, target) }));
|
||||
tarballs.push(builder.ensure(Std { compiler, target }).expect("missing std"));
|
||||
|
||||
if builder.config.docs {
|
||||
tarballs.push(builder.ensure(Docs { host: target }));
|
||||
}
|
||||
|
||||
let cargo_installer = builder.ensure(Cargo { compiler, target });
|
||||
let rustfmt_installer = builder.ensure(Rustfmt { compiler, target });
|
||||
let rust_demangler_installer = builder.ensure(RustDemangler { compiler, target });
|
||||
|
|
@ -1365,8 +1367,6 @@ impl Step for Extended {
|
|||
let mingw_installer = builder.ensure(Mingw { host: target });
|
||||
let analysis_installer = builder.ensure(Analysis { compiler, target });
|
||||
|
||||
let docs_installer = builder.ensure(Docs { host: target });
|
||||
|
||||
let etc = builder.src.join("src/etc/installer");
|
||||
|
||||
// Avoid producing tarballs during a dry run.
|
||||
|
|
@ -1385,9 +1385,6 @@ impl Step for Extended {
|
|||
if let Some(analysis_installer) = analysis_installer {
|
||||
tarballs.push(analysis_installer);
|
||||
}
|
||||
if let Some(docs_installer) = docs_installer {
|
||||
tarballs.push(docs_installer);
|
||||
}
|
||||
if target.contains("pc-windows-gnu") {
|
||||
tarballs.push(mingw_installer.unwrap());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,12 +139,8 @@ macro_rules! install {
|
|||
|
||||
install!((self, builder, _config),
|
||||
Docs, "src/doc", _config.docs, only_hosts: false, {
|
||||
if let Some(tarball) = builder.ensure(dist::Docs { host: self.target }) {
|
||||
install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
|
||||
} else {
|
||||
panic!("docs are not available to install, \
|
||||
check that `build.docs` is true in `config.toml`");
|
||||
}
|
||||
let tarball = builder.ensure(dist::Docs { host: self.target });
|
||||
install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
|
||||
};
|
||||
Std, "library/std", true, only_hosts: false, {
|
||||
for target in &builder.targets {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue