From 28cf2e81608fc3100c0b1534dd783653790d5591 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Thu, 7 Nov 2024 05:14:15 -0800 Subject: [PATCH] Copybara Merge: https://github.com/bazelbuild/rules_cc/pull/269 BEGIN_PUBLIC Copybara import of the project: -- 0c245a456ac982537169539e3447f86eecfb51bf by Ivo List : Revert "Remove cc_proto_library from defs.bzl" This reverts commit b15fed2409182bef28c256bcb98a64736409fbec. -- d4311f4bddde2baa5d37cecf1e88e8c430ce13a7 by Ivo List : Move back WORKSPACE.bzlmod (unrevert) -- e62ddd085a4e57a33b02d4f1d7c590942a1da059 by Ivo List : Rename protobuf to com_google_protobuf This keeps compatiblity with WORKSPACE mode in older Bazel versions -- 0e1618fa83f89c05e13b1b55076acf83e0631170 by Ivo List : Adding deprecated comment -- a272300c18437f0f4ca15d0a44760b83f0a99a64 by Ivo List : Restore # @unsorted-dict-items END_PUBLIC COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/269 from comius:add-back-cc_proto_library a272300c18437f0f4ca15d0a44760b83f0a99a64 PiperOrigin-RevId: 694079850 Change-Id: Iaa57586636997fd3db9cf9289bddc40c673033c9 --- MODULE.bazel | 1 + WORKSPACE | 7 +++++++ cc/defs.bzl | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index d1afa5a..123e24d 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,6 +7,7 @@ module( bazel_dep(name = "bazel_features", version = "1.19.0") bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf") cc_configure = use_extension("//cc:extensions.bzl", "cc_configure_extension") use_repo(cc_configure, "local_config_cc", "local_config_cc_toolchains") diff --git a/WORKSPACE b/WORKSPACE index 4955620..ce5112f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -43,3 +43,10 @@ http_archive( strip_prefix = "rules_testing-0.6.0", url = "https://github.com/bazelbuild/rules_testing/releases/download/v0.6.0/rules_testing-v0.6.0.tar.gz", ) + +http_archive( + name = "com_google_protobuf", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", +) diff --git a/cc/defs.bzl b/cc/defs.bzl index 3448e77..4fccdcc 100644 --- a/cc/defs.bzl +++ b/cc/defs.bzl @@ -13,6 +13,7 @@ # limitations under the License. """Starlark rules for building C++ projects.""" +load("@com_google_protobuf//bazel:cc_proto_library.bzl", _cc_proto_library = "cc_proto_library") load("//cc:cc_binary.bzl", _cc_binary = "cc_binary") load("//cc:cc_import.bzl", _cc_import = "cc_import") load("//cc:cc_library.bzl", _cc_library = "cc_library") @@ -42,6 +43,13 @@ cc_shared_library = _cc_shared_library objc_library = _objc_library objc_import = _objc_import +# DEPRECATED: use rule from com_google_protobuf repository +def cc_proto_library(**kwargs): + if "deprecation" not in kwargs: + _cc_proto_library(deprecation = "Use cc_proto_library from com_google_protobuf", **kwargs) + else: + _cc_proto_library(**kwargs) + # Toolchain rules cc_toolchain = _cc_toolchain