-
Notifications
You must be signed in to change notification settings - Fork 182
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
Changes from 7 commits
e2338fd
e99a921
c7128fd
2e5ef2d
63be9f0
961b6c1
a8983bf
9e3612a
60191cf
9004450
186f0f7
574f68d
524d04c
6e265e1
13399cc
c87537c
526634b
9648532
5eaf807
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 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() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: really not a fan of introducing more build scripts; they're a pain for non-Cargo users, and people in general do not like them. Would prefer the crate based solution There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the issue we decided
There's no way to do defaulting env vars without build scripts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does a separate crate solve this? It would only move the problem, you'd still have a build script there. It would also introduce another problem around semver, we'd need to use a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. I was under the impression we were still considering doing crates. I think crate replacement works out far easier. I would ideally like a non-build-script ICU4X to still work with the data feature. To do this you'd have to use a
This means code using build scripts needs to set an env var and a CFG, but that's not an undue burden IMO. (If we're not doing crates, we don't really need macros anyway, right?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll try the
We do for cross-crate dependencies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could actually do this without a build script if we had a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah dueling features are annoying There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two separate discussions in this thread. Custom globaldata path: In #2992 I proposed the dual features approach, but I like the Macros in crates: Unless my assumptions are wrong, I see it as a non-starter to call macros in crates they don't belong to. It makes the crates heavier and much more difficult for DCE. There are a couple solution we discussed previously:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now thinking of it, it's really not correct that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We seem to agree on the Custom globaldata path issue, and Macros in crates is not a discussion we need to have on this PR. I'm not calling macros from other crates. |
||
if std::env::var("CARGO_FEATURE_DATA").is_ok() { | ||
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"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
robertbastian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"keys": { | ||
"Explicit": [ | ||
"plurals/ordinal@1", | ||
"plurals/cardinal@1" | ||
] | ||
}, | ||
"locales": { | ||
"CldrSet": [ | ||
"modern" | ||
] | ||
}, | ||
"cldr": "Latest", | ||
"icu_export": "Latest", | ||
"segmenter_lstm": "Latest", | ||
"export": { | ||
"Baked": { | ||
"output_path": "data", | ||
"use_separate_crates": true | ||
} | ||
}, | ||
"overwrite": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @generated | ||
impl_any_provider ! (BakedDataProvider) ; |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @generated | ||
include ! ("macros.rs") ; # [clippy :: msrv = "1.61"] pub struct BakedDataProvider ; impl_data_provider ! (BakedDataProvider) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (nb, followup):
data
feels very generic to me and calling it globaldata might helpThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really "global" though, it's just for this crate. If data is too general, I'd prefer "builtin-data".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me
I think we've been calling it globaldata with global being real-world global
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it should be
moderndata
:)