|
| 1 | +commit bb0d04663c7dc6c0096f8717cb4ec26330a5ae40 |
| 2 | +Author: Yun Peng < [email protected]> |
| 3 | +Date: Wed Jun 3 15:35:31 2020 +0200 |
| 4 | + |
| 5 | + Patch grpc v1.26.0 for Bazel build |
| 6 | + |
| 7 | + - Avoid loading dependencies that're not needed for the gRPC C++ |
| 8 | + libraries |
| 9 | + - Add bazel mirror URL for upb and cares |
| 10 | + - Redirect zlib to @//third_party/zlib |
| 11 | + - Add darwin_arm64 and darwin_arm64e config settings to allow |
| 12 | + building for Apple Silicon |
| 13 | + |
| 14 | +diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl |
| 15 | +index 7bb6b8bdb9..7644107b70 100644 |
| 16 | +--- a/bazel/grpc_build_system.bzl |
| 17 | ++++ b/bazel/grpc_build_system.bzl |
| 18 | +@@ -25,7 +25,7 @@ |
| 19 | + |
| 20 | + load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") |
| 21 | + load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") |
| 22 | +-load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") |
| 23 | ++# load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") |
| 24 | + |
| 25 | + # The set of pollers to test against if a test exercises polling |
| 26 | + POLLERS = ["epollex", "epoll1", "poll"] |
| 27 | +@@ -181,13 +181,13 @@ def ios_cc_test( |
| 28 | + testonly = 1, |
| 29 | + ) |
| 30 | + ios_test_deps = [ios_test_adapter, ":" + test_lib_ios] |
| 31 | +- ios_unit_test( |
| 32 | +- name = name + "_on_ios", |
| 33 | +- size = kwargs.get("size"), |
| 34 | +- tags = ios_tags, |
| 35 | +- minimum_os_version = "9.0", |
| 36 | +- deps = ios_test_deps, |
| 37 | +- ) |
| 38 | ++ # ios_unit_test( |
| 39 | ++ # name = name + "_on_ios", |
| 40 | ++ # size = kwargs.get("size"), |
| 41 | ++ # tags = ios_tags, |
| 42 | ++ # minimum_os_version = "9.0", |
| 43 | ++ # deps = ios_test_deps, |
| 44 | ++ # ) |
| 45 | + |
| 46 | + def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = [], exec_properties = {}, shard_count = None, flaky = None): |
| 47 | + copts = if_mac(["-DGRPC_CFSTREAM"]) |
| 48 | +diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl |
| 49 | +index 09fcad95a2..9b737e5deb 100644 |
| 50 | +--- a/bazel/grpc_deps.bzl |
| 51 | ++++ b/bazel/grpc_deps.bzl |
| 52 | +@@ -33,7 +33,7 @@ def grpc_deps(): |
| 53 | + |
| 54 | + native.bind( |
| 55 | + name = "madler_zlib", |
| 56 | +- actual = "@zlib//:zlib", |
| 57 | ++ actual = "@//third_party/zlib", |
| 58 | + ) |
| 59 | + |
| 60 | + native.bind( |
| 61 | +diff --git a/bazel/grpc_extra_deps.bzl b/bazel/grpc_extra_deps.bzl |
| 62 | +index 4c1dfad2e8..f63c54ddef 100644 |
| 63 | +--- a/bazel/grpc_extra_deps.bzl |
| 64 | ++++ b/bazel/grpc_extra_deps.bzl |
| 65 | +@@ -1,11 +1,6 @@ |
| 66 | + """Loads the dependencies necessary for the external repositories defined in grpc_deps.bzl.""" |
| 67 | + |
| 68 | +-load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") |
| 69 | + load("@upb//bazel:workspace_deps.bzl", "upb_deps") |
| 70 | +-load("@envoy_api//bazel:repositories.bzl", "api_dependencies") |
| 71 | +-load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") |
| 72 | +-load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") |
| 73 | +-load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") |
| 74 | + |
| 75 | + def grpc_extra_deps(): |
| 76 | + """Loads the extra dependencies. |
| 77 | +@@ -26,15 +21,5 @@ def grpc_extra_deps(): |
| 78 | + grpc_extra_deps() |
| 79 | + ``` |
| 80 | + """ |
| 81 | +- protobuf_deps() |
| 82 | +- |
| 83 | + upb_deps() |
| 84 | + |
| 85 | +- api_dependencies() |
| 86 | +- |
| 87 | +- go_rules_dependencies() |
| 88 | +- go_register_toolchains() |
| 89 | +- |
| 90 | +- apple_rules_dependencies() |
| 91 | +- |
| 92 | +- apple_support_dependencies() |
| 93 | +diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD |
| 94 | +index c047f0c515..7c24fbc617 100644 |
| 95 | +--- a/third_party/cares/cares.BUILD |
| 96 | ++++ b/third_party/cares/cares.BUILD |
| 97 | +@@ -10,6 +10,16 @@ config_setting( |
| 98 | + values = {"cpu": "darwin_x86_64"}, |
| 99 | + ) |
| 100 | + |
| 101 | ++config_setting( |
| 102 | ++ name = "darwin_arm64", |
| 103 | ++ values = {"cpu": "darwin_arm64"}, |
| 104 | ++) |
| 105 | ++ |
| 106 | ++config_setting( |
| 107 | ++ name = "darwin_arm64e", |
| 108 | ++ values = {"cpu": "darwin_arm64e"}, |
| 109 | ++) |
| 110 | ++ |
| 111 | + config_setting( |
| 112 | + name = "windows", |
| 113 | + values = {"cpu": "x64_windows"}, |
| 114 | +@@ -99,6 +109,8 @@ copy_file( |
| 115 | + ":watchos_arm64_32": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 116 | + ":darwin": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 117 | + ":darwin_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 118 | ++ ":darwin_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 119 | ++ ":darwin_arm64e": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 120 | + ":windows": "@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h", |
| 121 | + ":android": "@com_github_grpc_grpc//third_party/cares:config_android/ares_config.h", |
| 122 | + "//conditions:default": "@com_github_grpc_grpc//third_party/cares:config_linux/ares_config.h", |
0 commit comments