-
Notifications
You must be signed in to change notification settings - Fork 413
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
(optional) in executables doesn't work #5621
Comments
I think you can just add your executable to the install stanza:
But I don't understand why you want an example executables to be built when building the installation artifacts. Seems like you're just slowing down builds for your end users by building unnecessary stuff. If you just need this for CI, just build the executable explicitly with a different target. |
Indeed I don't want it built with just |
So it sounds like you need:
|
How would that work? If I just add the alias to the existing dune file, then |
I'm not sure I understand the issue. The alias above builds |
Here's the full behaviour I want: 1: users can run the example from a checkout:
2: the example executable is never installed
3: the executable is not built unless its package (prometheus-app) is selected:
|
This is the part that I don't understand. If the executable isn't public, why do you insist on building it when the Nevertheless, it's possible to do this:
By the way, your example relies on unstable/undocumented behavior. I assume you meant |
Of course my suggestion above goes against my earlier advice which you seemed to agree with Reading this thread again, I feel like we're going in circles and not communicating our points across. At this point, the most productive thing would be for me to step back and let another maintainer step in and try and help you. |
Reading the thread again, I think I understand the source of confusion. From these statements:
You seem to think that
This command line is only for making releases. It is not for whatever other purpose you might rightfully assume from the suggestive wording (for which I apologize for). To build a particular package you should organize your project such that every package has its own directory. For example, your prometheus project might be as follows:
With this layout, you can now select packages to your heart's content:
Etc. I hope that was helpful. |
This works for manual runs, but I'm looking for something that will work with ocaml-ci. The CI can see from the opam files which packages are compatible with each test platform, and it needs a way to tell dune to build only those packages.
Apart from testing things more on older versions, the more pressing problem is related to OCaml 5. Many projects want to add support for effects (e.g. mirage/ocaml-cohttp#857 adds a |
What are those things? |
Such as an example executable that shouldn't be installed (has no public name). For that, it gives the error:
I guess the problem is that for CI we use |
Work-around for ocaml/dune#5621
This is yet another occurrence of #4065, and I too find myself annoyed by this very issue time and time again. In addition to optionally building example binaries, this also applies to benchmarking binaries, which depend on some benchmarking library that the rest of the package really does not. Moreover, I want the benchmark executable to depend on other libraries that provide similar functionality in order to measure and ensure performance parity. But I absolutely would not want my library to depend on every other library that has similar functionality. Regarding this issue, I would like to repeat and emphasize this comment: #4065 (comment). For the
But in light of #4065 and this issue, that is plainly false. On a non-public Couldn't the semantics of |
Hi, |
It's not ideal, but it might do as a work-around. What I really want is to be able to attach examples to packages, but not have them installed. I can attach a Actually, this seems to solve my problem:
Now:
This is the behaviour I was looking for :-) |
My project has two packages,
prometheus
andprometheus-app
, in one repository.prometheus
can be installed on OCaml 4.03, but prometheus-app requires a later version.For CI, I want to be able to
dune build --only-packages prometheus
on 4.03. However, this tries to build an example that needsprometheus-app
.I tried using:
but that fails with
Adding a
(public_name)
does fix it, but I don't want the example to be installed.I then tried using
(optional)
, but that doesn't seem to have any effect. e.g.I also tried using
(enabled_if "%{lib-available:nosuchlib}%")
, but it says this isn't one of the allowed variables.Expected Behavior
An
(optional)
executable shouldn't be built if something it depends on isn't present.Actual Behavior
Dune tries to build it anyway.
Reproduction
Specifications
dune
(output ofdune --version
): 3.0.3ocaml
(output ofocamlc --version
): 4.14.0The text was updated successfully, but these errors were encountered: