nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
364 stars 86 forks source link

Honor `foo?/bar` feature selections #265

Closed tilpner closed 1 year ago

tilpner commented 1 year ago

This PR adds support for the new-ish foo?/bar feature selection syntax (1.60+, documentation). The time crate wasn't compiling anymore after upgrading to version 0.3.17, and this change fixes compilation in the one project I've tested this with.

Ericson2314 commented 1 year ago

Looking good, but can you add a test for this?

tilpner commented 1 year ago

I've added something, but it should check that the optional crate is not being built in the ["foo", not "hello"] case, instead of just printing something different (not sure how to fit that into the testing setup).

Ericson2314 commented 1 year ago

See https://github.com/kolloch/crate2nix/blob/master/sample_projects/empty_cross/src/lib.rs (but without the crazy no_core stuff).

You can set a dont_build feature manually that would make optional fail to build, and then see if the downstream one nonetheless builds.

tilpner commented 1 year ago

ahh, good idea, that should work

Ericson2314 commented 1 year ago

Thanks so much! The last thing is adding a new change log entry. You can do it in a new 0.11 -- 0.12 section because I just made a release candidate for 0.11.

tilpner commented 1 year ago

Does this look right? It looks a bit wrong, starting with two (not released) sections

Ericson2314 commented 1 year ago

That's right! Once 0.10 is released it will look better :).

natto1784 commented 1 year ago

finally, thanks a lot!

lblasc commented 1 year ago

you saved my day :) thanks!