I’m wondering whether it’s possible to have a dune stanza or rule depend on the profile being used.
The use case is as follows: I want to introduce some automatic checks in my build process when using the dev profile. However, I want to disable them when distributing the software (with opam and the release profile).
I may have missed it, but I could not find any hint to achieve this in the dune documentation.
The simplest way is to check for the profile in the action that does your check:
(rule
(alias check) ;; or whatever alias you have here
(deps (universe)) ;; specify your dependencies correctly here
(action (run checker %{profille})))
Then checker should do nothing if %{profile} is dev.
It even seems that the enabled_if optional field is also available for the rule stanza since 1.4 (this feature does not seem to appear in the documentation, so I don’t know whether it is stable).