Copy this template to create a Bazel ruleset.
Features:
Ready to get started? Copy this repo, then
pre-commit install
to get lints (see CONTRIBUTING.md)Optional: if you write tools for your rules to call, you should avoid toolchain dependencies for those tools leaking to all users. For example, https://github.com/aspect-build/rules_py actions rely on a couple of binaries written in Rust, but we don't want users to be forced to fetch a working Rust toolchain. Instead we want to ship pre-built binaries on our GH releases, and the ruleset fetches these as toolchains. See https://blog.aspect.build/releasing-bazel-rulesets-rust for information on how to do this. Note that users who do want to build tools from source should still be able to do so, they just need to register a different toolchain earlier.
---- SNIP ----
From the release you wish to use:
https://github.com/myorg/rules_mylang/releases
copy the WORKSPACE snippet into your WORKSPACE
file.
To use a commit rather than a release, you can point at any SHA of the repo.
For example to use commit abc123
:
url = "https://github.com/myorg/rules_mylang/releases/download/v0.1.0/rules_mylang-v0.1.0.tar.gz"
with a GitHub-provided source archive like url = "https://github.com/myorg/rules_mylang/archive/abc123.tar.gz"
strip_prefix = "rules_mylang-0.1.0"
with strip_prefix = "rules_mylang-abc123"
sha256
. The easiest way to do this is to comment out the line, then Bazel will
print a message with the correct value. Note that GitHub source archives don't have a strong
guarantee on the sha256 stability, see
https://github.blog/2023-02-21-update-on-the-future-stability-of-source-code-archives-and-hashes/