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

Move the baked exporter into its own crate #5009

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented Jun 5, 2024

#4721

The icu_provider_datagen crate can be a runtime dependency for baked data, in order to expose dependencies that are required for databake operation (I'm thinking zerotrie and writeable).

The former icu_datagen::baked_exporter module is this new crate's exporter module, behind an export feature, analogous to icu_provider_blob and icu_provider_fs.

This is also a better home for the test-baked-source test, because in icu_datagen, if the baked source wouldn't build, make-testdata also wouldn't, which is annoying (@younies).

@robertbastian robertbastian changed the title Splitting the registry, baked exporter, and binary from datagen crate Move the baked exporter into its own crate Jun 5, 2024
@robertbastian robertbastian force-pushed the bkd branch 7 times, most recently from c1de915 to 62f63f5 Compare June 6, 2024 15:53
@robertbastian robertbastian marked this pull request as ready for review June 7, 2024 08:33
@robertbastian robertbastian requested review from Manishearth, sffc and a team as code owners June 7, 2024 08:33
#[cfg(feature = "export")]
pub mod export;

pub use icu_provider::prelude::*;
Copy link
Member

Choose a reason for hiding this comment

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

question: why do we need this?

also is this crate useful outside of the export mode? it doesn't seem to contain much otherwise, should it be called baked_exporter instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to expose zerotrie through it in the next PR.

The prelude export I didn't end up using, but I might change that.

Copy link
Member

Choose a reason for hiding this comment

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

Who would depend on this in non exporter contexts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Baked data users, like all our _data crates.

Copy link
Member

Choose a reason for hiding this comment

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

I kinda would like those crates to have minimum deps, so they should depend on zerotrie directly and not a re-export from here.

Unless this crate exports something built on top of ZT then I guess that's fine.

But given that these are weird crates that get replaced in places like Google3, having zero deps is really good for them

cc @sffc for thoughts

Copy link
Member

Choose a reason for hiding this comment

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

I think I prefer component compiled data depending directly on what it needs; also note that we can't re-export utils from here, at least not publicly, because they have a 0.x semver.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well we can. Either we keep the policy that baked data needs to be generated with the same minor version, then this is fine, or we commit to stability in 2.0, then this is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, ~ deps can resolve this.

use icu_provider::prelude::*;

#[cfg(feature = "export")]
pub fn bake(
Copy link
Member

Choose a reason for hiding this comment

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

Thought: I'm happy that we can move more common runtime baked data code into this crate.

#[cfg(feature = "export")]
pub mod export;

pub use icu_provider::prelude::*;
Copy link
Member

Choose a reason for hiding this comment

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

Ok, ~ deps can resolve this.

Note: the path in `ICU4X_DATA_DIR` is relative to `provider/baked/*/src/lib.rs` and it causes VSCode to build ICU4X with only the `und` locale. This reduces build times but also makes some tests fail; to run them normally, run `cargo test --all-features` on the command line.
Note: the path in `ICU4X_DATA_DIR` is relative to `provider/data/*/src/lib.rs` and it causes VSCode to build ICU4X with only the `und` locale. This reduces build times but also makes some tests fail; to run them normally, run `cargo test --all-features` on the command line.
Copy link
Member

Choose a reason for hiding this comment

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

Thought: This rename is going to cause annoying conflicts

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack. icu_provider_baked should have the provider/baked directory though, and I'd rather not sprinkle the data crates in there as well.

@sffc
Copy link
Member

sffc commented Jun 11, 2024

Please re-run CI against latest main before merging.

@sffc sffc closed this Jun 11, 2024
@sffc sffc reopened this Jun 11, 2024
@robertbastian robertbastian merged commit ae32da1 into unicode-org:main Jun 11, 2024
54 checks passed
@robertbastian robertbastian deleted the bkd branch June 11, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants