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

Integration tests, refactoring, and powerful feature rule expressions #50

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

demmerichs
Copy link
Contributor

@demmerichs demmerichs commented Sep 5, 2023

The first few commits add integration tests and minor refactoring.
Then there is one larger commit, also just doing refactoring, but using rule-based abstraction for resolving valid feature sets. The rules are constructed from nested logical expressions.
The following commit makes us of this, implements a rule parser on top, which allows us to specify arbitrary rule expressions for filtering the set of feature combinations to try out. I link a few issues that can be handled nicely by these changes, and any future requests for strange feature dependencies should be covered by this.
Finally, I added some more code to give an informing error output in case the set of valid feature sets is empty, so that the user can more easily identify the conflicting rules.

Fixes #25.
Fixes #43.
Fixes #42.
Fixes #12.

…list setting

Even when providing allowlist, using the boolean flag skip_optional_dependencies can be helpful for quickly switching between two behaviors without the need of changing allowlist.

BREAKING CHANGE: Instead of erroring when provided with an allowlist and skip_optional_dependencies, now the optional dependencies will be removed from the allowlist prior to building all feature sets.
…ways_include_features

A skip_feature_set [A,B] together with an always_include_feature A basically turns into a denylist B. However, allowing the first setting, can allow easy testing and switching on and off different settings by only changing always_include_feature without the need of removing skip_feature_sets and adding elements to the denylist.

BREAKING CHANGE: Instead of erroring out when a feature is present in skip_feature_sets and always_include_features, now both settings are taken into account. Note, that this can lead to empty sets, e.g. when both A and B are always included but also provided as skip set.
…e selected feature sets

Fixes frewsxcv#25. Fixes frewsxcv#43.

BREAKING CHANGE: As previously feature sets [B], [A,B] were included separatly, now there will only be [A,B] run if A is a dependency of B. The testcase [B] is redundant, as it activates feature A automatically.
This simplifies future additions of other selection settings.
…fying very general feature set rules

Fix frewsxcv#42. See added tests.
…ighting conflicting rules

BREAKING CHANGE: Instead of not running any feature set, but exiting ok, we now produce an error with a helpful mesage.
@demmerichs
Copy link
Contributor Author

@frewsxcv @Manishearth @robertbastian Is anyone of you still actively maintaining this project?

@robertbastian
Copy link
Collaborator

@frewsxcv is the main owner, Manish and I recently got merge rights for our own changes, but I don't feel comfortable approving such a big change.

@demmerichs
Copy link
Contributor Author

@robertbastian He gave you also maintainer rights on crates.io Are you sure he intended for you to only merge your stuff and not to also help maintain this package? It seems he has been unresponsive for quite some time on this project.

@Manishearth
Copy link
Collaborator

I'm fine with us approving some of this, but in general I would very much prefer this be split into smaller changes that can be landed separately.

@demmerichs
Copy link
Contributor Author

I am happy to split it up into multiple PR, if that is what you mean. Or do you want also the commits to be smaller?
I am also happy to incorporate any feedback, e.g. do you like the rule setting using boolean expressions at all?

@frewsxcv
Copy link
Owner

I'm fine with us approving some of this, but in general I would very much prefer this be split into smaller changes that can be landed separately.

Agreed with Manish, that this is way too big of a PR to review. In the future, if you want to contribute, please discuss with us before making such large changes

@Manishearth
Copy link
Collaborator

Manishearth commented Sep 15, 2023

Multiple PRs, yes. Keep things focused to one thing at a time.

I can't even begin to review the rule changes without this being split up. Likely I would also want to see a rough design before I look at code for that, but that depends on how complex it is.

@demmerichs
Copy link
Contributor Author

@frewsxcv I am sorry if I ran in some doors here, this was not my intention. I am okay with any or all commits being rejected :) The reasons I took this path:

  • I am new at rust and took this as a learning opportunity. If I would have described the idea, I could have not be certain that my skills would be good enough to achieve my goals.
  • It was also interesting for me to learn a bit more about grammar and parser implementation, so I am happy I took a shot at this, even if it might be considered a bit out of scope for this project.

@demmerichs
Copy link
Contributor Author

@Manishearth I will split this up into multiple PRs tonight, the commits before the rule implementation work stand alone and fix I think one or two issues with minimal changes only.

Regarding the rule implementation, it is a standard Pratt Grammar implementation. I am not sure a design layout makes much sense here, but I will try to provide descriptive docstrings for an easier grasping of the functionality.

However, the main goal is documented in a concise way in the README.

Thanks for all the pointers, this is my first bigger commit and I appreciate you helping me to make this PR(s) better :)

@eddyp
Copy link

eddyp commented Sep 29, 2023

@Manishearth I will split this up into multiple PRs tonight, the commits before the rule implementation work stand alone and fix I think one or two issues with minimal changes only.

Any progress on this? This proposal looks like a very nice addition to the tool and would also help in my case.

However, the main goal is documented in a concise way in the README.

Thanks for all the pointers, this is my first bigger commit and I appreciate you helping me to make this PR(s) better :)

For the purpose of increasing the chances to get this accepted, I suggest you copy-paste from the file you linked to above, and add as an initial PR to add the design description accepted in first. Once that is in, the rest of the changes can be split in basic functional bits in separate PRs.

Disclaimer: I am not involved in the project, I'm just trying to help get this in.

@demmerichs
Copy link
Contributor Author

Hi @eddyp thanks for the endorsement.

Any progress on this? This proposal looks like a very nice addition to the tool and would also help in my case.

This is currently in progress. The integration tests got already merged into master, and currently some fixes of existing issues and refactoring are an open PR #52. Feel free to review and comment, I think the maintainers are quite busy and can't go through it right now. It might help if you and me already have iterated that PR to move things along.
BTW: If you need this functionality right away, note that you can have git dependencies in a Cargo.toml and specify this PR as version.
E.g.

[dependencies]
cargo-all-features = { git = "https://github.com/frewsxcv/cargo-all-features", rev = "refs/pull/50/head" }

..., and add as an initial PR to add the design description accepted in first. Once that is in, the rest of the changes can be split in basic functional bits in separate PRs.

Not sure, I got the just of it. Is it common practice to have PRs that are basically empty and just are a room for discussion of design decisions? Wouldn't you use issues for that? Splitting up the functional bits would happen after the current PR gets accepted and I will see how small PRs I can make that still make kind of sense standalone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants