Closed craigfe closed 4 years ago
You can mark the dependencies as {post}
to break the cycles.
depends: "foo" {with-test & post}
there's no fundamental reason to reject these constraints
Not for binary package managers, but we need a well-founded build order to compile the packages; the constraint is actually not with the solver, but checked afterwards by opam.
Flagging such test dependencies with {post}
appears to result in them not being made available when running tests (as I believe has been discussed offline).
This is possibly a duplicate of https://github.com/ocaml/opam/issues/4099, but if not I think it can be re-opened as I don't think Opam currently supports this workflow.
It's occasionally nice to be able to test a package using one or more its rev-deps. This results in a "cyclic" dependency set of the following type:
package
→rev-dep {with-test}
rev-dep
→package
Unfortunately, the Opam solver will reject this set of constraints with an error message like the following:
As I understand it, there's no fundamental reason to reject these constraints (
opam-0install-solver
will accept them). It'd be nice if Opam could support this scenario.To provide some motivation, here's two examples of this pattern happening in the wild:
LIbrary PPXs.
package
is a PPX that provides helper functions for using a particular libraryrev-dep
, and so the PPX depends on the library in test only in order to ensure that the generated code compiles with the library API. Developers ofrev-dep
want to be able to use the PPX when working on the library itself, creating the situation above. (For instance, this blocks usage ofppx_irmin
insideirmin
.)Backend-generic libraries.
package
provides a functorf
parameterised over some signatureS
, and various rev-deps provide instantiations off
for specific backendsS
. When testingpackage
, it's necessary to first instantiate it with a "simple" backendrev-dep
, creating the situation above. (For instance,irmin
end-to-end tests would ideally useirmin-mem
as a reference backend implementation.)