@@ -102,6 +102,21 @@ impl Step for JsonDocs {
102102
103103 /// Builds the `rust-docs-json` installer component.
104104 fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
105+ fn is_tier_1_target ( target : & TargetSelection ) -> bool {
106+ const T1_TARGETS : & [ & str ] = & [
107+ "aarch64-unknown-linux-gnu" ,
108+ "i686-pc-windows-gnu" ,
109+ "i686-pc-windows-msvc" ,
110+ "i686-unknown-linux-gnu" ,
111+ "x86_64-unknown-linux-gnu" ,
112+ "x86_64-apple-darwin" ,
113+ "x86_64-pc-windows-gnu" ,
114+ "x86_64-pc-windows-msvc" ,
115+ ] ;
116+
117+ T1_TARGETS . contains ( & target. triple . to_string ( ) . as_str ( ) )
118+ }
119+
105120 let host = self . host ;
106121 builder. ensure ( crate :: core:: build_steps:: doc:: Std :: new (
107122 builder. top_stage ,
@@ -110,11 +125,19 @@ impl Step for JsonDocs {
110125 ) ) ;
111126
112127 let dest = "share/doc/rust/json" ;
128+ let out = builder. json_doc_out ( host) ;
129+
130+ if is_tier_1_target ( & host) {
131+ // On tier 1 targets, make sure these are present in the component.
132+ for f in [ "alloc.json" , "core.json" , "std.json" ] {
133+ assert ! ( out. join( f) . exists( ) , "rust-docs-json is missing `{f}`." ) ;
134+ }
135+ }
113136
114137 let mut tarball = Tarball :: new ( builder, "rust-docs-json" , & host. triple ) ;
115138 tarball. set_product_name ( "Rust Documentation In JSON Format" ) ;
116139 tarball. is_preview ( true ) ;
117- tarball. add_bulk_dir ( builder . json_doc_out ( host ) , dest) ;
140+ tarball. add_bulk_dir ( out , dest) ;
118141 Some ( tarball. generate ( ) )
119142 }
120143}
0 commit comments