Skip to content

Commit e5d57fc

Browse files
committed
iterate
1 parent bfc0c48 commit e5d57fc

File tree

13 files changed

+331
-335
lines changed

13 files changed

+331
-335
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/capi_cdylib/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ icu_provider = { version = "1.0.0", path = "../../provider/core", default-featur
3939
# Please keep features/cargo-all-features lists in sync with the icu_capi crate
4040
[features]
4141
default = ["icu_capi/default"]
42-
any_provider = ["icu_capi/any_provider"]
43-
buffer_provider = ["icu_capi/buffer_provider"]
4442
baked_provider = ["icu_capi/baked_provider"]
43+
buffer_provider = ["icu_capi/buffer_provider"]
4544
provider_fs = ["icu_capi/provider_fs"] # Indirectly implies buffer_provider
4645
provider_test = ["icu_capi/provider_test"]
4746
logging = ["icu_capi/logging"]

ffi/capi_staticlib/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ icu_provider = { version = "1.0.0", path = "../../provider/core", default-featur
3939
# Please keep features/cargo-all-features lists in sync with the icu_capi crate
4040
[features]
4141
default = ["icu_capi/default"]
42-
any_provider = ["icu_capi/any_provider"]
43-
buffer_provider = ["icu_capi/buffer_provider"]
4442
baked_provider = ["icu_capi/baked_provider"]
43+
buffer_provider = ["icu_capi/buffer_provider"]
4544
provider_fs = ["icu_capi/provider_fs"] # Indirectly implies buffer_provider
4645
provider_test = ["icu_capi/provider_test"]
4746
logging = ["icu_capi/logging"]

ffi/diplomat/Cargo.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ all-features = true
3232
skip_optional_dependencies = true
3333
# Bench feature gets tested separately and is only relevant for CI.
3434
# logging enables a feature of a dependency that has no externally visible API changes
35-
# baked_provider requires datagen.
36-
denylist = ["bench", "logging", "baked_provider"]
35+
denylist = ["bench", "logging"]
3736

3837
# Please keep the features list in sync with the icu_capi_staticlib/icu_capi_cdylib crates
3938
[features]
40-
default = ["any_provider"]
41-
any_provider = []
39+
default = ["baked_provider"]
40+
baked_provider = ["dep:zerovec"]
4241
buffer_provider = [
4342
"dep:icu_provider_blob",
4443
"dep:serde",
@@ -54,14 +53,12 @@ buffer_provider = [
5453
"icu_provider/serde",
5554
"icu_provider_adapters/serde",
5655
"icu_segmenter/serde",
57-
"icu_testdata?/buffer",
5856
]
5957
provider_fs = ["dep:icu_provider_fs", "buffer_provider"]
60-
provider_test = ["dep:icu_testdata"]
58+
provider_test = ["dep:icu_testdata", "buffer_provider"]
6159
logging = ["icu_provider/log_error_context", "dep:log"]
6260
# Use the env_logger functionality to log based on environment variables
6361
simple_logger = ["dep:simple_logger"]
64-
baked_provider = ["any_provider", "dep:zerovec"]
6562

6663
# meta feature for things we enable by default in C and C++
6764
cpp_default = ["provider_test", "logging", "simple_logger"]
@@ -93,7 +90,7 @@ writeable = { version = "0.5", path = "../../utils/writeable/" }
9390
icu_provider_blob = { version = "1.0.0", path = "../../provider/blob", optional = true }
9491
serde = { version = "1.0", default-features = false, optional = true }
9592

96-
icu_testdata = { version = "1.0.0", path = "../../provider/testdata", optional = true, features = ["icu_segmenter"] }
93+
icu_testdata = { version = "1.0.0", path = "../../provider/testdata", optional = true, features = ["buffer"] }
9794

9895
zerovec = { version = "*", path = "../../utils/zerovec", optional = true}
9996

@@ -104,6 +101,8 @@ zerovec = { version = "*", path = "../../utils/zerovec", optional = true}
104101
diplomat = { git = "https://github.com/rust-diplomat/diplomat", rev = "d3010a4b88a0f37d23e3c64cf5500cedc4e8cdf0" }
105102
diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat", rev = "d3010a4b88a0f37d23e3c64cf5500cedc4e8cdf0" }
106103

104+
[build-dependencies]
105+
icu_datagen = { version = "1.0", path = "../../provider/datagen", features = ["icu_segmenter"]}
107106

108107
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
109108
# Logging is automagical in wasm, we only need this for native

ffi/diplomat/build.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// This file is part of ICU4X. For terms of use, please see the file
2+
// called LICENSE at the top level of the ICU4X source tree
3+
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4+
5+
use icu_datagen::*;
6+
use std::path::PathBuf;
7+
8+
fn main() {
9+
if std::env::var("CARGO_FEATURE_BAKED_PROVIDER").is_ok()
10+
&& std::env::var("ICU4X_FFI_BAKED_ROOT").is_err()
11+
{
12+
let mod_directory = PathBuf::from(std::env::var_os("OUT_DIR").unwrap()).join("empty_bake");
13+
println!(
14+
"cargo:rustc-env=ICU4X_FFI_BAKED_ROOT={}",
15+
mod_directory.display()
16+
);
17+
18+
if !mod_directory.exists() {
19+
icu_datagen::datagen(
20+
Some(&[]),
21+
&[],
22+
&SourceData::default(),
23+
vec![Out::Module {
24+
mod_directory,
25+
insert_feature_gates: false,
26+
use_separate_crates: true,
27+
overwrite: false,
28+
pretty: false,
29+
}],
30+
)
31+
.unwrap();
32+
}
33+
}
34+
}

ffi/diplomat/c/examples/fixeddecimal_tiny/Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ GCC := gcc
1717
CLANG := clang-14
1818
LLD := lld-14
1919

20-
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
20+
export ICU4X_FFI_BAKED_ROOT = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))baked
2121

22-
../../../../../target/debug/libicu_capi_staticlib.a: $(ALL_RUST) baked/mod.rs
23-
ICU4X_FFI_BAKED_ROOT=$(ROOT_DIR)/baked/mod.rs cargo build -p icu_capi_staticlib --no-default-features --features baked_provider
22+
../../../../../target/debug/libicu_capi_staticlib.a: $(ALL_RUST) $(ICU4X_FFI_BAKED_ROOT)
23+
cargo build -p icu_capi_staticlib --no-default-features --features baked_provider
2424

25-
icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: $(ALL_RUST) baked/mod.rs
25+
icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: $(ALL_RUST) $(ICU4X_FFI_BAKED_ROOT)
2626
cd icu_capi_staticlib_tiny && \
27-
ICU4X_FFI_BAKED_ROOT=$(ROOT_DIR)/baked/mod.rs RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu
27+
RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +$(ICU4X_NIGHTLY_TOOLCHAIN) panic-abort-build --target x86_64-unknown-linux-gnu
2828

29-
icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a: $(ALL_RUST) baked/mod.rs
29+
icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/release-opt-size/libicu_capi_staticlib_tiny.a: $(ALL_RUST) $(ICU4X_FFI_BAKED_ROOT)
3030
cd icu_capi_staticlib_tiny && \
31-
ICU4X_FFI_BAKED_ROOT=$(ROOT_DIR)/baked/mod.rs RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +${ICU4X_NIGHTLY_TOOLCHAIN} panic-abort-build --target x86_64-unknown-linux-gnu --profile=release-opt-size
31+
RUSTFLAGS="-Clinker-plugin-lto -Clinker=$(CLANG) -Ccodegen-units=1 -Clink-arg=-flto -Cpanic=abort" cargo +$(ICU4X_NIGHTLY_TOOLCHAIN) panic-abort-build --target x86_64-unknown-linux-gnu --profile=release-opt-size
3232

33-
baked/mod.rs:
34-
cargo run -p icu_datagen --features bin,icu_segmenter -- --locales en bn --all-keys --cldr-tag 42.0.0 --icuexport-tag release-72-1 --format mod --out baked --use-separate-crates
33+
$(ICU4X_FFI_BAKED_ROOT):
34+
cargo run -p icu_datagen --features bin,icu_segmenter -- --locales en bn --keys "decimal/symbols@1" --cldr-root ../../../../../provider/testdata/data/cldr/ --format mod --use-separate-crates --out ${ICU4X_FFI_BAKED_ROOT}
3535

3636
# Naive target: no optimizations, full std
3737
optim0.elf: ../../../../../target/debug/libicu_capi_staticlib.a $(ALL_HEADERS) test.c

ffi/diplomat/cpp/docs/source/provider_ffi.rst

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/diplomat/cpp/include/ICU4XDataProvider.hpp

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/diplomat/js/docs/source/provider_ffi.rst

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/diplomat/js/include/ICU4XDataProvider.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class ICU4XDataProvider {
4848
4949
* Constructs a {@link ICU4XDataProvider `ICU4XDataProvider`} containing baked data.
5050
51-
* When compiling the Rust library, set the `ICU4X_FFI_BAKED_ROOT` environment variable to the baked data's `mod.rs`'s path.
51+
* When compiling the Rust library, set the `ICU4X_FFI_BAKED_ROOT` environment variable to the baked data folder.
5252
*/
5353
static create_baked(): ICU4XDataProvider;
5454

0 commit comments

Comments
 (0)