I have a dune Cram test which optionally depends on a package foo, so that when foo gets updated, the test re-runs:
(cram
(deps (package foo)
)
It does not strictly require foo to be installed. However, written as it is, if foo is not available, dune runtest will fail with:
Error: Package foo does not exist
How can I tell Dune to just ignore the dependency if the package does not exist?
If I use (enabled_if %{lib-available:foo}), the test will be disabled in its absence, which is not what I want.
I believe I could duplicate the test, by adding:
(cram
(enabled_if %{lib-available:foo})
(deps bar baz (package foo))
)
(cram
(enabled_if (not %{lib-available:foo})
(deps bar baz)
)
But that would double the size of my dune file, so I’d prefer a more elegant solution…