| # This file is part of ICU4X. For terms of use, please see the file | |
| # called LICENSE at the top level of the ICU4X source tree | |
| # (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). | |
| # This is a cargo-make file included in the toplevel Makefile.toml | |
| [tasks.download-repo-sources] | |
| description = "Download fresh source testing data into the icu_provider_export crate." | |
| category = "ICU4X Data" | |
| command = "cargo" | |
| args = [ | |
| "test", | |
| "-p", | |
| "icu_provider_source", | |
| "--lib", | |
| "--all-features", | |
| "--", | |
| "tests::download_repo_sources::download_repo_sources", | |
| "--exact", | |
| "--nocapture", | |
| "--include-ignored" | |
| ] | |
| [tasks.testdata] | |
| description = "Run the testdata generation test in icu_provider_export" | |
| category = "ICU4X Data" | |
| command = "cargo" | |
| env = { ICU4X_WRITE_TESTDATA = "1" } | |
| args = [ | |
| "test", | |
| "-p=icu_provider_source", | |
| "--no-default-features", | |
| "--features=use_wasm,unstable", | |
| "--", | |
| "--nocapture", | |
| "make_testdata", | |
| ] | |
| [tasks.testdata-hello-world] | |
| description = "Builds all hello-world testdata for use in provider/{adapters,blob,fs} tests" | |
| category = "ICU4X Data" | |
| script_runner = "@duckscript" | |
| script = ''' | |
| exit_on_error true | |
| exec --fail-on-error cargo build -p icu4x-datagen --no-default-features --features fs_exporter,blob_exporter,baked_exporter | |
| # Filesystem | |
| exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1 --locales full --format fs --syntax json --out provider/fs/tests/data/json --overwrite | |
| exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1 --locales full --format fs --syntax bincode --out provider/fs/tests/data/bincode --overwrite | |
| exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1 --locales full --format fs --syntax postcard --out provider/fs/tests/data/postcard --overwrite | |
| # Blob | |
| exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1 --locales full --format blob --overwrite --out provider/blob/tests/data/v3.postcard | |
| # Baked | |
| exec --fail-on-error target/debug/icu4x-datagen --markers HelloWorldV1 --locales full --format baked --pretty --overwrite --no-internal-fallback --deduplication none --out provider/baked/tests/data | |
| ''' | |
| [tasks.testdata-check] | |
| description = "Rebuild all testdata and ensure that the working copy is clean" | |
| category = "ICU4X Data" | |
| dependencies = [ | |
| "download-repo-sources", | |
| "testdata", | |
| "testdata-hello-world", | |
| ] | |
| script_runner = "@duckscript" | |
| script = ''' | |
| exit_on_error true | |
| output = exec git status --porcelain=v1 provider/source/data/debug provider/source/tests/data provider/fs/tests/data provider/blob/tests/data provider/baked/tests/data provider/adapters/tests/data provider/source/src/tests/data.rs | |
| output_length = length ${output.stdout} | |
| if greater_than ${output_length} 0 | |
| msg = array "" "" | |
| array_push ${msg} "Test data needs to be updated. Please run `cargo make download-repo-sources`, `cargo make testdata` and `cargo make testdata-hello-world:" | |
| array_push ${msg} "" | |
| array_push ${msg} "${output.stdout}" | |
| msg = array_join ${msg} "\n" | |
| trigger_error ${msg} | |
| end | |
| ''' | |
| [tasks.bakeddata] | |
| description = "Builds full baked data" | |
| category = "ICU4X Data" | |
| script_runner = "@duckscript" | |
| script = ''' | |
| exit_on_error true | |
| if array_is_empty ${@} | |
| exec --fail-on-error cargo run -m tools/make/bakeddata/Cargo.toml --release | |
| else | |
| exec --fail-on-error cargo build -m tools/make/bakeddata/Cargo.toml | |
| for component in ${@} | |
| exec --fail-on-error target/debug/bakeddata "${component}" | |
| end | |
| end | |
| ''' | |
| [tasks.bakeddata-check] | |
| description = "Rebuild baked data and ensure that the working copy is clean" | |
| category = "ICU4X Data" | |
| dependencies = ["bakeddata"] | |
| script_runner = "@duckscript" | |
| script = ''' | |
| exit_on_error true | |
| output = exec git status --porcelain=v1 | |
| output_length = length ${output.stdout} | |
| if greater_than ${output_length} 0 | |
| msg = array "" "" | |
| array_push ${msg} "Baked data needs to be updated. Please run `cargo make bakeddata`" | |
| array_push ${msg} "" | |
| array_push ${msg} "${output.stdout}" | |
| msg = array_join ${msg} "\n" | |
| trigger_error ${msg} | |
| end | |
| ''' |