Source upb for C from gRPC deps, to prevent version skew

This commit is contained in:
Adam Liddell 2022-11-22 21:31:53 +00:00
parent efc9b1b5ed
commit 029d6888d6
6 changed files with 26 additions and 35 deletions

View File

@ -3,9 +3,7 @@
load(
"//:repositories.bzl",
"rules_proto_grpc_repos",
"upb",
)
def c_repos(**kwargs): # buildifier: disable=function-docstring
rules_proto_grpc_repos(**kwargs)
upb(**kwargs)

View File

@ -42,9 +42,13 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
rules_proto_grpc_c_repos()
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
upb_deps()
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()
``BUILD.bazel``
^^^^^^^^^^^^^^^
@ -144,9 +148,13 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
rules_proto_grpc_c_repos()
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
upb_deps()
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()
``BUILD.bazel``
^^^^^^^^^^^^^^^

View File

@ -19,6 +19,10 @@ load("@rules_proto_grpc//c:repositories.bzl", rules_proto_grpc_c_repos = "c_repo
rules_proto_grpc_c_repos()
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
upb_deps()
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()

View File

@ -19,6 +19,10 @@ load("@rules_proto_grpc//c:repositories.bzl", rules_proto_grpc_c_repos = "c_repo
rules_proto_grpc_c_repos()
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
upb_deps()
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()

View File

@ -111,15 +111,6 @@ VERSIONS = {
"executable": True,
},
# C
"upb": {
"type": "github",
"org": "protocolbuffers",
"repo": "upb",
"ref": "982f26aad42291064878ff64cb5a43d69723f91c",
"sha256": "72d25e544bce0e350612184096ba4cd3454d63c048e5c18a682038c075c947a4",
},
# C#/F#
"io_bazel_rules_dotnet": {
"type": "github",
@ -549,12 +540,6 @@ def protoc_gen_buf_lint_darwin_x86_64(**kwargs):
def protoc_gen_buf_lint_linux_x86_64(**kwargs):
_generic_dependency("protoc_gen_buf_lint_linux_x86_64", **kwargs)
#
# C
#
def upb(**kwargs):
_generic_dependency("upb", **kwargs)
#
# C#
#

View File

@ -1,13 +1,5 @@
package main
var cWorkspaceTemplate = mustTemplate(`load("@rules_proto_grpc//{{ .Lang.Dir }}:repositories.bzl", rules_proto_grpc_{{ .Lang.Name }}_repos = "{{ .Lang.Name }}_repos")
rules_proto_grpc_{{ .Lang.Name }}_repos()
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
upb_deps()`)
var cProtoLibraryRuleTemplate = mustTemplate(`load("//{{ .Lang.Dir }}:{{ .Lang.Name }}_{{ .Rule.Kind }}_compile.bzl", "{{ .Lang.Name }}_{{ .Rule.Kind }}_compile")
load("//internal:compile.bzl", "proto_compile_attrs")
load("//internal:filter_files.bzl", "filter_files")
@ -85,7 +77,7 @@ func makeC() *Language {
Kind: "proto",
Implementation: compileRuleTemplate,
Plugins: []string{"//c:upb_plugin"},
WorkspaceExample: cWorkspaceTemplate,
WorkspaceExample: grpcWorkspaceTemplate,
BuildExample: protoCompileExampleTemplate,
Doc: "Generates C protobuf ``.h`` & ``.c`` files",
Attrs: compileRuleAttrs,
@ -95,7 +87,7 @@ func makeC() *Language {
Name: "c_proto_library",
Kind: "proto",
Implementation: cProtoLibraryRuleTemplate,
WorkspaceExample: cWorkspaceTemplate,
WorkspaceExample: grpcWorkspaceTemplate,
BuildExample: cProtoLibraryExampleTemplate,
Doc: "Generates a C protobuf library using ``cc_library``, with dependencies linked",
Attrs: cppLibraryRuleAttrs,