Skip to content

Commit

Permalink
Fix CI (unicode-org#4254)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian authored Nov 4, 2023
1 parent 126c90d commit 236ec1b
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/_template_/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,4 +15,3 @@ homepage.workspace = true
include.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
2 changes: 1 addition & 1 deletion provider/baked/calendar/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/casemap/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/list/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/locid_transform/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/normalizer/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/plurals/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/relativetime/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/segmenter/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/singlenumberformatter/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/timezone/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provider/baked/unitsconversion/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/bakeddata-scripts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[package]
name = "bakeddata-scripts"
version = "0.0.0"
version.workspace = true
publish = false
edition = "2021"

Expand Down
72 changes: 47 additions & 25 deletions tools/bakeddata-scripts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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::<Vec<_>>()
} 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()
};
Expand All @@ -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);
Expand All @@ -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();
}
Expand Down

0 comments on commit 236ec1b

Please sign in to comment.