Using Bzlmod with Bazel 7 or greater
Add to your MODULE.bazel
file:
bazel_dep(name = "rules_d", version = "0.1.3")
d = use_extension("//d:extensions.bzl", "d")
d.toolchain(d_version = "auto")
use_repo(d, "d_toolchains")
register_toolchains("@d_toolchains//:all")
Using WORKSPACE
Paste this snippet into your WORKSPACE.bazel
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_d",
sha256 = "ff319cd559bcae5adfd113f882717ac90342fac48c655a75fd67f50b1ee93566",
strip_prefix = "rules_d-0.1.3",
url = "https://github.com/bazel-contrib/rules_d/releases/download/v0.1.3/rules_d-v0.1.3.tar.gz",
)
######################
# rules_d setup #
######################
# Fetches the rules_d dependencies.
# If you want to have a different version of some dependency,
# you should fetch it *before* calling this.
# Alternatively, you can skip calling this function, so long as you've
# already fetched all the dependencies.
load("@rules_d//d:repositories.bzl", "d_register_toolchains", "rules_d_dependencies")
rules_d_dependencies()
d_register_toolchains(
"d_toolchain",
d_version = "auto",
)