@@ -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,31 @@ 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
+ eprintln ! ( "Step `{}`\n {table}\n " , invocation. cmdline) ;
34
+ writeln ! (
35
+ file,
36
+ r"<details>
37
+ <summary>{}</summary>
38
+ <pre><code>{table}</code></pre>
39
+ </details>
40
+ " ,
41
+ invocation. cmdline
42
+ ) ?;
43
+ }
44
+ eprintln ! ( "Recorded {} bootstrap invocation(s)" , metrics. invocations. len( ) ) ;
19
45
20
46
Ok ( ( ) )
21
47
}
0 commit comments