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

Turn bin/lib into subcrates within workspace? #1970

Closed
Kixunil opened this issue Jan 13, 2021 · 6 comments
Closed

Turn bin/lib into subcrates within workspace? #1970

Kixunil opened this issue Jan 13, 2021 · 6 comments

Comments

@Kixunil
Copy link

Kixunil commented Jan 13, 2021

Bindgen is both library and binary but binary requires certain features which are not needed in build scripts (mainly clap). This is handled by features but because of the way features work in Cargo they are turned on by default. This is a footgun for every library author who wishes to use build script as they may forget to turn them on. An example of this case was found in rocksb.

Spliting up library and binary fixes the issue without causing ridiculous compile errors because of missing features.
Alternative: wait eternity until rust-lang/rfcs#3020 is implemented.

@emilio
Copy link
Contributor

emilio commented Jan 14, 2021

Yeah, this is a reasonable idea, but I'm not sure if it's possible without breaking either binary or library users unfortunately, as both crates would have to have the same name...

@Kixunil
Copy link
Author

Kixunil commented Jan 15, 2021

Is your concern that people will run cargo install bindgen and it'll not work? If yes, is this something widely used in automated setups?

@emilio
Copy link
Contributor

emilio commented Jan 15, 2021

Yes, and whether it's widely used, I'm not sure.

@Kixunil
Copy link
Author

Kixunil commented Jan 15, 2021

Perhaps a way to solve it gracefully is to create a new crate called bindgen-bin which would be a copy of [bin] from bindgen. Once it's ready add an unconditional warning to the binary in bindgen saying it's deprecated and users need to switch to bindgen-bin. Then remove it after 6 months or something.

Do you think that could work?

@emilio
Copy link
Contributor

emilio commented Jan 29, 2021

That might be reasonable (sorry for the lag, exams and work :/)

@emilio
Copy link
Contributor

emilio commented Oct 17, 2022

Done in #2284

@emilio emilio closed this as completed Oct 17, 2022
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

No branches or pull requests

2 participants