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

gitoxide requires miniz_oxide even when building with libz-ng #1210

Open
joshtriplett opened this issue Dec 24, 2023 · 4 comments
Open

gitoxide requires miniz_oxide even when building with libz-ng #1210

joshtriplett opened this issue Dec 24, 2023 · 4 comments
Labels
acknowledged an issue is accepted as shortcoming to be fixed help wanted Extra attention is needed

Comments

@joshtriplett
Copy link
Sponsor Contributor

joshtriplett commented Dec 24, 2023

Even when building with libz-ng, gitoxide still has miniz_oxide in its dependency tree (by way of flate2), and cargo ends up having to compile it. This is visible via cargo tree and the build logs from cargo.

This may be difficult to fix, as it's not trivial to say "use this only if that isn't set". But it'd be worth attempting to fix somehow, to eliminate the dependency and its compilation time.

@Byron Byron added acknowledged an issue is accepted as shortcoming to be fixed help wanted Extra attention is needed labels Dec 24, 2023
@Byron
Copy link
Owner

Byron commented Dec 24, 2023

Thanks for bringing this up!

I vaguely remember thinking that flate2 is built so that the default backend can be activated (and therefore will be built) even while additional backends are selected, like zlib-ng. This is helpful as it adds flexibility, but leads to overhead.

I wish that one day there is tooling that helps to manage and maintain the nightmarish complexity of all the features in this project, even though I have little hope 😅.

@joshtriplett
Copy link
Sponsor Contributor Author

@Byron It's possible to build flate2 and libz-sys without the default backends. The problem is, it's difficult to expose that via gix features in a way that doesn't have the same feature structure the underlying crates do: a pair of features such that if you don't enable either you get a build error. Ideally you'd be able to say "if X is enabled, Y should be disabled", but that's not possible with cargo features.

@NobodyXu
Copy link
Contributor

NobodyXu commented Jan 2, 2024

Ideally you'd be able to say "if X is enabled, Y should be disabled", but that's not possible with cargo features.

More like cargo needs sum-type/enum in the feature system:

[features."flate-backend"]
choices = ["minoz", "libz", "libz-ng"]

@weihanglo
Copy link
Contributor

Another way to manage this is to have all dependencies specified under workspace.dependencies with default-features = false, so we'll have a (slightly) better view when a feature is really needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged an issue is accepted as shortcoming to be fixed help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants