Skip to content

Commit

Permalink
Add feature slicing to capi (#3216)
Browse files Browse the repository at this point in the history
* Add feature slicing to capi

* split out timezone

* Update Diplomat

* reorder mods

* ffi test

* gn

* Add max_combination_size

* Fix feature

* cfg

* fix test

* fix

* gn

* scope tiny

* imports

* line

* add calendar feature

* timezone

* +metazone

* week

* week

* fix link

* Revert "fix link"

This reverts commit 1332a11.

* fix link
  • Loading branch information
Manishearth authored Mar 28, 2023
1 parent b675c71 commit eb79e5f
Show file tree
Hide file tree
Showing 27 changed files with 284 additions and 153 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

64 changes: 45 additions & 19 deletions ffi/diplomat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ all-features = true
# Bench feature gets tested separately and is only relevant for CI.
# logging enables a feature of a dependency that has no externally visible API changes
denylist = ["bench", "logging", "cpp_default", "wasm_default"]
# This has a lot of features, run a reduced test that is likely to catch 99% of bugs
max_combination_size = 2

# Please keep the features list in sync with the icu_capi_staticlib/icu_capi_cdylib crates
# Please keep the features list in sync with the icu_capi_staticlib/icu_capi_cdylib crates (except for components features)
[features]
default = ["any_provider"]
default = ["any_provider", "default_components"]
any_provider = []
buffer_provider = [
"dep:icu_provider_blob",
Expand Down Expand Up @@ -66,28 +68,52 @@ cpp_default = ["provider_test", "logging", "simple_logger"]
# meta feature for things we enable by default in wasm
wasm_default = ["buffer_provider", "logging"]

# Components
default_components = ["icu_calendar", "icu_collator", "icu_datetime", "icu_decimal",
"icu_displaynames", "icu_list", "icu_locid_transform",
"icu_normalizer", "icu_plurals", "icu_properties",
"icu_segmenter", "icu_timezone"]
icu_calendar = ["dep:icu_calendar"]
icu_collator = ["dep:icu_collator"]
# icu_collections = ["dep:icu_collections"] # Not useful on its own
icu_datetime = ["dep:icu_datetime", "dep:icu_calendar", "dep:icu_timezone", "dep:icu_decimal", "dep:icu_plurals"]
icu_decimal = ["dep:icu_decimal", "dep:fixed_decimal"]
icu_displaynames = ["dep:icu_displaynames"]
icu_list = ["dep:icu_list"]
icu_locid_transform = ["dep:icu_locid_transform"]
icu_normalizer = ["dep:icu_normalizer"]
icu_plurals = ["dep:icu_plurals", "dep:fixed_decimal"]
icu_properties = ["dep:icu_properties", "dep:icu_collections", "dep:unicode-bidi"]
icu_segmenter = ["dep:icu_segmenter"]
icu_timezone = ["dep:icu_timezone", "dep:icu_calendar"]


[dependencies]
fixed_decimal = { version = "0.5.2", path = "../../utils/fixed_decimal", features = ["ryu"] }
icu_calendar = { version = "1.1.0", path = "../../components/calendar"}
icu_collator = { version = "1.1.0", path = "../../components/collator" }
icu_collections = { version = "1.1.0", path = "../../components/collections"}
icu_datetime = { version = "1.1.0", path = "../../components/datetime/" }
icu_decimal = { version = "1.1.0", path = "../../components/decimal/" }
icu_displaynames = { version = "0.9.0", path = "../../experimental/displaynames" }
icu_list = { version = "1.1.0", path = "../../components/list" }
icu_locid_transform = { version = "1.1.0", path = "../../components/locid_transform" }
# Mandatory ICU4X components and utils
icu_locid = { version = "1.1.0", path = "../../components/locid" }
icu_normalizer = { version = "1.1.0", path = "../../components/normalizer/" }
icu_plurals = { version = "1.1.0", path = "../../components/plurals/" }
icu_properties = { version = "1.1.0", path = "../../components/properties/", features = ["bidi"] }
icu_provider = { version = "1.1.0", path = "../../provider/core" }
icu_provider_adapters = { version = "1.1.0", path = "../../provider/adapters" }
icu_segmenter = { version = "0.8.0", path = "../../experimental/segmenter" }
icu_timezone = { version = "1.1.0", path = "../../components/timezone" }
tinystr = { version = "0.7.1", path = "../../utils/tinystr", default-features = false }
unicode-bidi = { version = "0.3.13", default-features = false }
writeable = { version = "0.5.1", path = "../../utils/writeable/" }

# Optional ICU4X components and their dependent utils
fixed_decimal = { version = "0.5.2", path = "../../utils/fixed_decimal", features = ["ryu"] , optional = true}
icu_calendar = { version = "1.1.0", path = "../../components/calendar", optional = true}
icu_collator = { version = "1.1.0", path = "../../components/collator" , optional = true}
icu_collections = { version = "1.1.0", path = "../../components/collections", optional = true}
icu_datetime = { version = "1.1.0", path = "../../components/datetime/" , optional = true}
icu_decimal = { version = "1.1.0", path = "../../components/decimal/" , optional = true}
icu_displaynames = { version = "0.9.0", path = "../../experimental/displaynames", optional = true }
icu_list = { version = "1.1.0", path = "../../components/list" , optional = true}
icu_locid_transform = { version = "1.1.0", path = "../../components/locid_transform" , optional = true}
icu_normalizer = { version = "1.1.0", path = "../../components/normalizer/" , optional = true}
icu_plurals = { version = "1.1.0", path = "../../components/plurals/" , optional = true}
icu_properties = { version = "1.1.0", path = "../../components/properties/", features = ["bidi"] , optional = true}
icu_segmenter = { version = "0.8.0", path = "../../experimental/segmenter" , optional = true}
icu_timezone = { version = "1.1.0", path = "../../components/timezone" , optional = true}
unicode-bidi = { version = "0.3.13", default-features = false, optional = true}

# Optional ICU4X features (not components)
icu_provider_blob = { version = "1.1.0", path = "../../provider/blob", optional = true }
serde = { version = "1.0", default-features = false, optional = true }

Expand All @@ -97,8 +123,8 @@ icu_testdata = { version = "1.1.0", path = "../../provider/testdata", optional =
# The version here can either be a `version = ".."` spec or `git = "https://github.com/rust-diplomat/diplomat", rev = ".."`
# Since this crate is published, Diplomat must be published preceding a new ICU4X release but may use git versions in between
# ALSO MAKE SURE TO UPDATE /tools/ffi_coverage/Cargo.toml!
diplomat = { git = "https://github.com/rust-diplomat/diplomat", rev = "835c985909f46a90403a69f015c7a2996ea34525" }
diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat", rev = "835c985909f46a90403a69f015c7a2996ea34525" }
diplomat = { git = "https://github.com/rust-diplomat/diplomat", rev = "0e9eb4f1b64deca826fdd566bd3eabbf5ad9e807" }
diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat", rev = "0e9eb4f1b64deca826fdd566bd3eabbf5ad9e807" }


[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion ffi/diplomat/c/examples/fixeddecimal_tiny/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CLANG := clang-14
LLD := lld-14

../../../../../target/debug/libicu_capi_staticlib.a: FORCE
cargo build -p icu_capi_staticlib --no-default-features --features buffer_provider
cargo build -p icu_capi_staticlib --no-default-features --features buffer_provider,icu_capi/default_components

icu_capi_staticlib_tiny/target/x86_64-unknown-linux-gnu/debug/libicu_capi_staticlib_tiny.a: FORCE
rustup toolchain install ${ICU4X_NIGHTLY_TOOLCHAIN}
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2021"
crate-type = ["staticlib"]

[dependencies]
icu_capi = { path = "../../../..", default-features = false, features = ["buffer_provider"] }
icu_capi = { path = "../../../..", default-features = false, features = ["buffer_provider", "icu_decimal"] }
dlmalloc = { version = "0.2", features = ["global"] }

[profile.release]
Expand Down
1 change: 1 addition & 0 deletions ffi/diplomat/cpp/docs/source/index.rst

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

16 changes: 16 additions & 0 deletions ffi/diplomat/cpp/docs/source/metazone_calculator_ffi.rst

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

10 changes: 0 additions & 10 deletions ffi/diplomat/cpp/docs/source/timezone_ffi.rst

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

4 changes: 4 additions & 0 deletions ffi/diplomat/cpp/include/ICU4XMetazoneCalculator.hpp

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

1 change: 1 addition & 0 deletions ffi/diplomat/js/docs/source/index.rst

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

16 changes: 16 additions & 0 deletions ffi/diplomat/js/docs/source/metazone_calculator_ffi.rst

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

10 changes: 0 additions & 10 deletions ffi/diplomat/js/docs/source/timezone_ffi.rst

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

4 changes: 4 additions & 0 deletions ffi/diplomat/js/include/ICU4XMetazoneCalculator.d.ts

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

Loading

0 comments on commit eb79e5f

Please sign in to comment.