Unify package build progress messages with regular dune build progress messages
Currently when building packages with dune, progress messages are always reported in a similar style to the messages printed by dune build --progress=short. Package build progress messages are disabled by default and can be enabled by setting the environment variable DUNE_CONFIG__PKG_BUILD_PROGRESS=enabled.
Some example messages:
Building ocaml-base-compiler.5.2.0
Building ocaml-config.3
Building ocaml.5.2.0
Building base-unix.base
Building csexp.1.5.2
There are two issues with this.
- Package build progress messages don't respect the
--displayargument; they look similar to--display=shortbut print like this even when dune is passed--display=quiet(which is the default). - When building with
--display=short, the regular build messages interleave with the package build progress messages in a way that mixes levels of abstractions. For example:
Building cmdliner.1.3.0
make default/.pkg/ocamlbuild/target [_private]
Building topkg.1.0.7
make default/.pkg/cmdliner/target [_private]
make default/.pkg/cmdliner/target [_private]
make default/.pkg/cmdliner/target [_private]
dune default/.pkg/base/target [_private]
ocaml default/.pkg/topkg/target [_private]
Building stdlib-shims.0.3.0
Building re.1.12.0
Building ocaml-syntax-shims.1.0.0
Building astring.0.8.5
Building fmt.0.9.0
Building uutf.1.0.3
Building uucp.15.1.0
dune default/.pkg/stdlib-shims/target [_private]
dune default/.pkg/ocaml-syntax-shims/target [_private]
dune default/.pkg/re/target [_private]
ocaml default/.pkg/uutf/target [_private]
ocaml default/.pkg/fmt/target [_private]
ocaml default/.pkg/astring/target [_private]
ocaml default/.pkg/uucp/target [_private]
In this example the lines beginning with Building refer to a package being built, while the lines beginning with make, dune and ocaml refer to commands being executed during the build. It's not obvious that displaying both types of messages at once is helpful to users.
Printing package build progress is useful as it's a more accurate measure of build progress than the Done: x% message, as that tends to sit above 90% for the majority of the build. This seems to be a different use case than --display=short which gives lower-level details about the files being compiled and commands being run. Therefore I don't think it makes sense to restrict package build progress messages to only when dune is passed --display=short. However since it's still more verbose that the output of --display=quiet I'm not sure whether it's correct to always print package build progress messages either.