How to only build/check a single package in OCaml?

128 Views Asked by At

I’m inside a large project with many internal packages. I just want to check/build one of the package. I’ve tried the following while inside the package folder containing the dune file:

  • run dune build @./check
  • the same command but with --root .

the first throws compile errors of packages that depend on the package I’m trying to build/check, which is what I want to avoid, the second one tells me that I’m missing an .opam at the root (duh, since the .opam files of all the internal packages are all dumped at the root of the project, which I’ve now changed)

any idea :D?

1

There are 1 best solutions below

0
On

Citing the documentation of the --only-packages argument from man dune build:

   --only-packages=PACKAGES
       Ignore stanzas referring to a package that is not in PACKAGES. PACKAGES is a
       comma-separated list of package names. Note that this has the same effect as
       deleting the relevant stanzas from dune files. It is mostly meant for releases.
       During development, it is likely that what you want instead is to build a
       particular <package>.install target.

it seems that you can build a single package with dune build <package>.install.