aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2015-06-29 10:33:45 -0700
committerGravatar Michael Lumish <mlumish@google.com>2015-06-29 10:33:45 -0700
commit587b5f6b7618b05620797aca6a45f3461a3eb047 (patch)
tree948d5be1d61926ce9311e26920a8ff4d8cc9520b
parent6d3fc9573ef62fa151d58ff49dfdc7c9e9c22155 (diff)
parentbba8076ed4539205c5ecaaff31fae0571bd199f3 (diff)
Merge pull request #2240 from jcanizales/bazel-grpc-client
Add Bazel target for the GRPCClient library
-rw-r--r--BUILD60
-rw-r--r--gRPC.podspec2
-rw-r--r--src/objective-c/GRPCClient/private/GRPCSecureChannel.m6
-rw-r--r--templates/BUILD.template60
-rw-r--r--templates/gRPC.podspec.template2
5 files changed, 93 insertions, 37 deletions
diff --git a/BUILD b/BUILD
index 83130eabb3..934146f57e 100644
--- a/BUILD
+++ b/BUILD
@@ -1212,24 +1212,50 @@ objc_path = "src/objective-c"
rx_library_path = objc_path + "/RxLibrary"
objc_library(
- name = "rx_library",
- hdrs = glob([
- rx_library_path + "/*.h",
- rx_library_path + "/transformations/*.h",
- ]),
- srcs = glob([
- rx_library_path + "/*.m",
- rx_library_path + "/transformations/*.m",
- ]),
- includes = [objc_path],
- deps = [
- ":rx_library_private",
- ],
+ name = "rx_library",
+ hdrs = glob([
+ rx_library_path + "/*.h",
+ rx_library_path + "/transformations/*.h",
+ ]),
+ srcs = glob([
+ rx_library_path + "/*.m",
+ rx_library_path + "/transformations/*.m",
+ ]),
+ includes = [objc_path],
+ deps = [
+ ":rx_library_private",
+ ],
+)
+
+objc_library(
+ name = "rx_library_private",
+ hdrs = glob([rx_library_path + "/private/*.h"]),
+ srcs = glob([rx_library_path + "/private/*.m"]),
+ visibility = ["//visibility:private"],
)
+objc_client_path = objc_path + "/GRPCClient"
+
objc_library(
- name = "rx_library_private",
- hdrs = glob([rx_library_path + "/private/*.h"]),
- srcs = glob([rx_library_path + "/private/*.m"]),
- visibility = ["//visibility:private"],
+ name = "grpc_client",
+ hdrs = glob([
+ objc_client_path + "/*.h",
+ objc_client_path + "/private/*.h",
+ ]),
+ srcs = glob([
+ objc_client_path + "/*.m",
+ objc_client_path + "/private/*.m",
+ ]),
+ includes = [objc_path],
+ bundles = [":gRPCCertificates"],
+ deps = [
+ ":grpc_objc",
+ ":rx_library",
+ ],
+)
+
+objc_bundle_library(
+ # The choice of name is signicant here, since it determines the bundle name.
+ name = "gRPCCertificates",
+ resources = ["etc/roots.pem"],
)
diff --git a/gRPC.podspec b/gRPC.podspec
index 37b52dea1b..1a4dfd4c9a 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -520,7 +520,7 @@ Pod::Spec.new do |s|
ss.dependency 'gRPC/RxLibrary'
# Certificates, to be able to establish TLS connections:
- ss.resource_bundles = { 'gRPC' => ['etc/roots.pem'] }
+ ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] }
end
# RPC library for ProtocolBuffers, based on gRPC
diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m
index 0f6eece885..43a8bd539e 100644
--- a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m
@@ -43,8 +43,12 @@
dispatch_once(&loading, ^{
// Do not use NSBundle.mainBundle, as it's nil for tests of library projects.
NSBundle *bundle = [NSBundle bundleForClass:self.class];
- NSString *certsPath = [bundle pathForResource:@"gRPC.bundle/roots" ofType:@"pem"];
+ NSString *certsPath = [bundle pathForResource:@"gRPCCertificates.bundle/roots" ofType:@"pem"];
+ NSAssert(certsPath.length,
+ @"gRPCCertificates.bundle/roots.pem not found under %@. This file, with the root "
+ "certificates, is needed to establish TLS (HTTPS) connections.", bundle.bundlePath);
NSData *certsData = [NSData dataWithContentsOfFile:certsPath];
+ NSAssert(certsData.length, @"No data read from %@", certsPath);
NSString *certsString = [[NSString alloc] initWithData:certsData encoding:NSUTF8StringEncoding];
kCredentials = grpc_ssl_credentials_create(certsString.UTF8String, NULL);
});
diff --git a/templates/BUILD.template b/templates/BUILD.template
index 76f06c2caa..4d2bf7db28 100644
--- a/templates/BUILD.template
+++ b/templates/BUILD.template
@@ -158,24 +158,50 @@ objc_path = "src/objective-c"
rx_library_path = objc_path + "/RxLibrary"
objc_library(
- name = "rx_library",
- hdrs = glob([
- rx_library_path + "/*.h",
- rx_library_path + "/transformations/*.h",
- ]),
- srcs = glob([
- rx_library_path + "/*.m",
- rx_library_path + "/transformations/*.m",
- ]),
- includes = [objc_path],
- deps = [
- ":rx_library_private",
- ],
+ name = "rx_library",
+ hdrs = glob([
+ rx_library_path + "/*.h",
+ rx_library_path + "/transformations/*.h",
+ ]),
+ srcs = glob([
+ rx_library_path + "/*.m",
+ rx_library_path + "/transformations/*.m",
+ ]),
+ includes = [objc_path],
+ deps = [
+ ":rx_library_private",
+ ],
)
objc_library(
- name = "rx_library_private",
- hdrs = glob([rx_library_path + "/private/*.h"]),
- srcs = glob([rx_library_path + "/private/*.m"]),
- visibility = ["//visibility:private"],
+ name = "rx_library_private",
+ hdrs = glob([rx_library_path + "/private/*.h"]),
+ srcs = glob([rx_library_path + "/private/*.m"]),
+ visibility = ["//visibility:private"],
+)
+
+objc_client_path = objc_path + "/GRPCClient"
+
+objc_library(
+ name = "grpc_client",
+ hdrs = glob([
+ objc_client_path + "/*.h",
+ objc_client_path + "/private/*.h",
+ ]),
+ srcs = glob([
+ objc_client_path + "/*.m",
+ objc_client_path + "/private/*.m",
+ ]),
+ includes = [objc_path],
+ bundles = [":gRPCCertificates"],
+ deps = [
+ ":grpc_objc",
+ ":rx_library",
+ ],
+)
+
+objc_bundle_library(
+ # The choice of name is signicant here, since it determines the bundle name.
+ name = "gRPCCertificates",
+ resources = ["etc/roots.pem"],
)
diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template
index 02e90d7180..deea07cee3 100644
--- a/templates/gRPC.podspec.template
+++ b/templates/gRPC.podspec.template
@@ -137,7 +137,7 @@ Pod::Spec.new do |s|
ss.dependency 'gRPC/RxLibrary'
# Certificates, to be able to establish TLS connections:
- ss.resource_bundles = { 'gRPC' => ['etc/roots.pem'] }
+ ss.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] }
end
# RPC library for ProtocolBuffers, based on gRPC