@@ -4,7 +4,9 @@ use std::io::Write;
4
4
use std:: path:: Path ;
5
5
6
6
use 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
+ } ;
8
10
9
11
pub fn postprocess_metrics ( metrics_path : & Path , summary_path : & Path ) -> anyhow:: Result < ( ) > {
10
12
let metrics = load_metrics ( metrics_path) ?;
@@ -15,7 +17,30 @@ pub fn postprocess_metrics(metrics_path: &Path, summary_path: &Path) -> anyhow::
15
17
. open ( summary_path)
16
18
. with_context ( || format ! ( "Cannot open summary file at {summary_path:?}" ) ) ?;
17
19
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( ) ) ;
19
44
20
45
Ok ( ( ) )
21
46
}
0 commit comments