Skip to content

Commit

Permalink
assert expected json files in rust-docs-json component
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Aug 5, 2024
1 parent 2ac0969 commit 4fa0cbf
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ impl Step for JsonDocs {

/// Builds the `rust-docs-json` installer component.
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
fn is_tier_1_target(target: &TargetSelection) -> bool {
const T1_TARGETS: &[&str] = &[
"aarch64-unknown-linux-gnu",
"i686-pc-windows-gnu",
"i686-pc-windows-msvc",
"i686-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc",
];

T1_TARGETS.contains(&target.triple.to_string().as_str())
}

let host = self.host;
builder.ensure(crate::core::build_steps::doc::Std::new(
builder.top_stage,
Expand All @@ -110,11 +125,19 @@ impl Step for JsonDocs {
));

let dest = "share/doc/rust/json";
let out = builder.json_doc_out(host);

if is_tier_1_target(&host) {
// On tier 1 targets, make sure these are present in the component.
for f in ["alloc.json", "core.json", "std.json"] {
assert!(out.join(f).exists(), "rust-docs-json is missing `{f}`.");
}
}

let mut tarball = Tarball::new(builder, "rust-docs-json", &host.triple);
tarball.set_product_name("Rust Documentation In JSON Format");
tarball.is_preview(true);
tarball.add_bulk_dir(builder.json_doc_out(host), dest);
tarball.add_bulk_dir(out, dest);
Some(tarball.generate())
}
}
Expand Down

0 comments on commit 4fa0cbf

Please sign in to comment.