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