I have been improving on Jasper Humphrey’s initial dhall integration with bazel and have made quite a few improvements in a fork here: https://github.com/muff1nman/rules_dhall. I think its gotten to a mostly usable state (or at least its not entirely broken) and wanted to share.
There’s a couple of advantages of having dhall integrate with a generic build system like bazel:
- Allows tighter integration into build pipelines with other non-dhall code and allows for glueing dhall with other build processes.
- Can utilize bazels caching/dependency mechanism. While dhall has caching, using something like bazel allows you to fetch a zip/tar of a repository (i.e dhall-kubernetes) in a fraction of the time that it takes for dhall to traverse github’s raw links while getting rate limited.
- Related to the above, it allows a more declarative way of managing dependencies. Instead of having a bunch of
../path traversals, one can utilize bazels target definitions to refer to dhall files in a more root-centric and portable manner (or even across repositories without having to use http within dhall).
Of course with that said there are a couple of rough edges.
- In order to get
freezeto work I have made use of
env:imports that “refer” to bazel dependencies. This makes running dhall without bazel a bit unwieldy. This is worsened by the fact that bazel maintains a separate dhall cache which means your hashed imports don’t resolve. However the one benefit of going this route is that I can “freeze” an entire repository in one script while following the dependency chain - see
tools/freeze-all.sh. Note that this is technically optional (for now) as if you don’t use the bazel freeze targets, things should work fine as they did in the initial version of rules_dhall.
- I’m still working on figuring out a good way to make dhall-docs output a more holistic view of all your dhall “libraries”
- and probably quite a few others that are probably more specific to kubernetes
At any rate, let me know if you have any questions. I’ll also take any suggestions