diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e993a7db8..3b0d526870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,11 @@ A brief description of the categories of changes: ### Changed +* (deps): Bumped `bazel_skylib` to 1.6.1. +* (bzlmod): The `python` and internal `rules_python` extensions have been + marked as `reproducible` and will not include any lock file entries from now + on. + ### Fixed * (gazelle) Remove `visibility` from `NonEmptyAttr`. @@ -54,7 +59,7 @@ A brief description of the categories of changes: sorted in the attributes section. We are also removing values that are not default in order to reduce the size of the lock file. * (coverage) Bump `coverage.py` to [7.4.3](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst#version-743--2024-02-23). -* (deps): Bumped bazel_features to 1.9.1 to detect optional support +* (deps): Bumped `bazel_features` to 1.9.1 to detect optional support non-blocking downloads. * (deps): Updated `pip_tools` to >= 7.4.0 * (toolchains): Change some old toolchain versions to use [20240224] release to diff --git a/MODULE.bazel b/MODULE.bazel index 3e62ab76ef..8acde16c33 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,7 +5,7 @@ module( ) bazel_dep(name = "bazel_features", version = "1.9.1") -bazel_dep(name = "bazel_skylib", version = "1.3.0") +bazel_dep(name = "bazel_skylib", version = "1.6.1") bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "platforms", version = "0.0.4") @@ -14,7 +14,6 @@ bazel_dep(name = "rules_proto", version = "6.0.0-rc1") bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") internal_deps = use_extension("//python/private/bzlmod:internal_deps.bzl", "internal_deps") -internal_deps.install() use_repo( internal_deps, "rules_python_internal", diff --git a/gazelle/MODULE.bazel b/gazelle/MODULE.bazel index 1d01f49e1a..6ae7719d4b 100644 --- a/gazelle/MODULE.bazel +++ b/gazelle/MODULE.bazel @@ -4,7 +4,7 @@ module( compatibility_level = 1, ) -bazel_dep(name = "bazel_skylib", version = "1.5.0") +bazel_dep(name = "bazel_skylib", version = "1.6.1") bazel_dep(name = "rules_python", version = "0.18.0") bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go") bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle") diff --git a/python/extensions/BUILD.bazel b/python/extensions/BUILD.bazel index a9dede44ec..eb095ab746 100644 --- a/python/extensions/BUILD.bazel +++ b/python/extensions/BUILD.bazel @@ -37,6 +37,7 @@ bzl_library( visibility = ["//:__subpackages__"], deps = [ "//python/private:util_bzl", + "//python/private/bzlmod:bazel_features_bzl", "//python/private/bzlmod:python_bzl", ], ) diff --git a/python/private/bzlmod/BUILD.bazel b/python/private/bzlmod/BUILD.bazel index 0ec95e4bed..9edd3380bb 100644 --- a/python/private/bzlmod/BUILD.bazel +++ b/python/private/bzlmod/BUILD.bazel @@ -45,7 +45,7 @@ bzl_library( bzl_library( name = "bazel_features_bzl", - srcs = ["@bazel_features//:bzl_files"], + deps = ["@bazel_features//:features"], ) bzl_library( diff --git a/python/private/bzlmod/internal_deps.bzl b/python/private/bzlmod/internal_deps.bzl index aadf2cc997..62ca71fecc 100644 --- a/python/private/bzlmod/internal_deps.bzl +++ b/python/private/bzlmod/internal_deps.bzl @@ -8,18 +8,15 @@ "Python toolchain module extension for internal rule use" +load("@bazel_skylib//lib:modules.bzl", "modules") load("//python/pip_install:repositories.bzl", "pip_install_dependencies") load("//python/private:internal_config_repo.bzl", "internal_config_repo") -# buildifier: disable=unused-variable -def _internal_deps_impl(module_ctx): +def _internal_deps(): internal_config_repo(name = "rules_python_internal") pip_install_dependencies() -internal_deps = module_extension( - doc = "This extension to register internal rules_python dependecies.", - implementation = _internal_deps_impl, - tag_classes = { - "install": tag_class(attrs = dict()), - }, +internal_deps = modules.as_extension( + _internal_deps, + doc = "This extension registers internal rules_python dependencies.", ) diff --git a/python/private/bzlmod/python.bzl b/python/private/bzlmod/python.bzl index 5862f00d7b..f8be271fd6 100644 --- a/python/private/bzlmod/python.bzl +++ b/python/private/bzlmod/python.bzl @@ -14,6 +14,7 @@ "Python toolchain module extensions for use with bzlmod" +load("@bazel_features//:features.bzl", "bazel_features") load("//python:repositories.bzl", "python_register_toolchains") load("//python/private:toolchains_repo.bzl", "multi_toolchain_aliases") load("//python/private:util.bzl", "IS_BAZEL_6_4_OR_HIGHER") @@ -230,6 +231,11 @@ def _python_impl(module_ctx): debug_info = json.encode_indent(debug_info), ) + if bazel_features.external_deps.extension_metadata_has_reproducible: + return module_ctx.extension_metadata(reproducible = True) + else: + return None + def _fail_duplicate_module_toolchain_version(version, module): fail(("Duplicate module toolchain version: module '{module}' attempted " + "to use version '{version}' multiple times in itself").format(