about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2023-05-26 15:21:21 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2023-05-26 15:21:21 +0200
commit7040d4102f0f3915944369e8d25ebf91f6a99640 (patch)
tree4d76ec012e6a60e3871b4a4f943693f9ba9f6b0f
parentcb68c051511fe0583ecf3f39147b8537a26c1e1f (diff)
downloadrust-7040d4102f0f3915944369e8d25ebf91f6a99640.tar.gz
rust-7040d4102f0f3915944369e8d25ebf91f6a99640.zip
rename metadata_version to format_version
The new name is more accurate.
-rw-r--r--src/bootstrap/metrics.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/bootstrap/metrics.rs b/src/bootstrap/metrics.rs
index 8aa821a3afc..405a88d7568 100644
--- a/src/bootstrap/metrics.rs
+++ b/src/bootstrap/metrics.rs
@@ -19,7 +19,7 @@ use sysinfo::{CpuExt, System, SystemExt};
 // Versions:
 // 0: initial version
 // 1: replaced JsonNode::Test with JsonNode::TestSuite
-const CURRENT_METADATA_VERSION: usize = 1;
+const CURRENT_FORMAT_VERSION: usize = 1;
 
 pub(crate) struct BuildMetrics {
     state: RefCell<MetricsState>,
@@ -151,15 +151,15 @@ impl BuildMetrics {
         // previous invocations are still present in the resulting file.
         let mut invocations = match std::fs::read(&dest) {
             Ok(contents) => {
-                // We first parse just the metadata_version field to have the check succeed even if
+                // We first parse just the format_version field to have the check succeed even if
                 // the rest of the contents are not valid anymore.
-                let version: OnlyMetadataVersion = t!(serde_json::from_slice(&contents));
-                if version.metadata_version == CURRENT_METADATA_VERSION {
+                let version: OnlyFormatVersion = t!(serde_json::from_slice(&contents));
+                if version.format_version == CURRENT_FORMAT_VERSION {
                     t!(serde_json::from_slice::<JsonRoot>(&contents)).invocations
                 } else {
                     println!(
                         "warning: overriding existing build/metrics.json, as it's not \
-                         compatible with build metrics format version {CURRENT_METADATA_VERSION}."
+                         compatible with build metrics format version {CURRENT_FORMAT_VERSION}."
                     );
                     Vec::new()
                 }
@@ -181,8 +181,7 @@ impl BuildMetrics {
             children: steps.into_iter().map(|step| self.prepare_json_step(step)).collect(),
         });
 
-        let json =
-            JsonRoot { metadata_version: CURRENT_METADATA_VERSION, system_stats, invocations };
+        let json = JsonRoot { format_version: CURRENT_FORMAT_VERSION, system_stats, invocations };
 
         t!(std::fs::create_dir_all(dest.parent().unwrap()));
         let mut file = BufWriter::new(t!(File::create(&dest)));
@@ -234,7 +233,7 @@ struct StepMetrics {
 #[serde(rename_all = "snake_case")]
 struct JsonRoot {
     #[serde(default)] // For version 0 the field was not present.
-    metadata_version: usize,
+    format_version: usize,
     system_stats: JsonInvocationSystemStats,
     invocations: Vec<JsonInvocation>,
 }
@@ -322,7 +321,7 @@ struct JsonStepSystemStats {
 }
 
 #[derive(Deserialize)]
-struct OnlyMetadataVersion {
+struct OnlyFormatVersion {
     #[serde(default)] // For version 0 the field was not present.
-    metadata_version: usize,
+    format_version: usize,
 }