From ab388397ae63571df3361467bebf4a83d415f089 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 14:18:21 +0200 Subject: [PATCH 01/20] Upgrade to protobuf 27 and remove py_proto_library --- MODULE.bazel | 6 +- WORKSPACE | 5 - WORKSPACE.bzlmod | 5 - examples/bzlmod/MODULE.bazel | 2 +- .../example.com/proto/BUILD.bazel | 2 +- examples/py_proto_library/WORKSPACE | 10 +- .../example.com/proto/BUILD.bazel | 2 +- internal_deps.bzl | 16 +- internal_setup.bzl | 6 +- python/BUILD.bazel | 2 +- python/private/proto/BUILD.bazel | 46 ---- python/private/proto/py_proto_library.bzl | 223 ------------------ python/proto.bzl | 6 +- 13 files changed, 21 insertions(+), 310 deletions(-) delete mode 100644 python/private/proto/BUILD.bazel delete mode 100644 python/private/proto/py_proto_library.bzl diff --git a/MODULE.bazel b/MODULE.bazel index 7064dfc84..04d8fb211 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -9,9 +9,9 @@ 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") -# Those are loaded only when using py_proto_library -bazel_dep(name = "rules_proto", version = "6.0.0-rc1") -bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") +# For backwards compatibility, those are loaded only when using py_proto_library +# Use py_proto_library directly from protobuf repository +bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf") internal_deps = use_extension("//python/private/bzlmod:internal_deps.bzl", "internal_deps") use_repo( diff --git a/WORKSPACE b/WORKSPACE index 90e930568..142c10990 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -149,8 +149,3 @@ http_file( ], ) -# rules_proto expects //external:python_headers to point at the python headers. -bind( - name = "python_headers", - actual = "//python/cc:current_py_cc_headers", -) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod index ca89afe8a..7829af6f2 100644 --- a/WORKSPACE.bzlmod +++ b/WORKSPACE.bzlmod @@ -55,8 +55,3 @@ http_file( ], ) -# rules_proto expects //external:python_headers to point at the python headers. -bind( - name = "python_headers", - actual = "//python/cc:current_py_cc_headers", -) diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 0d3016114..4e20e312c 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -15,7 +15,7 @@ local_path_override( bazel_dep(name = "rules_proto", version = "5.3.0-21.7") # (py_proto_library specific) Add the protobuf library for well-known types (e.g. `Any`, `Timestamp`, etc) -bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") +bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf") # We next initialize the python toolchain using the extension. # You can set different Python versions in this block. diff --git a/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel b/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel index fa20f2ce9..4f845adcd 100644 --- a/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel +++ b/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel @@ -13,5 +13,5 @@ proto_library( # https://bazel.build/reference/be/protocol-buffer#proto_library.strip_import_prefix strip_import_prefix = "/py_proto_library/example.com", visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:any_proto"], + deps = ["@protobuf//:any_proto"], ) diff --git a/examples/py_proto_library/WORKSPACE b/examples/py_proto_library/WORKSPACE index 81f189dbb..1955f83dc 100644 --- a/examples/py_proto_library/WORKSPACE +++ b/examples/py_proto_library/WORKSPACE @@ -38,12 +38,12 @@ rules_proto_dependencies() rules_proto_toolchains() http_archive( - name = "com_google_protobuf", - sha256 = "4fc5ff1b2c339fb86cd3a25f0b5311478ab081e65ad258c6789359cd84d421f8", - strip_prefix = "protobuf-26.1", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v26.1.tar.gz"], + name = "protobuf", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", + urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz"], ) -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() diff --git a/examples/py_proto_library/example.com/proto/BUILD.bazel b/examples/py_proto_library/example.com/proto/BUILD.bazel index dc91162aa..8f35e3859 100644 --- a/examples/py_proto_library/example.com/proto/BUILD.bazel +++ b/examples/py_proto_library/example.com/proto/BUILD.bazel @@ -13,5 +13,5 @@ proto_library( # https://bazel.build/reference/be/protocol-buffer#proto_library.strip_import_prefix strip_import_prefix = "/example.com", visibility = ["//visibility:public"], - deps = ["@com_google_protobuf//:any_proto"], + deps = ["@protobuf//:any_proto"], ) diff --git a/internal_deps.bzl b/internal_deps.bzl index 881875164..423df12a9 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -165,19 +165,11 @@ def rules_python_internal_deps(): ) http_archive( - name = "rules_proto", - sha256 = "904a8097fae42a690c8e08d805210e40cccb069f5f9a0f6727cf4faa7bed2c9c", - strip_prefix = "rules_proto-6.0.0-rc1", - url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc1/rules_proto-6.0.0-rc1.tar.gz", - ) - - http_archive( - name = "com_google_protobuf", - sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", - strip_prefix = "protobuf-21.7", + name = "protobuf", + sha256 = "", + strip_prefix = "protobuf-27.0", urls = [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", - "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", ], ) diff --git a/internal_setup.bzl b/internal_setup.bzl index bb6261121..52f082503 100644 --- a/internal_setup.bzl +++ b/internal_setup.bzl @@ -17,10 +17,9 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies") -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies") load("@rules_bazel_integration_test//bazel_integration_test:repo_defs.bzl", "bazel_binaries") -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") load("//:version.bzl", "SUPPORTED_BAZEL_VERSIONS") load("//python/pip_install:repositories.bzl", "pip_install_dependencies") load("//python/private:internal_config_repo.bzl", "internal_config_repo") # buildifier: disable=bzl-visibility @@ -35,9 +34,6 @@ def rules_python_internal_setup(): bazel_skylib_workspace() - rules_proto_dependencies() - rules_proto_toolchains() - protobuf_deps() bazel_integration_test_rules_dependencies() diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 5d31df5e9..9e09162b8 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -112,7 +112,7 @@ bzl_library( ], visibility = ["//visibility:public"], deps = [ - "//python/private/proto:py_proto_library_bzl", + "@protobuf//bazel:py_proto_library_bzl", ], ) diff --git a/python/private/proto/BUILD.bazel b/python/private/proto/BUILD.bazel deleted file mode 100644 index 65c09444f..000000000 --- a/python/private/proto/BUILD.bazel +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") -load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain") - -package(default_visibility = ["//visibility:private"]) - -licenses(["notice"]) - -filegroup( - name = "distribution", - srcs = glob(["**"]), - visibility = ["//python/private:__pkg__"], -) - -bzl_library( - name = "py_proto_library_bzl", - srcs = ["py_proto_library.bzl"], - visibility = ["//python:__pkg__"], - deps = [ - "//python:defs_bzl", - "@rules_proto//proto:defs", - ], -) - -proto_lang_toolchain( - name = "python_toolchain", - command_line = "--python_out=%s", - progress_message = "Generating Python proto_library %{label}", - runtime = "@com_google_protobuf//:protobuf_python", - # NOTE: This isn't *actually* public. It's an implicit dependency of py_proto_library, - # so must be public so user usages of the rule can reference it. - visibility = ["//visibility:public"], -) diff --git a/python/private/proto/py_proto_library.bzl b/python/private/proto/py_proto_library.bzl deleted file mode 100644 index e123ff847..000000000 --- a/python/private/proto/py_proto_library.bzl +++ /dev/null @@ -1,223 +0,0 @@ -# Copyright 2022 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""The implementation of the `py_proto_library` rule and its aspect.""" - -load("@rules_proto//proto:defs.bzl", "ProtoInfo", "proto_common") -load("//python:defs.bzl", "PyInfo") - -PY_PROTO_TOOLCHAIN = "@rules_python//python/proto:toolchain_type" - -_PyProtoInfo = provider( - doc = "Encapsulates information needed by the Python proto rules.", - fields = { - "imports": """ - (depset[str]) The field forwarding PyInfo.imports coming from - the proto language runtime dependency.""", - "runfiles_from_proto_deps": """ - (depset[File]) Files from the transitive closure implicit proto - dependencies""", - "transitive_sources": """(depset[File]) The Python sources.""", - }, -) - -def _filter_provider(provider, *attrs): - return [dep[provider] for attr in attrs for dep in attr if provider in dep] - -def _incompatible_toolchains_enabled(): - return getattr(proto_common, "INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION", False) - -def _py_proto_aspect_impl(target, ctx): - """Generates and compiles Python code for a proto_library. - - The function runs protobuf compiler on the `proto_library` target generating - a .py file for each .proto file. - - Args: - target: (Target) A target providing `ProtoInfo`. Usually this means a - `proto_library` target, but not always; you must expect to visit - non-`proto_library` targets, too. - ctx: (RuleContext) The rule context. - - Returns: - ([_PyProtoInfo]) Providers collecting transitive information about - generated files. - """ - _proto_library = ctx.rule.attr - - # Check Proto file names - for proto in target[ProtoInfo].direct_sources: - if proto.is_source and "-" in proto.dirname: - fail("Cannot generate Python code for a .proto whose path contains '-' ({}).".format( - proto.path, - )) - - if _incompatible_toolchains_enabled(): - toolchain = ctx.toolchains[PY_PROTO_TOOLCHAIN] - if not toolchain: - fail("No toolchains registered for '%s'." % PY_PROTO_TOOLCHAIN) - proto_lang_toolchain_info = toolchain.proto - else: - proto_lang_toolchain_info = getattr(ctx.attr, "_aspect_proto_toolchain")[proto_common.ProtoLangToolchainInfo] - - api_deps = [proto_lang_toolchain_info.runtime] - - generated_sources = [] - proto_info = target[ProtoInfo] - proto_root = proto_info.proto_source_root - if proto_info.direct_sources: - # Generate py files - generated_sources = proto_common.declare_generated_files( - actions = ctx.actions, - proto_info = proto_info, - extension = "_pb2.py", - name_mapper = lambda name: name.replace("-", "_").replace(".", "/"), - ) - - # Handles multiple repository and virtual import cases - if proto_root.startswith(ctx.bin_dir.path): - proto_root = proto_root[len(ctx.bin_dir.path) + 1:] - - plugin_output = ctx.bin_dir.path + "/" + proto_root - proto_root = ctx.workspace_name + "/" + proto_root - - proto_common.compile( - actions = ctx.actions, - proto_info = proto_info, - proto_lang_toolchain_info = proto_lang_toolchain_info, - generated_files = generated_sources, - plugin_output = plugin_output, - ) - - # Generated sources == Python sources - python_sources = generated_sources - - deps = _filter_provider(_PyProtoInfo, getattr(_proto_library, "deps", [])) - runfiles_from_proto_deps = depset( - transitive = [dep[DefaultInfo].default_runfiles.files for dep in api_deps] + - [dep.runfiles_from_proto_deps for dep in deps], - ) - transitive_sources = depset( - direct = python_sources, - transitive = [dep.transitive_sources for dep in deps], - ) - - return [ - _PyProtoInfo( - imports = depset( - # Adding to PYTHONPATH so the generated modules can be - # imported. This is necessary when there is - # strip_import_prefix, the Python modules are generated under - # _virtual_imports. But it's undesirable otherwise, because it - # will put the repo root at the top of the PYTHONPATH, ahead of - # directories added through `imports` attributes. - [proto_root] if "_virtual_imports" in proto_root else [], - transitive = [dep[PyInfo].imports for dep in api_deps] + [dep.imports for dep in deps], - ), - runfiles_from_proto_deps = runfiles_from_proto_deps, - transitive_sources = transitive_sources, - ), - ] - -_py_proto_aspect = aspect( - implementation = _py_proto_aspect_impl, - attrs = {} if _incompatible_toolchains_enabled() else { - "_aspect_proto_toolchain": attr.label( - default = ":python_toolchain", - ), - }, - attr_aspects = ["deps"], - required_providers = [ProtoInfo], - provides = [_PyProtoInfo], - toolchains = [PY_PROTO_TOOLCHAIN] if _incompatible_toolchains_enabled() else [], -) - -def _py_proto_library_rule(ctx): - """Merges results of `py_proto_aspect` in `deps`. - - Args: - ctx: (RuleContext) The rule context. - Returns: - ([PyInfo, DefaultInfo, OutputGroupInfo]) - """ - if not ctx.attr.deps: - fail("'deps' attribute mustn't be empty.") - - pyproto_infos = _filter_provider(_PyProtoInfo, ctx.attr.deps) - default_outputs = depset( - transitive = [info.transitive_sources for info in pyproto_infos], - ) - - return [ - DefaultInfo( - files = default_outputs, - default_runfiles = ctx.runfiles(transitive_files = depset( - transitive = - [default_outputs] + - [info.runfiles_from_proto_deps for info in pyproto_infos], - )), - ), - OutputGroupInfo( - default = depset(), - ), - PyInfo( - transitive_sources = default_outputs, - imports = depset(transitive = [info.imports for info in pyproto_infos]), - # Proto always produces 2- and 3- compatible source files - has_py2_only_sources = False, - has_py3_only_sources = False, - ), - ] - -py_proto_library = rule( - implementation = _py_proto_library_rule, - doc = """ - Use `py_proto_library` to generate Python libraries from `.proto` files. - - The convention is to name the `py_proto_library` rule `foo_py_pb2`, - when it is wrapping `proto_library` rule `foo_proto`. - - `deps` must point to a `proto_library` rule. - - Example: - -```starlark -py_library( - name = "lib", - deps = [":foo_py_pb2"], -) - -py_proto_library( - name = "foo_py_pb2", - deps = [":foo_proto"], -) - -proto_library( - name = "foo_proto", - srcs = ["foo.proto"], -) -```""", - attrs = { - "deps": attr.label_list( - doc = """ - The list of `proto_library` rules to generate Python libraries for. - - Usually this is just the one target: the proto library of interest. - It can be any target providing `ProtoInfo`.""", - providers = [ProtoInfo], - aspects = [_py_proto_aspect], - ), - }, - provides = [PyInfo], -) diff --git a/python/proto.bzl b/python/proto.bzl index 3f455aee5..9c7a35bfe 100644 --- a/python/proto.bzl +++ b/python/proto.bzl @@ -16,6 +16,8 @@ Python proto library. """ -load("//python/private/proto:py_proto_library.bzl", _py_proto_library = "py_proto_library") +load("@protobuf//bazel:py_proto_library.bzl", _py_proto_library = "py_proto_library") + +def py_proto_library(*, deprecation = "Use py_proto_library from protobuf repository", **kwargs): + _py_proto_library(deprecation = deprecation, **kwargs) -py_proto_library = _py_proto_library From bd739d0d6bd764d9766b1437ce8f89d79afe635e Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 14:23:16 +0200 Subject: [PATCH 02/20] Add missing sha --- internal_deps.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal_deps.bzl b/internal_deps.bzl index 423df12a9..64d123696 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -166,7 +166,7 @@ def rules_python_internal_deps(): http_archive( name = "protobuf", - sha256 = "", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", strip_prefix = "protobuf-27.0", urls = [ "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", From 3ab706557df2b4efd2cfcee81b0757b16303c9cd Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 14:41:23 +0200 Subject: [PATCH 03/20] Fix for bazel_tools, using com_google_protobuf --- WORKSPACE | 1 - examples/bzlmod/MODULE.bazel | 3 --- .../example.com/another_proto/BUILD.bazel | 4 ++-- .../example.com/proto/BUILD.bazel | 6 +++--- examples/py_proto_library/WORKSPACE | 17 ++--------------- .../example.com/another_proto/BUILD.bazel | 4 ++-- .../example.com/proto/BUILD.bazel | 6 +++--- internal_setup.bzl | 2 +- python/BUILD.bazel | 2 +- python/proto.bzl | 4 +--- 10 files changed, 15 insertions(+), 34 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 142c10990..d30ccb02f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -148,4 +148,3 @@ http_file( "https://files.pythonhosted.org/packages/50/67/3e966d99a07d60a21a21d7ec016e9e4c2642a86fea251ec68677daf71d4d/numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", ], ) - diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 4e20e312c..2e28bd627 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -11,9 +11,6 @@ local_path_override( path = "../..", ) -# (py_proto_library specific) We are using rules_proto to define rules_proto targets to be consumed by py_proto_library. -bazel_dep(name = "rules_proto", version = "5.3.0-21.7") - # (py_proto_library specific) Add the protobuf library for well-known types (e.g. `Any`, `Timestamp`, etc) bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf") diff --git a/examples/bzlmod/py_proto_library/example.com/another_proto/BUILD.bazel b/examples/bzlmod/py_proto_library/example.com/another_proto/BUILD.bazel index 806fcb9dc..80f047074 100644 --- a/examples/bzlmod/py_proto_library/example.com/another_proto/BUILD.bazel +++ b/examples/bzlmod/py_proto_library/example.com/another_proto/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@rules_python//python:proto.bzl", "py_proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") py_proto_library( name = "message_proto_py_pb2", diff --git a/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel b/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel index 4f845adcd..3bc9d1b73 100644 --- a/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel +++ b/examples/bzlmod/py_proto_library/example.com/proto/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@rules_python//python:proto.bzl", "py_proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") py_proto_library( name = "pricetag_proto_py_pb2", @@ -13,5 +13,5 @@ proto_library( # https://bazel.build/reference/be/protocol-buffer#proto_library.strip_import_prefix strip_import_prefix = "/py_proto_library/example.com", visibility = ["//visibility:public"], - deps = ["@protobuf//:any_proto"], + deps = ["@com_google_protobuf//:any_proto"], ) diff --git a/examples/py_proto_library/WORKSPACE b/examples/py_proto_library/WORKSPACE index 1955f83dc..7892c69c4 100644 --- a/examples/py_proto_library/WORKSPACE +++ b/examples/py_proto_library/WORKSPACE @@ -25,25 +25,12 @@ python_register_toolchains( load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( - name = "rules_proto", - sha256 = "904a8097fae42a690c8e08d805210e40cccb069f5f9a0f6727cf4faa7bed2c9c", - strip_prefix = "rules_proto-6.0.0-rc1", - url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc1/rules_proto-6.0.0-rc1.tar.gz", -) - -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") - -rules_proto_dependencies() - -rules_proto_toolchains() - -http_archive( - name = "protobuf", + name = "com_google_protobuf", sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", strip_prefix = "protobuf-27.0", urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz"], ) -load("@protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() diff --git a/examples/py_proto_library/example.com/another_proto/BUILD.bazel b/examples/py_proto_library/example.com/another_proto/BUILD.bazel index dd58265bc..126dd9b46 100644 --- a/examples/py_proto_library/example.com/another_proto/BUILD.bazel +++ b/examples/py_proto_library/example.com/another_proto/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@rules_python//python:proto.bzl", "py_proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") py_proto_library( name = "message_proto_py_pb2", diff --git a/examples/py_proto_library/example.com/proto/BUILD.bazel b/examples/py_proto_library/example.com/proto/BUILD.bazel index 8f35e3859..0084a6179 100644 --- a/examples/py_proto_library/example.com/proto/BUILD.bazel +++ b/examples/py_proto_library/example.com/proto/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@rules_python//python:proto.bzl", "py_proto_library") +load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") py_proto_library( name = "pricetag_proto_py_pb2", @@ -13,5 +13,5 @@ proto_library( # https://bazel.build/reference/be/protocol-buffer#proto_library.strip_import_prefix strip_import_prefix = "/example.com", visibility = ["//visibility:public"], - deps = ["@protobuf//:any_proto"], + deps = ["@com_google_protobuf//:any_proto"], ) diff --git a/internal_setup.bzl b/internal_setup.bzl index 52f082503..6614ad355 100644 --- a/internal_setup.bzl +++ b/internal_setup.bzl @@ -17,7 +17,7 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies") -load("@protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies") load("@rules_bazel_integration_test//bazel_integration_test:repo_defs.bzl", "bazel_binaries") load("//:version.bzl", "SUPPORTED_BAZEL_VERSIONS") diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 9e09162b8..10b785b88 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -112,7 +112,7 @@ bzl_library( ], visibility = ["//visibility:public"], deps = [ - "@protobuf//bazel:py_proto_library_bzl", + "@com_google_protobuf//bazel:py_proto_library_bzl", ], ) diff --git a/python/proto.bzl b/python/proto.bzl index 9c7a35bfe..2ea9bdb15 100644 --- a/python/proto.bzl +++ b/python/proto.bzl @@ -11,13 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Python proto library. """ -load("@protobuf//bazel:py_proto_library.bzl", _py_proto_library = "py_proto_library") +load("@com_google_protobuf//bazel:py_proto_library.bzl", _py_proto_library = "py_proto_library") def py_proto_library(*, deprecation = "Use py_proto_library from protobuf repository", **kwargs): _py_proto_library(deprecation = deprecation, **kwargs) - From fa778f3437a985f535c767f4f40392525425ff9c Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 14:42:27 +0200 Subject: [PATCH 04/20] One more com_google_protobuf --- internal_deps.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal_deps.bzl b/internal_deps.bzl index 64d123696..8c604c403 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -165,7 +165,7 @@ def rules_python_internal_deps(): ) http_archive( - name = "protobuf", + name = "com_google_protobuf", sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", strip_prefix = "protobuf-27.0", urls = [ From 1617b19fec425aff997b0135d61077cc18063257 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 15:14:35 +0200 Subject: [PATCH 05/20] Remove reference to py_proto_library --- python/private/BUILD.bazel | 1 - 1 file changed, 1 deletion(-) diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 3e5620885..35c254eb0 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -29,7 +29,6 @@ filegroup( srcs = glob(["**"]) + [ "//python/private/bzlmod:distribution", "//python/private/common:distribution", - "//python/private/proto:distribution", "//python/private/whl_filegroup:distribution", "//tools/build_defs/python/private:distribution", ], From 0e179b2abf837693d9bdc4b48a82498500f37f8f Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 16:19:59 +0200 Subject: [PATCH 06/20] Disable warnings as errors for Debian/gcc distributions --- .bazelci/presubmit.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 30138d3be..19c836176 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -147,6 +147,10 @@ tasks: <<: *reusable_config name: "Default: Debian" platform: debian11 + build_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' macos: <<: *reusable_config name: "Default: MacOS" @@ -169,6 +173,9 @@ tasks: # build kite cc toolchain. - "--extra_toolchains=@buildkite_config//config:cc-toolchain" - "--build_tag_filters=-docs" + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" # BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1, @@ -180,6 +187,10 @@ tasks: <<: *reusable_config name: "RBE: Ubuntu" platform: rbe_ubuntu1604 + build_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test" @@ -234,6 +245,10 @@ tasks: name: "examples/bzlmod: Debian" working_directory: examples/bzlmod platform: debian11 + build_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod @@ -395,6 +410,10 @@ tasks: name: "examples/py_proto_library: Debian, workspace" working_directory: examples/py_proto_library platform: debian11 + build_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' integration_test_py_proto_library_macos_workspace: <<: *reusable_build_test_all <<: *common_workspace_flags From eae747adf9e17f6b6b4f61dc4681c977feb42ccb Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 16:32:50 +0200 Subject: [PATCH 07/20] Disable warnings as errors for Debian/gcc distributions for tests --- .bazelci/presubmit.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 19c836176..39af2ad04 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -151,7 +151,11 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - macos: + test_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' + macos: <<: *reusable_config name: "Default: MacOS" platform: macos @@ -183,7 +187,10 @@ tasks: # on Bazel 5.4 and earlier. To workaround this, manually specify the # build kite cc toolchain. - "--extra_toolchains=@buildkite_config//config:cc-toolchain" - rbe: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' + rbe: <<: *reusable_config name: "RBE: Ubuntu" platform: rbe_ubuntu1604 @@ -249,7 +256,11 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - integration_test_bzlmod_macos: + test_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' + integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod name: "examples/bzlmod: macOS" @@ -414,7 +425,11 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - integration_test_py_proto_library_macos_workspace: + test_flags: + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' + integration_test_py_proto_library_macos_workspace: <<: *reusable_build_test_all <<: *common_workspace_flags name: "examples/py_proto_library: MacOS, workspace" From 715018cf0c87fc6de5c0d69353dd83e3a9989ad1 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 18:00:33 +0200 Subject: [PATCH 08/20] Fix identation --- .bazelci/presubmit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 39af2ad04..40c72314e 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -155,7 +155,7 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - macos: + macos: <<: *reusable_config name: "Default: MacOS" platform: macos @@ -190,7 +190,7 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - rbe: + rbe: <<: *reusable_config name: "RBE: Ubuntu" platform: rbe_ubuntu1604 @@ -260,7 +260,7 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - integration_test_bzlmod_macos: + integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod name: "examples/bzlmod: macOS" @@ -429,7 +429,7 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' - integration_test_py_proto_library_macos_workspace: + integration_test_py_proto_library_macos_workspace: <<: *reusable_build_test_all <<: *common_workspace_flags name: "examples/py_proto_library: MacOS, workspace" From 089e52a6948953906b1e171bd23a2858e0c06ab2 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 18:26:58 +0200 Subject: [PATCH 09/20] Try disabling warnings as errors --- .bazelci/presubmit.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 40c72314e..fc3168f7f 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -180,6 +180,7 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' + - '--features=-treat_warnings_as_errors' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" # BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1, @@ -190,6 +191,7 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' + - '--features=-treat_warnings_as_errors' rbe: <<: *reusable_config name: "RBE: Ubuntu" @@ -198,8 +200,13 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' + - '--features=-treat_warnings_as_errors' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test" + # For protobuf compilation + - '--host_copt=-Wno-deprecated-declarations' + - '--copt=-Wno-deprecated-declarations' + - '--features=-treat_warnings_as_errors' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version @@ -256,10 +263,12 @@ tasks: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' + - '--features=-treat_warnings_as_errors' test_flags: # For protobuf compilation - '--host_copt=-Wno-deprecated-declarations' - '--copt=-Wno-deprecated-declarations' + - '--features=-treat_warnings_as_errors' integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod From 99361112b1e02ef01d178849b3716f528a8641ed Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 18:48:23 +0200 Subject: [PATCH 10/20] Try disabling targets --- .bazelci/presubmit.yml | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index fc3168f7f..634cf0bc1 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -177,10 +177,9 @@ tasks: # build kite cc toolchain. - "--extra_toolchains=@buildkite_config//config:cc-toolchain" - "--build_tag_filters=-docs" + build_targets: # For protobuf compilation - - '--host_copt=-Wno-deprecated-declarations' - - '--copt=-Wno-deprecated-declarations' - - '--features=-treat_warnings_as_errors' + - '-//python:proto_bzl' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" # BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1, @@ -188,25 +187,21 @@ tasks: # on Bazel 5.4 and earlier. To workaround this, manually specify the # build kite cc toolchain. - "--extra_toolchains=@buildkite_config//config:cc-toolchain" + test_targets: # For protobuf compilation - - '--host_copt=-Wno-deprecated-declarations' - - '--copt=-Wno-deprecated-declarations' - - '--features=-treat_warnings_as_errors' + - '-//python:proto_bzl' rbe: <<: *reusable_config name: "RBE: Ubuntu" platform: rbe_ubuntu1604 - build_flags: + build_targets: # For protobuf compilation - - '--host_copt=-Wno-deprecated-declarations' - - '--copt=-Wno-deprecated-declarations' - - '--features=-treat_warnings_as_errors' + - '-//python:proto_bzl' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test" + test_targets: # For protobuf compilation - - '--host_copt=-Wno-deprecated-declarations' - - '--copt=-Wno-deprecated-declarations' - - '--features=-treat_warnings_as_errors' + - '-//python:proto_bzl' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version @@ -259,16 +254,12 @@ tasks: name: "examples/bzlmod: Debian" working_directory: examples/bzlmod platform: debian11 - build_flags: + build_targets: # For protobuf compilation - - '--host_copt=-Wno-deprecated-declarations' - - '--copt=-Wno-deprecated-declarations' - - '--features=-treat_warnings_as_errors' - test_flags: + - '-//python:proto_bzl' + test_targets: # For protobuf compilation - - '--host_copt=-Wno-deprecated-declarations' - - '--copt=-Wno-deprecated-declarations' - - '--features=-treat_warnings_as_errors' + - '-//python:proto_bzl' integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod From 01e7076e358bffb876087e80fbbb8f27ec8ab03f Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 18:57:30 +0200 Subject: [PATCH 11/20] Disabling targets, try 2 --- .bazelci/presubmit.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 634cf0bc1..56e9ba239 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -179,6 +179,8 @@ tasks: - "--build_tag_filters=-docs" build_targets: # For protobuf compilation + - "--" + - "..." - '-//python:proto_bzl' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" @@ -189,6 +191,8 @@ tasks: - "--extra_toolchains=@buildkite_config//config:cc-toolchain" test_targets: # For protobuf compilation + - "--" + - "..." - '-//python:proto_bzl' rbe: <<: *reusable_config @@ -196,11 +200,15 @@ tasks: platform: rbe_ubuntu1604 build_targets: # For protobuf compilation + - "--" + - "..." - '-//python:proto_bzl' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test" test_targets: # For protobuf compilation + - "--" + - "..." - '-//python:proto_bzl' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: @@ -256,10 +264,14 @@ tasks: platform: debian11 build_targets: # For protobuf compilation - - '-//python:proto_bzl' + - "--" + - "..." + - "-//py_proto_library/..." test_targets: # For protobuf compilation - - '-//python:proto_bzl' + - "--" + - "..." + - "-//py_proto_library/..." integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod From 9d874fb9d127af22de8a49eadd88846b71b6300f Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 19:40:29 +0200 Subject: [PATCH 12/20] try 3 --- .bazelci/presubmit.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 56e9ba239..6a8a1143c 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -178,10 +178,9 @@ tasks: - "--extra_toolchains=@buildkite_config//config:cc-toolchain" - "--build_tag_filters=-docs" build_targets: - # For protobuf compilation - "--" - "..." - - '-//python:proto_bzl' + - '-//sphinxdoc/...' # protobuf compilation fails test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" # BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1, @@ -190,10 +189,9 @@ tasks: # build kite cc toolchain. - "--extra_toolchains=@buildkite_config//config:cc-toolchain" test_targets: - # For protobuf compilation - "--" - "..." - - '-//python:proto_bzl' + - '-//sphinxdoc/...' # protobuf compilation fails rbe: <<: *reusable_config name: "RBE: Ubuntu" @@ -202,14 +200,14 @@ tasks: # For protobuf compilation - "--" - "..." - - '-//python:proto_bzl' + - '-//sphinxdoc/...' # protobuf compilation fails test_flags: - "--test_tag_filters=-integration-test,-acceptance-test" test_targets: # For protobuf compilation - "--" - "..." - - '-//python:proto_bzl' + - '-//sphinxdoc/...' # protobuf compilation fails integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version @@ -272,6 +270,11 @@ tasks: - "--" - "..." - "-//py_proto_library/..." + coverage_targets: + # For protobuf compilation + - "--" + - "..." + - "-//py_proto_library/..." integration_test_bzlmod_macos: <<: *reusable_build_test_all <<: *coverage_targets_example_bzlmod From fc3b171a6e4e6ac75b8fb41ca463837260631579 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 20:31:27 +0200 Subject: [PATCH 13/20] Try 4 --- .bazelci/presubmit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 6a8a1143c..abcb2c6ee 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -180,7 +180,7 @@ tasks: build_targets: - "--" - "..." - - '-//sphinxdoc/...' # protobuf compilation fails + - '-//sphinxdocs/...' # protobuf compilation fails test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" # BazelCI sets --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1, @@ -191,7 +191,7 @@ tasks: test_targets: - "--" - "..." - - '-//sphinxdoc/...' # protobuf compilation fails + - '-//sphinxdocs/...' # protobuf compilation fails rbe: <<: *reusable_config name: "RBE: Ubuntu" @@ -200,14 +200,14 @@ tasks: # For protobuf compilation - "--" - "..." - - '-//sphinxdoc/...' # protobuf compilation fails + - '-//sphinxdocs/...' # protobuf compilation fails test_flags: - "--test_tag_filters=-integration-test,-acceptance-test" test_targets: # For protobuf compilation - "--" - "..." - - '-//sphinxdoc/...' # protobuf compilation fails + - '-//sphinxdocs/...' # protobuf compilation fails integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version From 2ad5e14999476bd2d40793b9492b1fddea268278 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 22:15:12 +0200 Subject: [PATCH 14/20] try 6 --- .bazelci/presubmit.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index abcb2c6ee..ae0967aa8 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -197,14 +197,12 @@ tasks: name: "RBE: Ubuntu" platform: rbe_ubuntu1604 build_targets: - # For protobuf compilation - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails test_flags: - - "--test_tag_filters=-integration-test,-acceptance-test" + - "--test_tag_filters=-integration-test,-acceptance-test,-docs" test_targets: - # For protobuf compilation - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails From a7235f185b9d1fbb2df19f31cf326d647e877239 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 22:25:52 +0200 Subject: [PATCH 15/20] try 5 --- .bazelci/presubmit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index ae0967aa8..37dda2eb7 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -196,6 +196,8 @@ tasks: <<: *reusable_config name: "RBE: Ubuntu" platform: rbe_ubuntu1604 + build_flags: + - "--build_tag_filters=-docs" build_targets: - "--" - "..." From 876c0d486f615ac10525ae9a6cdc0cad792bbc7d Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 22:41:33 +0200 Subject: [PATCH 16/20] try 7 --- .bazelci/presubmit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 37dda2eb7..bb439d2f7 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -202,12 +202,14 @@ tasks: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails + - '@com_google_protobuf//...' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" test_targets: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails + - '@com_google_protobuf//...' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version From ad24d39d53a00025fbb9515bb8f8db8f000f10d8 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 22:45:57 +0200 Subject: [PATCH 17/20] try 8 --- .bazelci/presubmit.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index bb439d2f7..7b59619fb 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -197,19 +197,17 @@ tasks: name: "RBE: Ubuntu" platform: rbe_ubuntu1604 build_flags: - - "--build_tag_filters=-docs" + - "--build_tag_filters=-integration-test,-docs" build_targets: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails - - '@com_google_protobuf//...' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" test_targets: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails - - '@com_google_protobuf//...' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version From 1e1d9d60cf7f18f5f1fccdd86fc1cd9ba477085e Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 23:01:29 +0200 Subject: [PATCH 18/20] try 9 --- .bazelci/presubmit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 7b59619fb..095330671 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -202,12 +202,14 @@ tasks: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails + - '-//examples/py_proto_library/...' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" test_targets: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails + - '-//examples/py_proto_library/...' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version From 8adef634e23e4fb30cda2598c2d71708ccf0042c Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 31 May 2024 23:04:41 +0200 Subject: [PATCH 19/20] try 10 --- .bazelci/presubmit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 095330671..c2d172d7e 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -197,19 +197,19 @@ tasks: name: "RBE: Ubuntu" platform: rbe_ubuntu1604 build_flags: - - "--build_tag_filters=-integration-test,-docs" + - "--build_tag_filters=-docs" build_targets: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails - - '-//examples/py_proto_library/...' + - '-//docs/...' test_flags: - "--test_tag_filters=-integration-test,-acceptance-test,-docs" test_targets: - "--" - "..." - '-//sphinxdocs/...' # protobuf compilation fails - - '-//examples/py_proto_library/...' + - '-//docs/...' integration_test_build_file_generation_ubuntu_minimum_supported_workspace: <<: *minimum_supported_version From a0559005318c0e72eb580c59a007cc2046de2784 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Mon, 3 Jun 2024 14:04:45 +0200 Subject: [PATCH 20/20] Add change to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e15be3bbc..8b2f6e651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ A brief description of the categories of changes: [x.x.x]: https://github.com/bazelbuild/rules_python/releases/tag/x.x.x ### Changed +* (rules) `py_proto_library` is deprecated in favour of the + implementation in https://github.com/protocolbuffers/protobuf. It will be + removed in the future release. * (deps) Upgrade the `pip_install` dependencies to pick up a new version of pip. * (toolchains) Optional toolchain dependency: `py_binary`, `py_test`, and `py_library` now depend on the `//python:exec_tools_toolchain_type` for build