diff --git a/WORKSPACE b/WORKSPACE index b48e85017ff129..92ea222b2a8b51 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,12 +2,15 @@ workspace(name = "com_github_grpc_grpc") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//bazel:grpc_deps.bzl", "grpc_deps", "grpc_test_only_deps") +load("//bazel:grpc_python_deps.bzl", "grpc_python_deps") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") grpc_deps() grpc_test_only_deps() +grpc_python_deps() + register_execution_platforms( "//third_party/toolchains:local", "//third_party/toolchains:local_large", diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index dea493eaf20160..8ffe0795352319 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -1,5 +1,6 @@ """Generates and compiles C++ grpc stubs from proto_library rules.""" +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:generate_cc.bzl", "generate_cc") load("//bazel:protobuf.bzl", "well_known_proto_libs") @@ -64,7 +65,7 @@ def cc_grpc_library( if well_known_protos: proto_deps += well_known_proto_libs() - native.proto_library( + proto_library( name = proto_target, srcs = srcs, deps = proto_deps, diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 95c639c9dbc55f..752831b533b3f7 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -106,7 +106,7 @@ def grpc_cc_library( testonly = testonly, linkopts = linkopts, includes = [ - "include", + "include", "src/core/ext/upb-generated", # Once upb code-gen issue is resolved, remove this. ], alwayslink = alwayslink, @@ -181,7 +181,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data "exec_compatible_with": exec_compatible_with, } if uses_polling: - # the vanilla version of the test should run on platforms that only + # the vanilla version of the test should run on platforms that only # support a single poller native.cc_test( name = name, @@ -317,7 +317,7 @@ def grpc_objc_library( deps: dependencies visibility: visibility, default to public """ - + native.objc_library( name = name, hdrs = hdrs, @@ -329,7 +329,7 @@ def grpc_objc_library( includes = includes, visibility = visibility, ) - + def grpc_upb_proto_library(name, deps): upb_proto_library(name = name, deps = deps) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 07ed16ef3d2ed7..8c5b5cd3c1eae4 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -61,7 +61,7 @@ def grpc_deps(): name = "gtest", actual = "@com_github_google_googletest//:gtest", ) - + native.bind( name = "benchmark", actual = "@com_github_google_benchmark//:benchmark", @@ -117,9 +117,9 @@ def grpc_deps(): if "com_google_protobuf" not in native.existing_rules(): http_archive( name = "com_google_protobuf", - sha256 = "416212e14481cff8fd4849b1c1c1200a7f34808a54377e22d7447efdf54ad758", - strip_prefix = "protobuf-09745575a923640154bcf307fba8aedff47f240a", - url = "https://github.com/google/protobuf/archive/09745575a923640154bcf307fba8aedff47f240a.tar.gz", + sha256 = "758249b537abba2f21ebc2d02555bf080917f0f2f88f4cbe2903e0e28c4187ed", + strip_prefix = "protobuf-3.10.0", + url = "https://github.com/google/protobuf/archive/v3.10.0.tar.gz", ) if "com_github_google_googletest" not in native.existing_rules(): diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index 8f00e560c4ef9e..824c92fa95295c 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -4,21 +4,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure") def grpc_python_deps(): - native.bind( - name = "six", - actual = "@six_archive//:six", - ) - - # protobuf binds to the name "six", so we can't use it here. - # See https://github.com/bazelbuild/bazel/issues/1952 for why bind is - # horrible. - if "six_archive" not in native.existing_rules(): + if "six" not in native.existing_rules(): http_archive( - name = "six_archive", - strip_prefix = "six-1.12.0", + name = "six", build_file = "@com_github_grpc_grpc//third_party:six.BUILD", sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73", - urls = ["https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"], + urls = ["https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz"], ) if "enum34" not in native.existing_rules(): diff --git a/src/objective-c/examples/BUILD b/src/objective-c/examples/BUILD index 4d838b17ba0f24..62f8040b5ead98 100644 --- a/src/objective-c/examples/BUILD +++ b/src/objective-c/examples/BUILD @@ -19,7 +19,7 @@ licenses(["notice"]) # 3-clause BSD package(default_visibility = ["//visibility:public"]) load( - "//src/objective-c:grpc_objc_internal_library.bzl", + "//src/objective-c:grpc_objc_internal_library.bzl", "grpc_objc_examples_library", "local_objc_grpc_library", "proto_library_objc_wrapper", diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index c90293d827dcdb..61b07150f057f8 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -23,6 +23,7 @@ # each change must be ported from one to the other. # +load("@rules_proto//proto:defs.bzl", "proto_library") load( "//bazel:generate_objc.bzl", "generate_objc", @@ -39,7 +40,7 @@ def proto_library_objc_wrapper( """proto_library for adding dependencies to google/protobuf protos use_well_known_protos - ignored in open source version """ - native.proto_library( + proto_library( name = name, srcs = srcs, deps = deps, diff --git a/src/proto/grpc/channelz/BUILD b/src/proto/grpc/channelz/BUILD index cfc8531de1b445..fe368069c9006e 100644 --- a/src/proto/grpc/channelz/BUILD +++ b/src/proto/grpc/channelz/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") +licenses(["notice"]) # Apache v2 + grpc_package(name = "channelz", visibility = "public") grpc_proto_library( diff --git a/src/proto/grpc/core/BUILD b/src/proto/grpc/core/BUILD index 46de9fae187d9e..00ed887ab7ea9a 100644 --- a/src/proto/grpc/core/BUILD +++ b/src/proto/grpc/core/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") +licenses(["notice"]) # Apache v2 + grpc_package(name = "core", visibility = "public") grpc_proto_library( diff --git a/src/proto/grpc/gcp/BUILD b/src/proto/grpc/gcp/BUILD index 1c22d89e464eb4..513f3f60f9f65b 100644 --- a/src/proto/grpc/gcp/BUILD +++ b/src/proto/grpc/gcp/BUILD @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_proto//proto:defs.bzl", "proto_library") + licenses(["notice"]) # Apache v2 proto_library( diff --git a/src/proto/grpc/health/v1/BUILD b/src/proto/grpc/health/v1/BUILD index fc58e8a17701e7..812b01acb5fc80 100644 --- a/src/proto/grpc/health/v1/BUILD +++ b/src/proto/grpc/health/v1/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") +licenses(["notice"]) # Apache v2 + grpc_package(name = "health", visibility = "public") grpc_proto_library( diff --git a/src/proto/grpc/lb/v1/BUILD b/src/proto/grpc/lb/v1/BUILD index 2a6e82a57e7620..a3006e022432d2 100644 --- a/src/proto/grpc/lb/v1/BUILD +++ b/src/proto/grpc/lb/v1/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library") +licenses(["notice"]) # Apache v2 + grpc_package( name = "lb", visibility = "public", diff --git a/src/proto/grpc/reflection/v1alpha/BUILD b/src/proto/grpc/reflection/v1alpha/BUILD index 5424c0d867e7ae..6ad826bd34d51c 100644 --- a/src/proto/grpc/reflection/v1alpha/BUILD +++ b/src/proto/grpc/reflection/v1alpha/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") +licenses(["notice"]) # Apache v2 + grpc_package(name = "reflection", visibility = "public") grpc_proto_library( diff --git a/src/proto/grpc/status/BUILD b/src/proto/grpc/status/BUILD index 14315d36e36d07..7d63e027235e1c 100644 --- a/src/proto/grpc/status/BUILD +++ b/src/proto/grpc/status/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") +licenses(["notice"]) # Apache v2 + grpc_package(name = "status", visibility = "public") grpc_proto_library( diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 308d4b6ed99f08..ac67b819d77c6c 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") load("@grpc_python_dependencies//:requirements.bzl", "requirement") load("//bazel:python_rules.bzl", "py_proto_library", "py_grpc_library") +licenses(["notice"]) # Apache v2 + grpc_package( name = "testing", visibility = "public", diff --git a/src/proto/grpc/testing/duplicate/BUILD b/src/proto/grpc/testing/duplicate/BUILD index 714c9a75185377..1d45f3fbec2d3c 100644 --- a/src/proto/grpc/testing/duplicate/BUILD +++ b/src/proto/grpc/testing/duplicate/BUILD @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - load("//bazel:grpc_build_system.bzl", "grpc_proto_library", "grpc_package") +licenses(["notice"]) # Apache v2 + grpc_package(name = "duplicate", visibility = "public") grpc_proto_library( diff --git a/src/proto/grpc/testing/proto2/BUILD.bazel b/src/proto/grpc/testing/proto2/BUILD.bazel index 8acb233302aca5..4559d898123fa7 100644 --- a/src/proto/grpc/testing/proto2/BUILD.bazel +++ b/src/proto/grpc/testing/proto2/BUILD.bazel @@ -1,7 +1,8 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@grpc_python_dependencies//:requirements.bzl", "requirement") +load("//bazel:python_rules.bzl", "py_proto_library") package(default_visibility = ["//visibility:public"]) -load("//bazel:python_rules.bzl", "py_proto_library") proto_library( name = "empty2_proto_descriptor", diff --git a/src/proto/grpc/testing/xds/BUILD b/src/proto/grpc/testing/xds/BUILD index b9fb013512b013..6cf43dae0b4be0 100644 --- a/src/proto/grpc/testing/xds/BUILD +++ b/src/proto/grpc/testing/xds/BUILD @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2 - +load("@rules_proto//proto:defs.bzl", "proto_library") load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library") +licenses(["notice"]) # Apache v2 + grpc_package( name = "xds", visibility = "public", diff --git a/src/python/grpcio/grpc/BUILD.bazel b/src/python/grpcio/grpc/BUILD.bazel index 1b5a018249a1b9..5a9867eb19adcf 100644 --- a/src/python/grpcio/grpc/BUILD.bazel +++ b/src/python/grpcio/grpc/BUILD.bazel @@ -14,7 +14,7 @@ py_library( "//src/python/grpcio/grpc/_cython:cygrpc", "//src/python/grpcio/grpc/experimental", "//src/python/grpcio/grpc/framework", - "@six_archive//:six", + "@six", ] + select({ "//conditions:default": ["@enum34//:enum34",], "//:python3": [], diff --git a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel index b539fa46da71a8..27503dd7614fa0 100644 --- a/src/python/grpcio/grpc/framework/foundation/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/foundation/BUILD.bazel @@ -22,7 +22,7 @@ py_library( name = "callable_util", srcs = ["callable_util.py"], deps = [ - "//external:six", + "@six", ] + select({ "//conditions:default": ["@enum34//:enum34",], "//:python3": [], @@ -33,7 +33,7 @@ py_library( name = "future", srcs = ["future.py"], deps = [ - "//external:six", + "@six", ], ) @@ -58,6 +58,6 @@ py_library( name = "stream", srcs = ["stream.py"], deps = [ - "//external:six", + "@six", ], ) diff --git a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel index 5d0c06950a84bf..4787f70ed7d4d2 100644 --- a/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/interfaces/base/BUILD.bazel @@ -14,7 +14,7 @@ py_library( srcs = ["base.py"], deps = [ "//src/python/grpcio/grpc/framework/foundation:abandonment", - "//external:six", + "@six", ] + select({ "//conditions:default": ["@enum34//:enum34",], "//:python3": [], diff --git a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel index 3af1404eade7fc..00daac365172d6 100644 --- a/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel +++ b/src/python/grpcio/grpc/framework/interfaces/face/BUILD.bazel @@ -15,7 +15,7 @@ py_library( deps = [ "//src/python/grpcio/grpc/framework/foundation", "//src/python/grpcio/grpc/framework/common", - "//external:six", + "@six", ] + select({ "//conditions:default": ["@enum34//:enum34",], "//:python3": [], diff --git a/third_party/six.BUILD b/third_party/six.BUILD index 60dc7811492d63..88c75520defbbe 100644 --- a/third_party/six.BUILD +++ b/third_party/six.BUILD @@ -1,6 +1,13 @@ +genrule( + name = "copy_six", + srcs = ["six-1.12.0/six.py"], + outs = ["__init__.py"], + cmd = "cp $< $(@)", +) + py_library( - name = "six", - srcs = ["six.py"], - srcs_version = "PY2AND3", - visibility = ["//visibility:public"], + name = "six", + srcs = ["__init__.py"], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], )