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

Pre-generate tables.rs instead of doing it in build.rs? #7

Closed
NobodyXu opened this issue Apr 28, 2023 · 3 comments · Fixed by #8
Closed

Pre-generate tables.rs instead of doing it in build.rs? #7

NobodyXu opened this issue Apr 28, 2023 · 3 comments · Fixed by #8

Comments

@NobodyXu
Copy link
Contributor

NobodyXu commented Apr 28, 2023

Generating tables.rs requires unicode-linebreak to pull in regex and hashbrown as build-dependencies, plus running the generation at compile-time, which makes compilation a lot slower.

Since LineBreak.txt doesn't change that often, generating it manually won't make it much harder to maintain,

I can submit a PR to convert the build.rs to a separate crate that is never published and can be run locally to consume the LineBreak.txt and generate src/tables.rs, does it sound good to you?

If you insist on keeping the build.rs, it might be a good idea to switch to regex-lite rust-lang/regex#961

@axelf4
Copy link
Owner

axelf4 commented May 3, 2023

I can submit a PR to convert the build.rs to a separate crate that is never published and can be run locally to consume the LineBreak.txt and generate src/tables.rs, does it sound good to you?

Sure!, as long as it does not entail checking in the generated src/tables.rs into source control. (I think that should be avoidable by adding it to both .gitignore and the include field in Cargo.toml?)

@NobodyXu
Copy link
Contributor Author

NobodyXu commented May 3, 2023

Sure!, as long as it does not entail checking in the generated src/tables.rs into source control. (I think that should be avoidable by adding it to both .gitignore and the include field in Cargo.toml?)

Yes, that's doable.
I will submit a PR for this.

@BurntSushi
Copy link

Can you say why you don't want to check the generated tables into source code? I do it for all my crates, like regex-syntax and bstr. It's the best of both worlds: you don't need to pass on your build-dependencies and you don't need any bespoke build instructions and you don't need to do things like cargo publish --allow-dirty. It's just cargo build and everything works.

@axelf4 axelf4 closed this as completed in #8 Jul 16, 2023
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 a pull request may close this issue.

3 participants