@@ -2636,3 +2636,62 @@ impl Step for Gcc {
26362636 tarball. generate ( )
26372637 }
26382638}
2639+
2640+ #[ derive( Clone , Debug , Eq , PartialEq , Hash ) ]
2641+ pub struct RelnotesApiList {
2642+ pub host : TargetSelection ,
2643+ }
2644+
2645+ impl Step for RelnotesApiList {
2646+ type Output = ( ) ;
2647+ const DEFAULT : bool = true ;
2648+
2649+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
2650+ let default = run. builder . config . docs ;
2651+ run. alias ( "relnotes-api-list" ) . default_condition ( default)
2652+ }
2653+
2654+ fn make_run ( run : RunConfig < ' _ > ) {
2655+ run. builder . ensure ( RelnotesApiList { host : run. target } ) ;
2656+ }
2657+
2658+ fn run ( self , builder : & Builder < ' _ > ) -> Self :: Output {
2659+ let host = self . host ;
2660+ let dest = builder. out . join ( "dist" ) . join ( format ! ( "relnotes-api-list-{host}.json" ) ) ;
2661+ builder. create_dir ( dest. parent ( ) . unwrap ( ) ) ;
2662+
2663+ // The HTML documentation for the standard library is needed to check all links generated by
2664+ // the tool are not broken.
2665+ builder. ensure ( crate :: core:: build_steps:: doc:: Std :: new (
2666+ builder. top_stage ,
2667+ host,
2668+ DocumentationFormat :: Html ,
2669+ ) ) ;
2670+
2671+ if std:: env:: var_os ( "EMILY_SKIP_DOC" ) . is_none ( ) {
2672+ // TODO: remove the condition
2673+ builder. ensure (
2674+ crate :: core:: build_steps:: doc:: Std :: new (
2675+ builder. top_stage ,
2676+ host,
2677+ DocumentationFormat :: Json ,
2678+ )
2679+ // Crates containing symbols exported by any std crate:
2680+ . add_extra_crate ( "rustc-literal-escaper" )
2681+ . add_extra_crate ( "std_detect" ) ,
2682+ ) ;
2683+ }
2684+
2685+ let linkchecker = builder. tool_exe ( Tool :: Linkchecker ) ;
2686+
2687+ builder. info ( "Generating the API list for the release notes" ) ;
2688+ builder
2689+ . tool_cmd ( Tool :: RelnotesApiList )
2690+ . arg ( builder. json_doc_out ( host) )
2691+ . arg ( & dest)
2692+ . env ( "LINKCHECKER_PATH" , linkchecker)
2693+ . env ( "STD_HTML_DOCS" , builder. doc_out ( self . host ) )
2694+ . run ( builder) ;
2695+ builder. info ( & format ! ( "API list for the release notes available at {}" , dest. display( ) ) ) ;
2696+ }
2697+ }
0 commit comments