From 236ec1bfbadf3ee51bf125c50febf74132bafa35 Mon Sep 17 00:00:00 2001 From: Robert Bastian <4706271+robertbastian@users.noreply.github.com> Date: Fri, 3 Nov 2023 18:47:41 -0700 Subject: [PATCH] Fix CI (#4254) --- Cargo.lock | 2 +- provider/baked/_template_/Cargo.toml | 2 +- provider/baked/calendar/Cargo.toml | 2 +- provider/baked/casemap/Cargo.toml | 2 +- provider/baked/list/Cargo.toml | 2 +- provider/baked/locid_transform/Cargo.toml | 2 +- provider/baked/normalizer/Cargo.toml | 2 +- provider/baked/plurals/Cargo.toml | 2 +- provider/baked/relativetime/Cargo.toml | 2 +- provider/baked/segmenter/Cargo.toml | 2 +- .../baked/singlenumberformatter/Cargo.toml | 2 +- provider/baked/timezone/Cargo.toml | 2 +- provider/baked/unitsconversion/Cargo.toml | 2 +- tools/bakeddata-scripts/Cargo.toml | 2 +- tools/bakeddata-scripts/src/main.rs | 72 ++++++++++++------- 15 files changed, 61 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5eb5a304acd..23702d7a996 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -194,7 +194,7 @@ dependencies = [ [[package]] name = "bakeddata-scripts" -version = "0.0.0" +version = "1.3.2" dependencies = [ "icu", "icu_compactdecimal", diff --git a/provider/baked/_template_/Cargo.toml b/provider/baked/_template_/Cargo.toml index 0648a9ca0c4..831135f4424 100644 --- a/provider/baked/_template_/Cargo.toml +++ b/provider/baked/_template_/Cargo.toml @@ -6,6 +6,7 @@ name = "icu__component__data" description = "Data for the icu__component_ crate" license-file = "LICENSE" +version = "_version_" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/calendar/Cargo.toml b/provider/baked/calendar/Cargo.toml index 8bbb3ee7cd6..eb3cf039b90 100644 --- a/provider/baked/calendar/Cargo.toml +++ b/provider/baked/calendar/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_calendar_data" description = "Data for the icu_calendar crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/casemap/Cargo.toml b/provider/baked/casemap/Cargo.toml index 83376fcb962..cc963167e98 100644 --- a/provider/baked/casemap/Cargo.toml +++ b/provider/baked/casemap/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_casemap_data" description = "Data for the icu_casemap crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/list/Cargo.toml b/provider/baked/list/Cargo.toml index 0f7337a0bf1..8b20225f74a 100644 --- a/provider/baked/list/Cargo.toml +++ b/provider/baked/list/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_list_data" description = "Data for the icu_list crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/locid_transform/Cargo.toml b/provider/baked/locid_transform/Cargo.toml index 01e03ae1b3b..e35e8b51c91 100644 --- a/provider/baked/locid_transform/Cargo.toml +++ b/provider/baked/locid_transform/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_locid_transform_data" description = "Data for the icu_locid_transform crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/normalizer/Cargo.toml b/provider/baked/normalizer/Cargo.toml index ead0652f374..2c29a31ae80 100644 --- a/provider/baked/normalizer/Cargo.toml +++ b/provider/baked/normalizer/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_normalizer_data" description = "Data for the icu_normalizer crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/plurals/Cargo.toml b/provider/baked/plurals/Cargo.toml index 24cd0ac9193..467817fb30c 100644 --- a/provider/baked/plurals/Cargo.toml +++ b/provider/baked/plurals/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_plurals_data" description = "Data for the icu_plurals crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/relativetime/Cargo.toml b/provider/baked/relativetime/Cargo.toml index 3ff9bf8a6cd..34414cfd126 100644 --- a/provider/baked/relativetime/Cargo.toml +++ b/provider/baked/relativetime/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_relativetime_data" description = "Data for the icu_relativetime crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/segmenter/Cargo.toml b/provider/baked/segmenter/Cargo.toml index fcf1901c95d..f34c7a2aa67 100644 --- a/provider/baked/segmenter/Cargo.toml +++ b/provider/baked/segmenter/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_segmenter_data" description = "Data for the icu_segmenter crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/singlenumberformatter/Cargo.toml b/provider/baked/singlenumberformatter/Cargo.toml index 0990f27d1ee..9b3978b29fb 100644 --- a/provider/baked/singlenumberformatter/Cargo.toml +++ b/provider/baked/singlenumberformatter/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_singlenumberformatter_data" description = "Data for the icu_singlenumberformatter crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/timezone/Cargo.toml b/provider/baked/timezone/Cargo.toml index 4afbeaabe72..4d7e410c84d 100644 --- a/provider/baked/timezone/Cargo.toml +++ b/provider/baked/timezone/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_timezone_data" description = "Data for the icu_timezone crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/provider/baked/unitsconversion/Cargo.toml b/provider/baked/unitsconversion/Cargo.toml index 501dde6aebd..e471c7a2b69 100644 --- a/provider/baked/unitsconversion/Cargo.toml +++ b/provider/baked/unitsconversion/Cargo.toml @@ -6,6 +6,7 @@ name = "icu_unitsconversion_data" description = "Data for the icu_unitsconversion crate" license-file = "LICENSE" +version = "1.3.2" authors.workspace = true categories.workspace = true @@ -14,4 +15,3 @@ homepage.workspace = true include.workspace = true repository.workspace = true rust-version.workspace = true -version.workspace = true diff --git a/tools/bakeddata-scripts/Cargo.toml b/tools/bakeddata-scripts/Cargo.toml index 0e227985ee8..5f23478651f 100644 --- a/tools/bakeddata-scripts/Cargo.toml +++ b/tools/bakeddata-scripts/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "bakeddata-scripts" -version = "0.0.0" +version.workspace = true publish = false edition = "2021" diff --git a/tools/bakeddata-scripts/src/main.rs b/tools/bakeddata-scripts/src/main.rs index 5d53d9d39a2..c34531997a4 100644 --- a/tools/bakeddata-scripts/src/main.rs +++ b/tools/bakeddata-scripts/src/main.rs @@ -8,27 +8,46 @@ use icu_datagen::baked_exporter::*; use icu_datagen::prelude::*; use std::path::Path; -const COMPONENTS: &[(&str, &[DataKey])] = &[ - ("calendar", icu::calendar::provider::KEYS), - ("casemap", icu::casemap::provider::KEYS), - ("collator", icu::collator::provider::KEYS), - ("compactdecimal", icu_compactdecimal::provider::KEYS), - ("datetime", icu::datetime::provider::KEYS), - ("decimal", icu::decimal::provider::KEYS), - ("displaynames", icu::displaynames::provider::KEYS), - ("list", icu::list::provider::KEYS), - ("locid_transform", icu::locid_transform::provider::KEYS), - ("normalizer", icu::normalizer::provider::KEYS), - ("plurals", icu::plurals::provider::KEYS), - ("properties", icu::properties::provider::KEYS), - ("relativetime", icu::relativetime::provider::KEYS), - ("segmenter", icu::segmenter::provider::KEYS), +const REPO_VERSION: &str = env!("CARGO_PKG_VERSION"); + +const COMPONENTS: &[(&str, &[DataKey], &str)] = &[ + ("calendar", icu::calendar::provider::KEYS, REPO_VERSION), + ("casemap", icu::casemap::provider::KEYS, REPO_VERSION), + ("collator", icu::collator::provider::KEYS, "1.3.3"), + ( + "compactdecimal", + icu_compactdecimal::provider::KEYS, + "1.3.4", + ), + ("datetime", icu::datetime::provider::KEYS, "1.3.4"), + ("decimal", icu::decimal::provider::KEYS, "1.3.4"), + ("displaynames", icu::displaynames::provider::KEYS, "1.3.4"), + ("list", icu::list::provider::KEYS, REPO_VERSION), + ( + "locid_transform", + icu::locid_transform::provider::KEYS, + REPO_VERSION, + ), + ("normalizer", icu::normalizer::provider::KEYS, REPO_VERSION), + ("plurals", icu::plurals::provider::KEYS, REPO_VERSION), + ("properties", icu::properties::provider::KEYS, "1.3.4"), + ( + "relativetime", + icu::relativetime::provider::KEYS, + REPO_VERSION, + ), + ("segmenter", icu::segmenter::provider::KEYS, REPO_VERSION), ( "singlenumberformatter", icu_singlenumberformatter::provider::KEYS, + REPO_VERSION, + ), + ("timezone", icu::timezone::provider::KEYS, REPO_VERSION), + ( + "unitsconversion", + icu_unitsconversion::provider::KEYS, + REPO_VERSION, ), - ("timezone", icu::timezone::provider::KEYS), - ("unitsconversion", icu_unitsconversion::provider::KEYS), ]; fn main() { @@ -43,16 +62,18 @@ fn main() { let components = if args.len() == 1 { COMPONENTS .iter() - .map(|(k, v)| (k.to_string(), *v)) + .map(|(krate, keys, version)| (krate.to_string(), *keys, *version)) .collect::>() } else { - let map = std::collections::HashMap::<&str, &'static [DataKey]>::from_iter( - COMPONENTS.iter().copied(), + let map = std::collections::HashMap::<&str, (&'static [DataKey], &'static str)>::from_iter( + COMPONENTS + .iter() + .map(|(krate, keys, version)| (*krate, (*keys, *version))), ); args.skip(1) - .filter_map(|arg| { - map.get(arg.strip_suffix('/').unwrap_or(arg.as_str())) - .map(|k| (arg, *k)) + .filter_map(|krate| { + map.get(krate.as_str()) + .map(|(keys, version)| (krate, *keys, *version)) }) .collect() }; @@ -78,7 +99,7 @@ fn main() { let template = Path::new("provider/baked/_template_"); - for (component, keys) in &components { + for (component, keys, version) in &components { let path = Path::new("provider/baked").join(component); let _ = std::fs::remove_dir_all(&path); @@ -96,7 +117,8 @@ fn main() { path.join(file), &std::fs::read_to_string(template.join(file)) .unwrap() - .replace("_component_", component), + .replace("_component_", component) + .replace("_version_", version), ) .unwrap(); }