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