update BUILD following the new style

pull/19704/head
Muxi Yan 5 years ago
parent f5cd8eb7c8
commit de3131016d
  1. 9
      bazel/grpc_build_system.bzl
  2. 4
      src/compiler/objective_c_plugin.cc
  3. 159
      src/objective-c/BUILD
  4. 2
      src/objective-c/ProtoRPC/ProtoService.m

@ -24,7 +24,6 @@
# #
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
# The set of pollers to test against if a test exercises polling # The set of pollers to test against if a test exercises polling
@ -199,12 +198,6 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da
) )
def grpc_generate_one_off_targets(): def grpc_generate_one_off_targets():
apple_resource_bundle(
# The choice of name is signicant here, since it determines the bundle name.
name = "gRPCCertificates",
resources = ["etc/roots.pem"],
)
# In open-source, grpc_objc* libraries depend directly on //:grpc # In open-source, grpc_objc* libraries depend directly on //:grpc
native.alias( native.alias(
name = "grpc_objc", name = "grpc_objc",
@ -256,7 +249,7 @@ def grpc_package(name, visibility = "private", features = []):
def grpc_objc_library( def grpc_objc_library(
name, name,
srcs, srcs = [],
hdrs = [], hdrs = [],
textual_hdrs = [], textual_hdrs = [],
data = [], data = [],

@ -205,10 +205,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
::grpc::string imports; ::grpc::string imports;
if (framework.empty()) { if (framework.empty()) {
imports = LocalImport(file_name + ".pbrpc.h") + imports = LocalImport(file_name + ".pbrpc.h") +
LocalImport(file_name + ".pbobjc.h") + LocalImport(file_name + ".pbobjc.h");
} else { } else {
imports = FrameworkImport(file_name + ".pbrpc.h", framework) + imports = FrameworkImport(file_name + ".pbrpc.h", framework) +
FrameworkImport(file_name + ".pbobjc.h", framework) + FrameworkImport(file_name + ".pbobjc.h", framework);
} }
imports += (generator_params.no_v1_compatibility imports += (generator_params.no_v1_compatibility
? SystemImport("ProtoRPC/ProtoRPC.h") ? SystemImport("ProtoRPC/ProtoRPC.h")

@ -24,18 +24,26 @@ exports_files(["LICENSE"])
grpc_objc_use_cronet_config() grpc_objc_use_cronet_config()
grpc_objc_library(
name = "rx_library_headers",
hdrs = glob([
"RxLibrary/*.h",
"RxLibrary/transformations/*.h",
]),
includes = ["."],
)
grpc_objc_library( grpc_objc_library(
name = "rx_library", name = "rx_library",
srcs = glob([ srcs = glob([
"RxLibrary/*.m", "RxLibrary/*.m",
"RxLibrary/transformations/*.m", "RxLibrary/transformations/*.m",
]), ]),
hdrs = glob([
"RxLibrary/*.h",
"RxLibrary/transformations/*.h",
]),
includes = ["."], includes = ["."],
deps = [":rx_library_private"], deps = [
":rx_library_private",
":rx_library_headers",
],
) )
grpc_objc_library( grpc_objc_library(
@ -50,47 +58,128 @@ grpc_objc_library(
) )
grpc_objc_library( grpc_objc_library(
name = "grpc_objc_client", name = "grpc_objc_interface_legacy",
srcs = glob( hdrs = [
[ "GRPCClient/GRPCCallLegacy.h",
"GRPCClient/*.m", "GRPCClient/GRPCTypes.h",
"GRPCClient/private/*.m", ],
], deps = [
exclude = ["GRPCClient/GRPCCall+GID.m"], "rx_library_headers",
), ],
hdrs = glob( )
[
"GRPCClient/*.h", grpc_objc_library(
"GRPCClient/internal/*.h", name = "grpc_objc_interface",
], hdrs = [
exclude = ["GRPCClient/GRPCCall+GID.h"], "GRPCClient/GRPCCall.h",
), "GRPCClient/GRPCCall+Interceptor.h",
data = ["//:gRPCCertificates"], "GRPCClient/GRPCCallOptions.h",
"GRPCClient/GRPCInterceptor.h",
"GRPCClient/GRPCTransport.h",
"GRPCClient/GRPCDispatchable.h",
"GRPCClient/internal/GRPCCallOptions+Internal.h",
],
srcs = [
"GRPCClient/GRPCCall.m",
"GRPCClient/GRPCCall+Interceptor.m",
"GRPCClient/GRPCCallOptions.m",
"GRPCClient/GRPCInterceptor.m",
"GRPCClient/GRPCTransport.m",
"GRPCClient/private/GRPCTransport+Private.m",
],
includes = ["."], includes = ["."],
textual_hdrs = glob([ textual_hdrs = [
"GRPCClient/private/*.h", "GRPCClient/private/GRPCTransport+Private.h",
]), ],
deps = [ deps = [
":grpc_objc_interface_legacy",
],
)
grpc_objc_library(
name = "grpc_objc_client_core",
hdrs = [
"GRPCClient/GRPCCall+ChannelCredentials.h",
"GRPCClient/GRPCCall+Cronet.h",
"GRPCClient/GRPCCall+OAuth2.h",
"GRPCClient/GRPCCall+Tests.h",
"GRPCClient/GRPCCall+ChannelArg.h",
],
textual_hdrs = native.glob(["GRPCClient/private/GRPCCore/*.h"]),
srcs = [
"GRPCClient/GRPCCall+ChannelArg.m",
"GRPCClient/GRPCCall+ChannelCredentials.m",
"GRPCClient/GRPCCall+Cronet.m",
"GRPCClient/GRPCCall+OAuth2.m",
"GRPCClient/GRPCCall+Tests.m",
"GRPCClient/GRPCCallLegacy.m",
] + native.glob(["GRPCClient/private/GRPCCore/*.m"]),
data = [":gRPCCertificates"],
includes = ["."],
deps = [
":grpc_objc_interface",
":grpc_objc_interface_legacy",
":rx_library", ":rx_library",
"//:grpc_objc", "//:grpc_objc",
], ],
) )
alias(
name = "grpc_objc_client",
actual = "grpc_objc_client_core",
)
grpc_objc_library(
name = "proto_objc_rpc_legacy_header",
hdrs = [
"ProtoRPC/ProtoRPCLegacy.h",
],
includes = ["."],
)
grpc_objc_library( grpc_objc_library(
name = "proto_objc_rpc_v2",
srcs = [
"ProtoRPC/ProtoMethod.m",
"ProtoRPC/ProtoRPC.m",
"ProtoRPC/ProtoService.m",
],
hdrs = [
"ProtoRPC/ProtoMethod.h",
"ProtoRPC/ProtoRPC.h",
"ProtoRPC/ProtoService.h",
],
includes = ["."],
deps = [
":grpc_objc_interface",
":proto_objc_rpc_legacy_header",
"@com_google_protobuf//:protobuf_objc",
],
)
native.objc_library(
name = "proto_objc_rpc", name = "proto_objc_rpc",
srcs = glob( srcs = [
["ProtoRPC/*.m"], "ProtoRPC/ProtoRPCLegacy.m",
), "ProtoRPC/ProtoServiceLegacy.m",
hdrs = glob( ],
["ProtoRPC/*.h"], hdrs = [
), "ProtoRPC/ProtoServiceLegacy.h",
# Different from Cocoapods, do not import as if @com_google_protobuf//:protobuf_objc is a framework, ],
# use the real paths of @com_google_protobuf//:protobuf_objc instead
defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"],
includes = ["src/objective-c"],
deps = [ deps = [
":grpc_objc_client",
":rx_library", ":rx_library",
":proto_objc_rpc_v2",
":proto_objc_rpc_legacy_header",
":grpc_objc_client_core",
"@com_google_protobuf//:protobuf_objc", "@com_google_protobuf//:protobuf_objc",
], ],
) )
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
apple_resource_bundle(
# The choice of name is signicant here, since it determines the bundle name.
name = "gRPCCertificates",
resources = ["etc/roots.pem"],
)

@ -39,7 +39,7 @@
[NSException raise:NSGenericException format:@"Do not call init method of ProtoService"]; [NSException raise:NSGenericException format:@"Do not call init method of ProtoService"];
return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil]; return [self initWithHost:nil packageName:nil serviceName:nil callOptions:nil];
} }
#pragma clang diasnostic pop #pragma clang diagnostic pop
// Designated initializer // Designated initializer
- (instancetype)initWithHost:(NSString *)host - (instancetype)initWithHost:(NSString *)host

Loading…
Cancel
Save