Skip to content

Commit aade9e1

Browse files
Allow using marker names in datagen (#5060)
#4991
1 parent 0c85284 commit aade9e1

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

components/datetime/tests/data/gen.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/sh
22
cargo run -p icu4x-datagen -- \
3-
--markers "datetime/gregory/datelengths@1" "datetime/gregory/datesymbols@1" "datetime/timelengths@1" "datetime/timesymbols@1" "decimal/symbols@1" "time_zone/formats@1" "time_zone/specific_short@1" \
3+
--markers \
4+
GregorianDateLengthsV1Marker \
5+
GregorianDateSymbolsV1Marker \
6+
TimeLengthsV1Marker \
7+
TimeSymbolsV1Marker \
8+
DecimalSymbolsV1Marker \
9+
TimeZoneFormatsV1Marker \
10+
MetazoneSpecificNamesShortV1Marker \
411
--locales en \
512
--format blob2 \
613
--out $(dirname $0)/blob.postcard \

components/experimental/tests/transliterate/data/gen.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/sh
22
cargo run -p icu4x-datagen --features experimental_components -- \
3-
--markers "transliterator/rules@1" \
3+
--markers TransliteratorRulesV1Marker \
44
--locales full \
5-
--runtime-fallback-location external \
5+
--deduplication none \
6+
--no-internal-fallback \
67
--cldr-root $(dirname $0)/../../../../../provider/datagen/tests/data/cldr \
78
--format mod \
89
--out $(dirname $0)/baked \

provider/datagen/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,20 @@ macro_rules! cb {
159159
let lookup = LOOKUP.get_or_init(|| {
160160
[
161161
("core/helloworld@1", Ok(icu_provider::hello_world::HelloWorldV1Marker::INFO)),
162+
(stringify!(icu_provider::hello_world::HelloWorldV1Marker).split("::").last().unwrap().trim(), Ok(icu_provider::hello_world::HelloWorldV1Marker::INFO)),
162163
$(
163164
($path, Ok(<$marker>::INFO)),
165+
(stringify!($marker).split("::").last().unwrap().trim(), Ok(<$marker>::INFO)),
164166
)+
165167
$(
166168
#[cfg(feature = "experimental_components")]
167169
($epath, Ok(<$emarker>::INFO)),
170+
#[cfg(feature = "experimental_components")]
171+
(stringify!($emarker).split("::").last().unwrap().trim(), Ok(<$emarker>::INFO)),
168172
#[cfg(not(feature = "experimental_components"))]
169173
($epath, Err(stringify!(feature = "experimental_components"))),
174+
#[cfg(not(feature = "experimental_components"))]
175+
(stringify!($emarker).split("::").last().unwrap().trim(), Err(stringify!(feature = "experimental_components"))),
170176
)+
171177

172178
]

provider/datagen/src/transform/cldr/calendar/japanese.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl DatagenProvider {
9999
return Err(DataError::custom(
100100
"Era data has changed! This can be for two reasons: Either the CLDR locale data for Japanese eras has \
101101
changed in an incompatible way, or there is a new Japanese era. Run \
102-
`ICU4X_SKIP_JAPANESE_INTEGRITY_CHECK=1 cargo run -p icu4x-datagen -- --markers calendar/japanext@1 --format dir --syntax json \
102+
`ICU4X_SKIP_JAPANESE_INTEGRITY_CHECK=1 cargo run -p icu4x-datagen -- --markers JapaneseErasV1Marker --format dir --syntax json \
103103
--out provider/datagen/data/japanese-golden --pretty --overwrite` in the icu4x repo and inspect the diff to \
104104
check which situation it is. If a new era has been introduced, commit the diff, if not, it's likely that japanese.rs \
105105
in icu_datagen will need to be updated to handle the data changes."

tools/make/data.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ exit_on_error true
3939
4040
exec --fail-on-error cargo build -p icu4x-datagen --no-default-features --features fs_exporter,blob_exporter,baked_exporter,networking,provider
4141
42-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --locales full --format dir --syntax json --out provider/fs/tests/data/json --overwrite
43-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --locales full --format dir --syntax bincode --out provider/fs/tests/data/bincode --overwrite
44-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --locales full --format dir --syntax postcard --out provider/fs/tests/data/postcard --overwrite
42+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --locales full --format dir --syntax json --out provider/fs/tests/data/json --overwrite
43+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --locales full --format dir --syntax bincode --out provider/fs/tests/data/bincode --overwrite
44+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --locales full --format dir --syntax postcard --out provider/fs/tests/data/postcard --overwrite
4545
46-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --locales full --format blob --overwrite --out provider/blob/tests/data/v1.postcard
47-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --locales full --format blob2 --overwrite --out provider/blob/tests/data/v2.postcard
46+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --locales full --format blob --overwrite --out provider/blob/tests/data/v1.postcard
47+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --locales full --format blob2 --overwrite --out provider/blob/tests/data/v2.postcard
4848
49-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --locales full --format mod --pretty --overwrite --no-internal-fallback --deduplication none --out provider/baked/tests/data
49+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --locales full --format mod --pretty --overwrite --no-internal-fallback --deduplication none --out provider/baked/tests/data
5050
51-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" "fallback/likelysubtags@1" "fallback/parents@1" "fallback/supplement/co@1" --locales full --format blob --out provider/adapters/tests/data/blob.postcard --overwrite
52-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --without-fallback --locales de --format dir --syntax json --out provider/adapters/tests/data/langtest/de --overwrite
53-
exec --fail-on-error target/debug/icu4x-datagen --markers "core/helloworld@1" --without-fallback --locales ro --format dir --syntax json --out provider/adapters/tests/data/langtest/ro --overwrite
51+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker "fallback/likelysubtags@1" "fallback/parents@1" "fallback/supplement/co@1" --locales full --format blob --out provider/adapters/tests/data/blob.postcard --overwrite
52+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --without-fallback --locales de --format dir --syntax json --out provider/adapters/tests/data/langtest/de --overwrite
53+
exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1Marker --without-fallback --locales ro --format dir --syntax json --out provider/adapters/tests/data/langtest/ro --overwrite
5454
'''
5555

5656
[tasks.testdata-check]

0 commit comments

Comments
 (0)