-
Notifications
You must be signed in to change notification settings - Fork 459
Add available field to package spec in dune-project
#8356
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
Conversation
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
This generates the corresponding `available` field when generating the opam file for a package. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
|
I discussed the |
|
Yes, in particular, I never understood the necessity for this construct as opposed to plain old dependencies. Why do we write |
|
Given there is no such package yet, I wonder what @kit-ty-kate thinks about this approach. It would be fairly trivial to implement, essentially just |
I'm not sure to understand. How would such a |
|
@kit-ty-kate This is not about removing |
|
To explain my motivation for adding this, I have a side project which doesn't build on some architectures. To release it to opam-repository I need to add an |
|
Also once dune starts doing package management it's going to become really important to keep the dependencies in dune-project the same as the dependencies in opam files and if opam files aren't generated from dune-project then manually synchronizing dependencies between dune-project and opam is another thing I will forget to do when releasing new versions of my library. I guess alternative would be for me to make a separate tool which auto-generates opam files from dune-project and stop checking in the opam files but that seems like a waste of effort since dune can almost do what I need. |
|
Also I get that I could possibly technically simulate
|
|
@gridbugs The other option to use .opam.template and write your I don't think maintaining But I think @kit-ty-kate @rgrinberg and I have come up with a pretty decent idea on our call yesterday. It would be implementing |
|
Here's a list of criteria to consider for adding something to a dune-project:
So in summary, I'm not completely against this feature, but it does raise a few questions with regards to these points that need some consideration. |
|
The criteria makes sense and I can see the argument for using One point of confusion was that in my experience using dune the only reason I've ever added dependencies to dune-project was so that dune could generate an opam file. This along with the fact that many other opam fields can go in dune-project led me to expect With this in mind what if we get dune to recognize the |
My concern with traversing the project to find all its To simplify the behaviour of generating
|
That would be a useful feature. |
|
You're on the right track with your suggestion of deriving
I would lean towards using the same name. It's used for the exact same thing, so why introduce another name? If there are some limitations on the generated Instead of checking the toplevel
We have instances where we follow both schemes in the rules already. |
|
Superseded by #12905 |
This PR brings back #8356. It's clear that there's a need for this construct, but I felt that the PR had some shortcomings that had to be addressed, and I've attempted to do so here. The following changes were made to make this feature make more sense in the context of dune's other features: 1. First, the field is renamed to `enabled_if`. This is inconsistent with opam, but is consistent with the rest of dune, which I deem as much more important. Second, the syntax is switched to pforms. Again, dune already has its own syntax for this stuff and we might as well reuse it. 2. The field is given meaning independently of opam. It is interpreted exactly as `--only-packages` is. Packages which are "disabled" are essentially masked off the build, which I think is a fairly intepretation. 3. I've added proper validation to this field to avoid users writing any garbage they want. One important possibility for improvement is giving user proper error messages when packages are unavailable. I'm leaving that for future work as dune doesn't handle this properly in many other places already. --------- Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
This lets you generate an opam file with an
availablefield.