Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21d75f8

Browse files
Remove references to rules_proto
They are not needed after the rules are move into protobuf repo. Except for the reference to toolchain type, which is currently in rules_proto and can be moved after the implementation is moved into protobuf repo. PiperOrigin-RevId: 622176865
1 parent 090525f commit 21d75f8

37 files changed

Lines changed: 101 additions & 79 deletions

File tree

BUILD.bazel

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Bazel (https://bazel.build/) BUILD file for Protobuf.
22

3-
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library")
4-
load("@rules_java//java:defs.bzl", "java_lite_proto_library", "java_proto_library")
3+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
54
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
6-
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
5+
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
6+
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
7+
load("//bazel:java_proto_library.bzl", "java_proto_library")
8+
load("//bazel:proto_library.bzl", "proto_library")
9+
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
710
load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS")
811
load(":protobuf.bzl", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library")
912

@@ -21,7 +24,7 @@ exports_files(["LICENSE"])
2124
#
2225
# java_proto_library(
2326
# name = "any_java_proto",
24-
# deps = ["@com_google_protobuf//:any_proto"],
27+
# deps = ["@protobuf//:any_proto"],
2528
# )
2629
################################################################################
2730

MODULE.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ bazel_dep(name = "rules_cc", version = "0.0.9")
1717
bazel_dep(name = "rules_java", version = "4.0.0")
1818
bazel_dep(name = "rules_jvm_external", version = "5.1")
1919
bazel_dep(name = "rules_pkg", version = "0.7.0")
20-
bazel_dep(name = "rules_proto", version = "4.0.0")
2120
bazel_dep(name = "rules_python", version = "0.10.2")
2221
bazel_dep(name = "platforms", version = "0.0.8")
2322
bazel_dep(name = "zlib", version = "1.2.11")
23+
24+
# TODO: remove after toolchain types are moved to protobuf
25+
bazel_dep(name = "rules_proto", version = "4.0.0")

WORKSPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ workspace(name = "com_google_protobuf")
55
# buildifier: disable=duplicated-name
66
local_repository(name = "com_google_protobuf", path = ".")
77

8+
# Second self-reference that makes it possible to load proto rules from @protobuf.
9+
# buildifier: disable=duplicated-name
10+
local_repository(name = "protobuf", path = ".")
11+
812
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
913

1014
local_repository(

bazel/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,5 @@ bzl_library(
2222
"upb_proto_reflection_library.bzl",
2323
],
2424
visibility = ["//visibility:public"],
25-
deps = [
26-
"//bazel/private:upb_proto_library_internal_bzl",
27-
"@rules_proto//proto:defs",
28-
],
25+
deps = ["//bazel/private:upb_proto_library_internal_bzl"],
2926
)

bazel/common/BUILD.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2+
3+
bzl_library(
4+
name = "proto_common_bzl",
5+
srcs = [
6+
"proto_common.bzl",
7+
],
8+
visibility = ["//visibility:public"],
9+
deps = [
10+
"//bazel/private:native_bzl",
11+
],
12+
)
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77

88
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
99

10-
# begin:google_only
11-
# package(default_applicable_licenses = ["//upb:license"])
12-
# end:google_only
13-
1410
licenses(["notice"])
1511

1612
bzl_library(
@@ -23,8 +19,16 @@ bzl_library(
2319
],
2420
visibility = ["//bazel:__pkg__"],
2521
deps = [
22+
"//bazel/common:proto_common_bzl",
2623
"@bazel_skylib//lib:paths",
2724
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
28-
"@rules_proto//proto:defs",
2925
],
3026
)
27+
28+
bzl_library(
29+
name = "native_bzl",
30+
srcs = [
31+
"native.bzl",
32+
],
33+
visibility = ["//bazel:__subpackages__"],
34+
)

bazel/private/proto_toolchain_rule.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
66
def _impl(ctx):
77
kwargs = {}
88
if getattr(proto_common, "INCOMPATIBLE_PASS_TOOLCHAIN_TYPE", False):
9-
kwargs["toolchain_type"] = "//third_party/bazel_rules/rules_proto/proto:toolchain_type"
9+
kwargs["toolchain_type"] = "@rules_proto//proto:toolchain_type"
1010

1111
return [
1212
DefaultInfo(

bazel/private/upb_proto_library_internal/aspect.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Implementation of the aspect that powers the upb_*_proto_library() rules."""
22

3-
load("@rules_proto//proto:defs.bzl", "proto_common")
3+
load("//bazel/common:proto_common.bzl", "proto_common")
44
load(":upb_proto_library_internal/cc_library_func.bzl", "cc_library_func")
55
load(":upb_proto_library_internal/copts.bzl", "UpbProtoLibraryCoptsInfo")
66

bazel/toolchains/proto_toolchain.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def proto_toolchain(*, name, proto_compiler, exec_compatible_with = []):
1919

2020
native.toolchain(
2121
name = name + "_toolchain",
22-
toolchain_type = "//third_party/bazel_rules/rules_proto/proto:toolchain_type",
22+
toolchain_type = "@rules_proto//proto:toolchain_type",
2323
exec_compatible_with = exec_compatible_with,
2424
target_compatible_with = [],
2525
toolchain = name,

benchmarks/BUILD

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
# license that can be found in the LICENSE file or at
66
# https://developers.google.com/open-source/licenses/bsd
77

8-
# begin:google_only
9-
# load("@rules_cc//cc:defs.bzl", "cc_proto_library")
10-
# end:google_only
11-
128
load("@rules_python//python:defs.bzl", "py_binary")
9+
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
10+
load("//bazel:proto_library.bzl", "proto_library")
1311
load(
1412
"//bazel:upb_proto_library.bzl",
1513
"upb_c_proto_library",
@@ -19,7 +17,6 @@ load(
1917
":build_defs.bzl",
2018
"cc_optimizefor_proto_library",
2119
"expand_suffixes",
22-
"proto_library",
2320
"tmpl_cc_binary",
2421
)
2522

0 commit comments

Comments
 (0)