Allow_empty in dune

My package builds correctly on my dev system, but today I tried for the first time to build it in hosted CI, and I get this from dune build:

Error: The package ocinco does not have any user defined stanzas attached to
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file

In grand old dune fashion, the online doc says nothing about this …

I must add that dune then proceeds to do the build, but this makes my build script to fail.

Here’s the entire dune-project file:

(lang dune 3.4)

(name ocinco)

(generate_opam_files true)

(source
 (gitlab nobrowser/ocinco))

(authors "Ian Zimmerman <itz@no-use.mooo.com>")

(maintainers "Ian Zimmerman <itz@no-use.mooo.com>")

(license ZPL-2.1)

(documentation https://very.loosely.org/loosely-doc/ocinco)

(package
 (name ocinco)
 (synopsis "Parser / decoder / converter for JSON5")
 (description "A library for decoding the JSON5 format, specified here: https://spec.json5.org/")
 (depends
   ocaml
   dune
   ppx_deriving
  (uucp (>= 15))
  (sedlex (>= 3.0))
  (fmlib (>= 0.5.1)))
 (tags
  (json5 parsing)))

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project

The source and doc URLs are wrong, but that shouldn’t matter if I’m not in fact running opam?


Ian

Does the package install anything, though? You might find that opam install . on your dev system doesn’t install any libraries or executable files.

I’m afraid I don’t understand. I don’t run opam as part of the build at all, only in the setup step to install dependencies. I am just trying to test the build (and runtest) at this time. So to answer you literally (without understanding), no, I don’t install anything - I don’t even try to.


Ian

A CI will typically test that your package installs something, so if your package doesn’t then CI is likely to report that as an error. Though of course it depends how your CI is set up.

This was a dune issue, I’m sure of it (or TBF an issue with my project that dune triggered).

Right now, I solved it by adding (generate-opam-files false) and removing all public-name clauses from my dune files. When the time comes to actually build an opam package I’ll revisit it, including the question if I should keep dune as the build system at all.


Ian