It is my pleasure to announce the first official release of dk0. It is a build system with the following features:
- Written in OCaml with minimal dependencies. Its C code is portable (no depext). The main OCaml dependencies are fmlib-parse and spawn.
- Language agnostic like Bazel/Buck2.
- Repeatable builds (my made-up term for a weak form of reproducible builds).
- Lua scripting for build rules. The Lua implementation is pure OCaml and extends Lua-ML (thanks @lindig et al). In
dk0Lua plays the same role as Starlark in Bazel and Buck2. - Dynamic dependencies. This is somewhat esoteric for build systems but important for some languages (OCaml, C++20).
- Single file scripts. Think
uvbut for arbitrary languages. - Multi-platform federated binary caching with indexed downloads. Think
nixbinary package caching, but each package can do its own caching in GitHub Actions / etc. - Attestations (security)
But repeatable builds means repackaging common system packages (git, tar, etc.) and providing build rules for compilers (msvc, clang, ocamlopt, etc.). That is a difficult, time-consuming assignment, especially when packaging for multiple operating systems (Windows, macOS and Linux).
Status:
- dk0 is ready enough for making useful packages. However, a few backwards incompatible changes still need to be made and that might require tweaks to packages.
- Today I have a couple packages; realistically there needs to be 20-30 packages to be useful. OCaml in particular will need a lot of packages that do not exist today.
- When I complete a new package I’ll post an
[ANN]similar to new opam packages.
Docs:
- spec: dk/docs/SPECIFICATION.md at V2_5 · diskuv/dk · GitHub
- site: GitHub - diskuv/dk: A build system.
On the “site” link above you’ll see an example for a single-file script with C# / .NET … that example exists because I needed the script but more importantly because .NET has minimal transitive dependencies. If development goes well I’ll replace that with a more useful example that builds a Windows OCaml executable on macOS/Linux (using build rules that download/run wine, msvc, etc.).
If you are interested in contributing packages, I can setup video or audio time to get you or a group started quickly.
Lastly, I happen to like Dune (especially its watch mode) and the simplicity of Alice. Obviously I wouldn’t have made dk0 if I didn’t need to go beyond what exists today, but dk0 is open-source (libraries are Apache-2.0, executable is OSL-3.0) … I hope libraries can be shared across the different build systems! And because dk0 has dynamic dependencies, it is straightforward for dk0 to wrap other build systems (that is what I did with the .NET build system).
Thanks, Jonah