[bazel] Add fixes for --incompatible_load_proto_rules_from_bzl

pull/20783/head
Yannic Bonenberger 5 years ago
parent c564d28f9a
commit 06ecc87290
  1. 4
      bazel/cc_grpc_library.bzl
  2. 1
      bazel/generate_cc.bzl
  3. 1
      bazel/generate_objc.bzl
  4. 2
      bazel/protobuf.bzl
  5. 1
      bazel/python_rules.bzl
  6. 1
      bazel/test/python_test_repo/BUILD
  7. 5
      examples/BUILD
  8. 1
      examples/python/cancellation/BUILD.bazel
  9. 1
      examples/python/multiprocessing/BUILD
  10. 3
      src/objective-c/grpc_objc_internal_library.bzl
  11. 1
      src/proto/grpc/channelz/BUILD
  12. 2
      src/proto/grpc/gcp/BUILD
  13. 1
      src/proto/grpc/health/v1/BUILD
  14. 1
      src/proto/grpc/lb/v1/BUILD
  15. 1
      src/proto/grpc/reflection/v1alpha/BUILD
  16. 3
      src/proto/grpc/testing/BUILD
  17. 1
      src/proto/grpc/testing/proto2/BUILD.bazel
  18. 1
      src/python/grpcio_tests/tests/stress/BUILD.bazel
  19. 16
      third_party/py/python_configure.bzl
  20. 13
      third_party/upb/BUILD
  21. 2
      third_party/upb/bazel/upb_proto_library.bzl
  22. 1
      third_party/upb/examples/bazel/BUILD

@ -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")
@ -63,8 +64,7 @@ def cc_grpc_library(
proto_deps += [dep.split(":")[0] + ":" + "_" + dep.split(":")[1] + "_only" for dep in deps if dep.find(":") != -1]
if well_known_protos:
proto_deps += well_known_proto_libs()
native.proto_library(
proto_library(
name = proto_target,
srcs = srcs,
deps = proto_deps,

@ -4,6 +4,7 @@ This is an internal rule used by cc_grpc_library, and shouldn't be used
directly.
"""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//bazel:protobuf.bzl",
"get_include_directory",

@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//bazel:protobuf.bzl",
"get_include_directory",

@ -1,5 +1,7 @@
"""Utility functions for generating protobuf code."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
_PROTO_EXTENSION = ".proto"
_VIRTUAL_IMPORTS = "/_virtual_imports/"

@ -1,5 +1,6 @@
"""Generates and compiles Python gRPC stubs from proto_library rules."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//bazel:protobuf.bzl",
"declare_out_files",

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"@com_github_grpc_grpc//bazel:python_rules.bzl",
"py2and3_test",

@ -16,10 +16,11 @@ licenses(["notice"]) # 3-clause BSD
package(default_visibility = ["//visibility:public"])
load("//bazel:grpc_build_system.bzl", "grpc_proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//bazel:grpc_build_system.bzl", "grpc_proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
grpc_proto_library(
name = "auth_sample",

@ -15,6 +15,7 @@
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
package(default_testonly = 1)

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
proto_library(

@ -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,

@ -14,6 +14,7 @@
licenses(["notice"]) # Apache v2
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
grpc_package(

@ -14,6 +14,8 @@
licenses(["notice"]) # Apache v2
load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(
name = "alts_handshaker_proto",
srcs = [

@ -14,6 +14,7 @@
licenses(["notice"]) # Apache v2
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
grpc_package(

@ -14,6 +14,7 @@
licenses(["notice"]) # Apache v2
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
grpc_package(

@ -14,6 +14,7 @@
licenses(["notice"]) # Apache v2
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
grpc_package(

@ -14,8 +14,9 @@
licenses(["notice"]) # Apache v2
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
grpc_package(

@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"])

@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
proto_library(

@ -14,9 +14,9 @@ _PYTHON3_BIN_PATH = "PYTHON3_BIN_PATH"
_PYTHON3_LIB_PATH = "PYTHON3_LIB_PATH"
_HEADERS_HELP = (
"Are Python headers installed? Try installing python-dev or " +
"python3-dev on Debian-based systems. Try python-devel or python3-devel " +
"on Redhat-based systems."
"Are Python headers installed? Try installing python-dev or " +
"python3-dev on Debian-based systems. Try python-devel or python3-devel " +
"on Redhat-based systems."
)
def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
@ -246,11 +246,11 @@ def _get_python_include(repository_ctx, python_bin):
_execute(
repository_ctx,
[
python_bin,
"-c",
"import os;" +
"main_header = os.path.join('{}', 'Python.h');".format(include_path) +
"assert os.path.exists(main_header), main_header + ' does not exist.'"
python_bin,
"-c",
"import os;" +
"main_header = os.path.join('{}', 'Python.h');".format(include_path) +
"assert os.path.exists(main_header), main_header + ' does not exist.'",
],
error_msg = "Unable to find Python headers for {}".format(python_bin),
error_details = _HEADERS_HELP,

@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"//bazel:build_defs.bzl",
"generated_file_staleness_test",
@ -56,13 +57,13 @@ config_setting(
cc_library(
name = "port",
srcs = [
"upb/port.c",
],
textual_hdrs = [
"upb/port_def.inc",
"upb/port_undef.inc",
],
srcs = [
"upb/port.c",
],
)
cc_library(
@ -159,8 +160,8 @@ cc_library(
cc_library(
name = "legacy_msg_reflection",
srcs = [
"upb/msg.h",
"upb/legacy_msg_reflection.c",
"upb/msg.h",
],
hdrs = ["upb/legacy_msg_reflection.h"],
copts = select({
@ -190,8 +191,8 @@ cc_library(
"//conditions:default": COPTS,
}),
deps = [
":reflection",
":port",
":reflection",
":table",
":upb",
],
@ -220,8 +221,8 @@ cc_library(
deps = [
":descriptor_upbproto",
":handlers",
":reflection",
":port",
":reflection",
":table",
":upb",
],

@ -8,6 +8,7 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
# copybara:strip_for_google3_begin
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load("@upb_bazel_version//:bazel_version.bzl", "bazel_version")
# copybara:strip_end
@ -22,6 +23,7 @@ def _get_real_short_path(file):
if short_path.startswith("../"):
second_slash = short_path.index("/", 3)
short_path = short_path[second_slash + 1:]
# Sometimes it has another few prefixes like:
# _virtual_imports/any_proto/google/protobuf/any.proto
# We want just google/protobuf/any.proto.

@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
proto_library(

Loading…
Cancel
Save