-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feat: optional feature support in resolvo #105
Conversation
This reverts commit 0426ba3.
…for the conditions.
…o have multiple clauses per version
Im stuggling a bit to review this PR while the changes from conditional dependencies are also here. So I'll do a proper review later. I quickly looked through the tests to understand the behavior but could not find any. Is it correct that you have no tests for extras yet? I highly recommend that you start doing more test-driven development and coming up with edge cases. I also would like to see the conflict reports that some tests result in. How are extras currently assigned a value? In the API I can see that a condition may also include an extra which as far as I understand it means that "if the extra is true" the requirement must be met. E.g. It feels to me like we are adding a lot of complexity with this feature but I feel like we could capture this behavior and conditional dependencies in a similar way. E.g. both semantically and in SAT terms, conditional dependencies and extras are very similar. We have the conditions on other dependencies (or versionsets) and we have conditions on whether a specific extra is selected for a package. Both of these can be expressed as another boolean expression. Although I think its nice if the API is explicit about the different features, I dont think the clauses need to be like that. If we would write any combination of boolean conditions (package or extra) as a simplified DNF boolean expression we could derive any conditional requirement clause from that. E.g. the condition
You would write the requirement that says
Note the 4 clauses from the DNF form. Then also a clause with a condition or without one could look very similar. Ill just leave this braindump here. Food for thought. |
What I had in mind was that this is really done from the rattler side when we are parsing the matchspecs, all of the extra are added as requirements and also the ones in the initial spec are set to true. But also these can be really seen as conditionals as well if while the solving is happening a specific is extra is set to true. So I guess what you are saying does make sense. So what we are looking at is essentially a way of having a clause that looks like |
Closing this as the support for extras is also being added in #101 |
This adds support for optional features in resolvo on top of conditionals. Hence, I think it's better to merge the conditionals first and then move on to this one.
I added 2 new clauses:
which are then mapped properly to the correct set of conditionals or extras enabled.
Also, this is how requirements are shown now:
Adding support for record datas with below spec
Becomes much easier with this format.