How-To: Buck 2 and OCaml - Build system

If you are just building OCaml locally: not much, you mainly lose the hidden magic Dune does (for example with modules, PPX, inline test runners, …) - if this is an advantage or disadvantage of Buck 2, you must decide for yourself ;). And if you do not use Dune, you need a .merlin file for your project’s sources, for Merlin and/or the OCaml LSP: Project configuration · ocaml/merlin Wiki · GitHub

The main advantages of Buck 2: support for many (not as much out of the box yet as Bazel) languages and distributed builds. I’m (officially :wink: mainly a C and C++ developer, and have used Makefiles (POSIX, BSD, GNU, NMake), Autoconf/Automake, IMake, CMake, QMake and some others I’ve forgotten about. I also have a bit of Typescript for some Websites and Rust and Python to build.

All supported languages (everybody can add language support there) are in the Buck 2 Prelude

Buck 2 uses the Remote Execution Protocol (like Bazel), so you can use for example use
BuildBuddy - Buck 2 BuildBuddy Examples
or
Buildbarn - Buck 2 Buildbarn Exmples
for distributed builds.

Information about Bazel: OBazl Toolsuite - tools for building OCaml with Bazel

2 Likes