Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using MultiForkByKeyProvider for all datagen #1615

Merged
merged 8 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions provider/cldr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ use transform::locale_canonicalizer::likely_subtags::LikelySubtagsProvider;
use transform::plurals::PluralsProvider;
use transform::time_zones::TimeZonesProvider;

pub fn create_exportable_properties_provider<T: DataMarker>(
#[cfg(not(feature = "icu_list"))]
type ListProvider = PluralsProvider; // we can't cfg-exclude part of the bound, but we can do this...
robertbastian marked this conversation as resolved.
Show resolved Hide resolved

pub fn create_exportable_provider<T: DataMarker>(
cldr_paths: &dyn CldrPaths,
uprops_root: PathBuf,
_uprops_root: PathBuf,
) -> Result<MultiForkByKeyProvider<Box<dyn IterableDynProvider<T>>>, CldrError>
where
AliasesProvider: IterableDynProvider<T>,
Expand All @@ -79,7 +82,7 @@ where
Box::new(PluralsProvider::try_from(cldr_paths)?),
Box::new(TimeZonesProvider::try_from(cldr_paths)?),
#[cfg(feature = "icu_list")]
Box::new(ListProvider::try_from(cldr_paths, uprops_root)?),
Box::new(ListProvider::try_from(cldr_paths, _uprops_root)?),
],
})
}
Expand Down
4 changes: 2 additions & 2 deletions provider/uprops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
`icu_provider_uprops` contains implementations of the [`ICU4X`]
[data provider] interface backed by TOML files exported by the
ICU4C icuwriteuprops tool. Create a directory containing TOML files for
the necessary Unicode properties and then pass the path into the
[`PropertiesDataProvider`].
the necessary Unicode properties and then pass the path to the desired
provider.

**Important:** This data provider implementation is not optimized
for production use. It is much more efficient if you use
Expand Down
2 changes: 1 addition & 1 deletion provider/uprops/src/enum_codepointtrie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use zerovec::ZeroVec;

/// This data provider returns `CodePointTrie` data inside a
/// `UnicodePropertyMap` data struct. The source data is the same as that of
/// [crate::provider::PropertiesDataProvider], which is a TOML file of data
/// the other properties providers, which is a TOML file of data
/// for the property(-ies) desired, as given by the ICU4C property data
/// exporter tool.
pub struct EnumeratedPropertyCodePointTrieProvider {
Expand Down
6 changes: 3 additions & 3 deletions provider/uprops/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//! `icu_provider_uprops` contains implementations of the [`ICU4X`]
//! [data provider] interface backed by TOML files exported by the
//! ICU4C icuwriteuprops tool. Create a directory containing TOML files for
//! the necessary Unicode properties and then pass the path into the
//! [`PropertiesDataProvider`].
//! the necessary Unicode properties and then pass the path to the desired
//! provider.
//!
//! **Important:** This data provider implementation is not optimized
//! for production use. It is much more efficient if you use
Expand Down Expand Up @@ -35,7 +35,7 @@ use icu_provider::iter::IterableDynProvider;
use icu_provider::DataMarker;
use std::path::Path;

pub fn create_exportable_properties_provider<T: DataMarker>(
pub fn create_exportable_provider<T: DataMarker>(
root_dir: &Path,
) -> eyre::Result<MultiForkByKeyProvider<Box<dyn IterableDynProvider<T>>>>
where
Expand Down
7 changes: 3 additions & 4 deletions provider/uprops/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ use zerovec::{VarZeroVec, ZeroSlice, ZeroVec};

/// This data provider returns a [`ScriptWithExtensions`] instance,
/// which efficiently represents data for the Script and Script_Extensions
/// properties. The source data is the same as that of
/// [crate::provider::PropertiesDataProvider], which is a TOML file of data
/// for the property(-ies) desired, as given by the ICU4C property data
/// exporter tool.
/// properties. The source data is the same as that of the other properties
/// providers, which is a TOML file of data for the property(-ies) desired,
/// as given by the ICU4C property data exporter tool.
pub struct ScriptWithExtensionsPropertyProvider {
data: ScriptWithExtensionsProperty,
}
Expand Down
5 changes: 3 additions & 2 deletions tools/datagen/src/bin/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ fn main() -> eyre::Result<()> {
v
};

#[allow(clippy::if_same_then_else)]
let selected_keys = if matches.is_present("ALL_KEYS") {
all_keys
} else if matches.is_present("TEST_KEYS") {
Expand Down Expand Up @@ -337,11 +338,11 @@ fn main() -> eyre::Result<()> {

Box::new(MultiForkByKeyProvider {
providers: vec![
Box::new(icu_provider_cldr::create_exportable_properties_provider(
Box::new(icu_provider_cldr::create_exportable_provider(
cldr_paths.as_ref(),
uprops_root.clone(),
)?) as Box<dyn IterableDynProvider<SerializeMarker>>,
robertbastian marked this conversation as resolved.
Show resolved Hide resolved
Box::new(icu_provider_uprops::create_exportable_properties_provider(
Box::new(icu_provider_uprops::create_exportable_provider(
&uprops_root,
)?),
Box::new(HelloWorldProvider::new_with_placeholder_data()),
Expand Down