We’ve just made a new release of cabal-buck2, the Cabal extension that lets you use Buck2 as the build system for a Cabal project. There are some fairly major improvements in this release:
- Most notably, thanks to @michaelpj, Buck2 can now compile modules separately instead of using
--make, unlocking significant extra parallelism including across package boundaries. We provide a GHC worker that caches and shareshifiles across compilations, mitigating the extra cost of per-module compilation compared with--make. We’re calling this feature experimental for now so it’s not enabled by default, but it’s easy to try it out. See below for some performance results. - The support code is now bundled with
cabal-buck2and unpacked automatically, so there’s no need to manage a separate clone of thehaskell-buck2repo any more. - There are now a couple of Buck2-specific fields in
.cabalfor specifying more accurate dependencies:x-buck2-run-tool-dependsandx-buck2-ignore-build-tool-dependsfor refining Cabal’sbuild-tool-depends,andx-buck2-splice-dependsfor refiningbuild-dependswhen using TemplateHaskell. - Various other changes and fixes described in the changelog.
Here are some build times for compiling HLS, comparing cabal, Buck2 with --make, Buck2 per-module, and cabal repl. The results are for a clean build, and incremental builds that modify something central (hub-api), nothing at all (noop), something central but inconsequential (hub-comment), and a leaf module (leaf).
For HLS, Buck2 is significantly faster than Cabal in all cases, and sometimes even beats cabal repl on recompiles. There are measurements for some other projects in the README.
Please try it out and let us know how you get on!