Bazel rules_d: DUB support and BUILD generation with gazelle_d

Dragos Carp dragoscarp at gmail.com
Tue Jun 2 22:25:51 UTC 2026


Hi all,

Bazel [`rules_d`](https://registry.bazel.build/modules/rules_d) 
now has improved support for DUB-based projects, and 
[`gazelle_d`](https://registry.bazel.build/modules/gazelle_d) can 
generate Bazel BUILD files for D code.

For simple DUB dependencies this should work out of the box. For 
more complicated projects, it can also help surface issues that 
Bazel requires you to model explicitly, such as dependency cycles.

A useful side effect is strong C++ interoperability: `rules_d` 
links D binaries and tests through the C++ linker, so mixed D/C++ 
projects are a natural fit.

The new tutorial covers setup, DUB dependency locking, 
`@dub//...` package labels, and BUILD generation with 
`gazelle_d`: [Using `rules_d` from a DUB 
project](https://github.com/bazel-contrib/rules_d/blob/main/docs/dub.md)

Feedback from people trying this on real DUB projects would be 
very welcome.


More information about the Digitalmars-d-announce mailing list