rules_dx is a Bazel developer platform with one dx CLI for
build, test, lint, typecheck, format, generate, audit, and release tasks.
Language toolchains come from Bazel. No separate installs.
Status: rules_dx is not released yet. Install starts with the first BCR release.
Bazel via Bazelisk is required. In an empty directory, create four files.
.bazelversion:
9.2.0
MODULE.bazel:
bazel_dep(name = "rules_dx", version = "<release>")BUILD.bazel:
# Empty on purpose: rules_rust crate_universe needs a root package..bazelrc:
common --repo_env=DO_NOT_TRACK=1
Then:
bazel run @rules_dx//:dx -- init --apply
tools/dx test //...After that, run dx through the launcher:
tools/dx --help
tools/dx build //...Behind a proxy or a company CA? See Corporate proxy and custom CA.
In your module, @rules_dx//:dx will run the dx binary for the target
platform, checked against the sha256 in cli/prebuilt/pins.bzl.
Release binaries are planned for linux x86_64, linux aarch64, macos aarch64,
windows x86_64 and windows aarch64. Until a release ships, a version with no
pinned sha256 builds dx from source, with the Rust and C toolchains
dx init sets up. Once some binary is pinned, platforms with no release
binary fail the build. To pick a binary yourself, add this to your root
MODULE.bazel:
dx_prebuilt = use_extension("@rules_dx//cli/prebuilt:extension.bzl", "dx_prebuilt")
dx_prebuilt.asset(name = "dx-linux-x86_64", url = "https://...", sha256 = "...")Or build dx from source with dx_prebuilt.from_source(). That needs Rust
and C toolchains. Only the root module's tags count.
dx init --apply writes the overrides rules_dx needs; see
patches/README.md.
A global dx shim for PATH is built from //cli/shim. It runs the version in
.dx/pins without Bazel. See
Global Shim.
tutorial, docs index, Bazel for dx users, adopting rules_dx in an existing Bazel repo, adopting rules_dx without Bazel experience, command reference, examples, CI, support matrix, and the docs site.
You get:
- One
dxCLI instead of per-language scripts. - Pinned toolchains, so nobody installs tools per machine.
- Lint, format, and typecheck locally and in CI.
- Security and license audits with
dx securityanddx license; see audit and update. - A CI workflow from
dx init --apply; see init. - It replaces hand-picked rule-set versions, a Makefile or shell wrapper around Bazel, and CI config per language.
It costs:
- Bazel and its learning curve: BUILD files and
MODULE.bazel. - The files
dx initwrites: launcher, editor, devcontainer, CI and agent files; see init. - Following the pinned rule and tool versions. You move when you run
dx upgrade. - Patched upstream overrides that
dx init --applywrites tothird_party/rules_dx/; see rules_dx overrides and patches/README.md.
See Contributing for the current workflow.
rules_dx is licensed under Apache-2.0.