Does anyone have a solution for this scenario:
I am building an OCaml library, nothing exciting.
I have some tests for the library, the tests use some test-only deps (e.g. Popper)
I want to be able to:
- install just the base lib deps and run
dune buildto build just the base lib - install the test deps and run
dune test
So far it seems like these goals are mutually exclusive.
I can add :with-test markers in dune-project to separate the deps into a group that has to be installed with --with-test flag. That covers the opam install separation, but dune build still tries to build the tests.
The generated mylib.opam file has an entry like:
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
ā¦which makes clear why tests are included.
So I had a chat with an agentā¦
It said I can do dune build -p mylib @install to build just the base lib without tests. Ok, but Iād like to be able to just do dune build for the base case, and then add args to apply other cases.
Next it gave me profiles, so now dune-project has:
(test
(name mylib)
(build_if
(= %{profile} test))
...
and this lets me do dune build without test deps installed.
But now I have to dune test āprofile test to run the tests. Feels redundant.
I realise this isnāt the end of the world, but I feel like I should be able to configure dune test to work without extra args.
The agent says it isnāt possible to have both properties that I want though.
Or any wizards out there have a solution for this?