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

Baked data for icu_plurals, icu_timezone #3462

Merged
merged 19 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ jobs:
with:
key: download-cache
path: /tmp/icu4x-source-cache
- name: Install rustfmt
run: rustup component add rustfmt

# Actual job
- name: Run `cargo make ci-job-full-datagen`
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ members = [
"components/locid_transform",
"components/locid",
"components/normalizer",
"components/plurals/data",
"components/plurals",
"components/properties",
"components/segmenter",
"components/timezone/data",
"components/timezone",
"experimental/bies",
"experimental/casemapping",
Expand Down
1 change: 1 addition & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ dependencies = [
description = "Run full data generation on latest CLDR and ICU"
category = "CI"
dependencies = [
"bakeddata-check",
"full-data",
]

Expand Down
3 changes: 3 additions & 0 deletions components/plurals/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ zerovec = { version = "0.9.4", path = "../../utils/zerovec", features = ["yoke"]
databake = { version = "0.1.3", path = "../../utils/databake", features = ["derive"], optional = true}
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }

icu_plurals_data = { path = "data", optional = true }

[dev-dependencies]
criterion = "0.4"
icu = { path = "../icu" }
Expand All @@ -53,6 +55,7 @@ serde = ["dep:serde", "zerovec/serde", "icu_locid/serde", "icu_provider/serde"]
datagen = ["serde", "zerovec/databake", "dep:databake"]
experimental = []
bench = ["serde"]
data = ["dep:icu_plurals_data"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted elsewhere, we need to bikeshed the feature name (not a landing blocker)


[lib]
path = "src/lib.rs"
Expand Down
5 changes: 2 additions & 3 deletions components/plurals/README.md

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

28 changes: 28 additions & 0 deletions components/plurals/data/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is part of ICU4X. For terms of use, please see the file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, you implemented separate crates but distributed them inside the individual components instead of in a centralized location

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please not block on where in the repo these will live

# called LICENSE at the top level of the ICU4X source tree
# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
[package]
name = "icu_plurals_data"
version = "0.0.0"
description = "Data for the icu_plurals crate"
rust-version = "1.61.0"
authors = ["The ICU4X Project Developers"]
edition = "2021"
readme = "README.md"
repository = "https://github.com/unicode-org/icu4x"
homepage = "https://icu4x.unicode.org"
license = "Unicode-DFS-2016"
categories = ["internationalization"]
# Keep this in sync with other crates unless there are exceptions
include = [
"data/**/*",
"src/**/*",
"examples/**/*",
"benches/**/*",
"tests/**/*",
"Cargo.toml",
"LICENSE",
"README.md"
]

[dependencies]
51 changes: 51 additions & 0 deletions components/plurals/data/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE

See Terms of Use <https://www.unicode.org/copyright.html>
for definitions of Unicode Inc.’s Data Files and Software.

NOTICE TO USER: Carefully read the following legal agreement.
BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT.
IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
THE DATA FILES OR SOFTWARE.

COPYRIGHT AND PERMISSION NOTICE

Copyright © 1991-2022 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in https://www.unicode.org/copyright.html.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that either
(a) this copyright and permission notice appear with all copies
of the Data Files or Software, or
(b) this copyright and permission notice appear in associated
Documentation.

THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.

Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.


Portions of ICU4X may have been adapted from ICU4C and/or ICU4J.
ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others.
7 changes: 7 additions & 0 deletions components/plurals/data/README.md

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

10 changes: 10 additions & 0 deletions components/plurals/data/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// 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 ).

fn main() {
if std::env::var("ICU4X_DATA_DIR").is_ok() {
println!("cargo:rustc-cfg=icu4x_custom_data");
}
println!("cargo:rerun-if-env-changed=ICU4X_DATA_DIR");
}
24 changes: 24 additions & 0 deletions components/plurals/data/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"keys": {
"Explicit": [
"plurals/ordinal@1",
"plurals/cardinal@1"
]
},
"locales": {
"CldrSet": [
"modern"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to discuss the CldrSet to use (doesn't need to block this PR)

]
},
"cldr": "Latest",
"icu_export": "Latest",
"segmenter_lstm": "Latest",
"export": {
"Baked": {
"output_path": "data",
"use_separate_crates": true,
"pretty": true
}
},
"overwrite": true
}
2 changes: 2 additions & 0 deletions components/plurals/data/data/any.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @generated
impl_any_provider!(BakedDataProvider);
11 changes: 11 additions & 0 deletions components/plurals/data/data/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @generated
#[macro_use]
#[path = "macros/plurals_cardinal_v1.data.rs"]
mod plurals_cardinal_v1;
#[doc(inline)]
pub use __impl_plurals_cardinal_v1 as impl_plurals_cardinal_v1;
#[macro_use]
#[path = "macros/plurals_ordinal_v1.data.rs"]
mod plurals_ordinal_v1;
#[doc(inline)]
pub use __impl_plurals_ordinal_v1 as impl_plurals_ordinal_v1;
Loading