@@ -4,7 +4,9 @@ use std::io::Write;
44use std:: path:: Path ;
55
66use anyhow:: Context ;
7- use build_helper:: metrics:: { JsonNode , JsonRoot , TestOutcome , TestSuite , TestSuiteMetadata } ;
7+ use build_helper:: metrics:: {
8+ BuildStep , JsonNode , JsonRoot , TestOutcome , TestSuite , TestSuiteMetadata , format_build_steps,
9+ } ;
810
911pub fn postprocess_metrics ( metrics_path : & Path , summary_path : & Path ) -> anyhow:: Result < ( ) > {
1012 let metrics = load_metrics ( metrics_path) ?;
@@ -15,7 +17,30 @@ pub fn postprocess_metrics(metrics_path: &Path, summary_path: &Path) -> anyhow::
1517 . open ( summary_path)
1618 . with_context ( || format ! ( "Cannot open summary file at {summary_path:?}" ) ) ?;
1719
18- record_test_suites ( & metrics, & mut file) ?;
20+ if !metrics. invocations . is_empty ( ) {
21+ writeln ! ( file, "# Bootstrap steps" ) ?;
22+ record_bootstrap_step_durations ( & metrics, & mut file) ?;
23+ record_test_suites ( & metrics, & mut file) ?;
24+ }
25+
26+ Ok ( ( ) )
27+ }
28+
29+ fn record_bootstrap_step_durations ( metrics : & JsonRoot , file : & mut File ) -> anyhow:: Result < ( ) > {
30+ for invocation in & metrics. invocations {
31+ let step = BuildStep :: from_invocation ( invocation) ;
32+ let table = format_build_steps ( & step) ;
33+ writeln ! (
34+ file,
35+ r"<details>
36+ <summary>{}</summary>
37+ <pre><code>{table}</code></pre>
38+ </details>
39+ " ,
40+ invocation. cmdline
41+ ) ?;
42+ }
43+ eprintln ! ( "Recorded {} bootstrap invocation(s)" , metrics. invocations. len( ) ) ;
1944
2045 Ok ( ( ) )
2146}
0 commit comments