@@ -19,7 +19,7 @@ use sysinfo::{CpuExt, System, SystemExt};
19
19
// Versions:
20
20
// 0: initial version
21
21
// 1: replaced JsonNode::Test with JsonNode::TestSuite
22
- const CURRENT_METADATA_VERSION : usize = 1 ;
22
+ const CURRENT_FORMAT_VERSION : usize = 1 ;
23
23
24
24
pub ( crate ) struct BuildMetrics {
25
25
state : RefCell < MetricsState > ,
@@ -151,15 +151,15 @@ impl BuildMetrics {
151
151
// previous invocations are still present in the resulting file.
152
152
let mut invocations = match std:: fs:: read ( & dest) {
153
153
Ok ( contents) => {
154
- // We first parse just the metadata_version field to have the check succeed even if
154
+ // We first parse just the format_version field to have the check succeed even if
155
155
// the rest of the contents are not valid anymore.
156
- let version: OnlyMetadataVersion = t ! ( serde_json:: from_slice( & contents) ) ;
157
- if version. metadata_version == CURRENT_METADATA_VERSION {
156
+ let version: OnlyFormatVersion = t ! ( serde_json:: from_slice( & contents) ) ;
157
+ if version. format_version == CURRENT_FORMAT_VERSION {
158
158
t ! ( serde_json:: from_slice:: <JsonRoot >( & contents) ) . invocations
159
159
} else {
160
160
println ! (
161
161
"warning: overriding existing build/metrics.json, as it's not \
162
- compatible with build metrics format version {CURRENT_METADATA_VERSION }."
162
+ compatible with build metrics format version {CURRENT_FORMAT_VERSION }."
163
163
) ;
164
164
Vec :: new ( )
165
165
}
@@ -181,8 +181,7 @@ impl BuildMetrics {
181
181
children : steps. into_iter ( ) . map ( |step| self . prepare_json_step ( step) ) . collect ( ) ,
182
182
} ) ;
183
183
184
- let json =
185
- JsonRoot { metadata_version : CURRENT_METADATA_VERSION , system_stats, invocations } ;
184
+ let json = JsonRoot { format_version : CURRENT_FORMAT_VERSION , system_stats, invocations } ;
186
185
187
186
t ! ( std:: fs:: create_dir_all( dest. parent( ) . unwrap( ) ) ) ;
188
187
let mut file = BufWriter :: new ( t ! ( File :: create( & dest) ) ) ;
@@ -234,7 +233,7 @@ struct StepMetrics {
234
233
#[ serde( rename_all = "snake_case" ) ]
235
234
struct JsonRoot {
236
235
#[ serde( default ) ] // For version 0 the field was not present.
237
- metadata_version : usize ,
236
+ format_version : usize ,
238
237
system_stats : JsonInvocationSystemStats ,
239
238
invocations : Vec < JsonInvocation > ,
240
239
}
@@ -322,7 +321,7 @@ struct JsonStepSystemStats {
322
321
}
323
322
324
323
#[ derive( Deserialize ) ]
325
- struct OnlyMetadataVersion {
324
+ struct OnlyFormatVersion {
326
325
#[ serde( default ) ] // For version 0 the field was not present.
327
- metadata_version : usize ,
326
+ format_version : usize ,
328
327
}
0 commit comments