4
4
//! As this module requires additional dependencies not present during local builds, it's cfg'd
5
5
//! away whenever the `build.metrics` config option is not set to `true`.
6
6
7
- use crate :: builder:: Step ;
7
+ use crate :: builder:: { Builder , Step } ;
8
8
use crate :: util:: t;
9
9
use crate :: Build ;
10
10
use serde_derive:: { Deserialize , Serialize } ;
@@ -33,7 +33,12 @@ impl BuildMetrics {
33
33
BuildMetrics { state }
34
34
}
35
35
36
- pub ( crate ) fn enter_step < S : Step > ( & self , step : & S ) {
36
+ pub ( crate ) fn enter_step < S : Step > ( & self , step : & S , builder : & Builder < ' _ > ) {
37
+ // Do not record dry runs, as they'd be duplicates of the actual steps.
38
+ if builder. config . dry_run ( ) {
39
+ return ;
40
+ }
41
+
37
42
let mut state = self . state . borrow_mut ( ) ;
38
43
39
44
// Consider all the stats gathered so far as the parent's.
@@ -56,7 +61,12 @@ impl BuildMetrics {
56
61
} ) ;
57
62
}
58
63
59
- pub ( crate ) fn exit_step ( & self ) {
64
+ pub ( crate ) fn exit_step ( & self , builder : & Builder < ' _ > ) {
65
+ // Do not record dry runs, as they'd be duplicates of the actual steps.
66
+ if builder. config . dry_run ( ) {
67
+ return ;
68
+ }
69
+
60
70
let mut state = self . state . borrow_mut ( ) ;
61
71
62
72
self . collect_stats ( & mut * state) ;
@@ -74,7 +84,12 @@ impl BuildMetrics {
74
84
}
75
85
}
76
86
77
- pub ( crate ) fn record_test ( & self , name : & str , outcome : TestOutcome ) {
87
+ pub ( crate ) fn record_test ( & self , name : & str , outcome : TestOutcome , builder : & Builder < ' _ > ) {
88
+ // Do not record dry runs, as they'd be duplicates of the actual steps.
89
+ if builder. config . dry_run ( ) {
90
+ return ;
91
+ }
92
+
78
93
let mut state = self . state . borrow_mut ( ) ;
79
94
state
80
95
. running_steps
0 commit comments