bzl_library.bzl - used by almost all rule sets, and thus requiring especial attention to maintaining backwards compatibility. Ideally, it ought to be moved out of Skylib and and into Bazel's bundled @bazel_tools repo (see https://github.com/bazelbuild/bazel-skylib/issues/127).rules/analysis_test.bzl, rules/build_test.bzl, lib/unittest.bzl; these are under more active development than the rest of Skylib, because we want to provide rule authors with a good testing story. Ideally, these ought to be moved out of Skylib and evolved at a faster pace.Because Skylib is so widely used, breaking backwards compatibility can cause widespread pain, and shouldn't be done lightly. Therefore:
native.foobar() method which was introduced in the latest Bazel pre-release or is gated behind an --incompatible flag, use an if hasattr(native, "foobar") check to keep the rest of your module (which doesn't need native.foobar()) working even when native.foobar() is not available.In addition, make sure that new code is documented and tested.
If a PR adds or changes any docstrings, check that Markdown docs in docs directory are updated; if not, ask the PR author to run ./docs/regenerate_docs.sh. (See https://github.com/bazelbuild/bazel-skylib/pull/321 for the proposal to automate this.)
Release $VERSION
New Features
Incompatible Changes
Contributors
Name 1, Name 2, Name 3 (alphabetically from git log)
version in version.bzl to the new version.bazel build //distribution:bazel-skylib-$VERSION.tar.gzbazel-skylib-$VERSION.tar.gz tarball to the mirror (you'll need Bazel developer gcloud credentials; assuming you are a Bazel developer, you can obtain them via gcloud init):gsutil cp bazel-bin/distro/bazel-skylib-$VERSION.tar.gz gs://bazel-mirror/github.com/bazelbuild/bazel-skylib/releases/download/$VERSION/bazel-skylib-$VERSION.tar.gz gsutil setmeta -h "Cache-Control: public, max-age=31536000" "gs://bazel-mirror/github.com/bazelbuild/bazel-skylib/releases/download/$VERSION/bazel-skylib-$VERSION.tar.gz"
sha256sum bazel-bin/distro/bazel-skylib-$VERSION.tar.gz; you'll need the checksum for the release notes.bazel-skylib-$VERSION.tar.gz to the release. For the release notes, use the CHANGELOG.md entry plus the following template:WORKSPACE setup
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/$VERSION/bazel-skylib-$VERSION.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/$VERSION/bazel-skylib-$VERSION.tar.gz",
],
sha256 = "$SHA256SUM",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
Using the rules
See the source.