|
|
@ -38,11 +38,27 @@ bad_header_names = ('time.h', 'string.h') |
|
|
|
def fix_header_name(name): |
|
|
|
def fix_header_name(name): |
|
|
|
split_name = name.split('/') |
|
|
|
split_name = name.split('/') |
|
|
|
if split_name[-1] in bad_header_names: |
|
|
|
if split_name[-1] in bad_header_names: |
|
|
|
return '/'.join(split_name[:-1] + ['grpc_' + split_name[-1]]) |
|
|
|
split_name[-1] = 'grpc_' + split_name[-1] |
|
|
|
else: |
|
|
|
if split_name[0] == 'include': |
|
|
|
return name |
|
|
|
split_name = split_name[1:] |
|
|
|
|
|
|
|
return '/'.join(split_name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def grpc_files(libs): |
|
|
|
|
|
|
|
out = [] |
|
|
|
|
|
|
|
for lib in libs: |
|
|
|
|
|
|
|
if lib.name in ("grpc", "gpr"): |
|
|
|
|
|
|
|
out.extend(fix_header_name(h) for h in lib.get('headers', [])) |
|
|
|
|
|
|
|
out.extend(fix_header_name(h) for h in lib.get('public_headers', [])) |
|
|
|
|
|
|
|
out.extend(lib.get('src', [])) |
|
|
|
|
|
|
|
return out; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def grpc_private_headers(libs): |
|
|
|
|
|
|
|
out = [] |
|
|
|
|
|
|
|
for lib in libs: |
|
|
|
|
|
|
|
if lib.name in ("grpc", "gpr"): |
|
|
|
|
|
|
|
out.extend(lib.get('headers', [])) |
|
|
|
|
|
|
|
return out |
|
|
|
%> |
|
|
|
%> |
|
|
|
|
|
|
|
|
|
|
|
Pod::Spec.new do |s| |
|
|
|
Pod::Spec.new do |s| |
|
|
|
s.name = 'gRPC' |
|
|
|
s.name = 'gRPC' |
|
|
|
s.version = '0.6.0' |
|
|
|
s.version = '0.6.0' |
|
|
@ -58,53 +74,27 @@ Pod::Spec.new do |s| |
|
|
|
s.osx.deployment_target = '10.8' |
|
|
|
s.osx.deployment_target = '10.8' |
|
|
|
s.requires_arc = true |
|
|
|
s.requires_arc = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
objc_dir = 'src/objective-c' |
|
|
|
|
|
|
|
|
|
|
|
# Reactive Extensions library for iOS. |
|
|
|
# Reactive Extensions library for iOS. |
|
|
|
s.subspec 'RxLibrary' do |rs| |
|
|
|
s.subspec 'RxLibrary' do |ss| |
|
|
|
rs.source_files = 'src/objective-c/RxLibrary/*.{h,m}', |
|
|
|
src_dir = "#{objc_dir}/RxLibrary" |
|
|
|
'src/objective-c/RxLibrary/transformations/*.{h,m}', |
|
|
|
ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" |
|
|
|
'src/objective-c/RxLibrary/private/*.{h,m}' |
|
|
|
ss.private_header_files = "#{src_dir}/private/*.h" |
|
|
|
rs.private_header_files = 'src/objective-c/RxLibrary/private/*.h' |
|
|
|
ss.header_mappings_dir = "#{objc_dir}" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# Core cross-platform gRPC library, written in C. |
|
|
|
# Core cross-platform gRPC library, written in C. |
|
|
|
s.subspec 'C-Core' do |cs| |
|
|
|
s.subspec 'C-Core' do |ss| |
|
|
|
cs.source_files = \ |
|
|
|
ss.source_files = ${(',\n' + 22*' ').join('\'%s\'' % f for f in grpc_files(libs))} |
|
|
|
% for lib in libs: |
|
|
|
|
|
|
|
% if lib.name in ("grpc", "gpr"): |
|
|
|
ss.private_header_files = ${(',\n' + 30*' ').join('\'%s\'' % f for f in grpc_private_headers(libs))} |
|
|
|
% for hdr in lib.get("headers", []): |
|
|
|
|
|
|
|
'${fix_header_name(hdr)}', \ |
|
|
|
ss.header_mappings_dir = '.' |
|
|
|
% endfor |
|
|
|
|
|
|
|
% for hdr in lib.get("public_headers", []): |
|
|
|
ss.requires_arc = false |
|
|
|
'${fix_header_name(hdr)}', \ |
|
|
|
ss.libraries = 'z' |
|
|
|
% endfor |
|
|
|
ss.dependency 'OpenSSL', '~> 1.0.200' |
|
|
|
% for src in lib.src: |
|
|
|
|
|
|
|
'${src}', \ |
|
|
|
|
|
|
|
% endfor |
|
|
|
|
|
|
|
% endif |
|
|
|
|
|
|
|
% endfor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cs.private_header_files = \ |
|
|
|
|
|
|
|
% for lib in libs: |
|
|
|
|
|
|
|
% if lib.name in ("grpc", "gpr"): |
|
|
|
|
|
|
|
% for hdr in lib.get("headers", []): |
|
|
|
|
|
|
|
'${hdr}', \ |
|
|
|
|
|
|
|
% endfor |
|
|
|
|
|
|
|
% endif |
|
|
|
|
|
|
|
% endfor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cs.header_mappings_dir = '.' |
|
|
|
|
|
|
|
# The core library includes its headers as either "src/core/..." or "grpc/...", meaning we have |
|
|
|
|
|
|
|
# to tell XCode to look for headers under the "include" subdirectory too. |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# TODO(jcanizales): Instead of doing this, during installation move everything under |
|
|
|
|
|
|
|
# "include/grpc" one directory up. The directory names under PODS_ROOT are implementation |
|
|
|
|
|
|
|
# details of Cocoapods, and have changed in the past, breaking this podspec. |
|
|
|
|
|
|
|
cs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Private/gRPC" ' + |
|
|
|
|
|
|
|
'"$(PODS_ROOT)/Headers/Private/gRPC/include"' } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cs.requires_arc = false |
|
|
|
|
|
|
|
cs.libraries = 'z' |
|
|
|
|
|
|
|
cs.dependency 'OpenSSL', '~> 1.0.200' |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# This is a workaround for Cocoapods Issue #1437. |
|
|
|
# This is a workaround for Cocoapods Issue #1437. |
|
|
@ -112,12 +102,15 @@ Pod::Spec.new do |s| |
|
|
|
# It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run |
|
|
|
# It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run |
|
|
|
# prepare_command's of subspecs. |
|
|
|
# prepare_command's of subspecs. |
|
|
|
# |
|
|
|
# |
|
|
|
# TODO(jcanizales): Try out Todd Reed's solution at Issue #1437. |
|
|
|
# TODO(jcanizales): Try out others' solutions at Issue #1437. |
|
|
|
s.prepare_command = <<-CMD |
|
|
|
s.prepare_command = <<-CMD |
|
|
|
|
|
|
|
# Move contents of include up a level to avoid manually specifying include paths |
|
|
|
|
|
|
|
cp -r "include/grpc" "." |
|
|
|
|
|
|
|
|
|
|
|
DIR_TIME="grpc/support" |
|
|
|
DIR_TIME="grpc/support" |
|
|
|
BAD_TIME="$DIR_TIME/time.h" |
|
|
|
BAD_TIME="$DIR_TIME/time.h" |
|
|
|
GOOD_TIME="$DIR_TIME/grpc_time.h" |
|
|
|
GOOD_TIME="$DIR_TIME/grpc_time.h" |
|
|
|
grep -rl "$BAD_TIME" include/grpc src/core | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g |
|
|
|
grep -rl "$BAD_TIME" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g |
|
|
|
if [ -f "include/$BAD_TIME" ]; |
|
|
|
if [ -f "include/$BAD_TIME" ]; |
|
|
|
then |
|
|
|
then |
|
|
|
mv -f "include/$BAD_TIME" "include/$GOOD_TIME" |
|
|
|
mv -f "include/$BAD_TIME" "include/$GOOD_TIME" |
|
|
@ -126,7 +119,7 @@ Pod::Spec.new do |s| |
|
|
|
DIR_STRING="src/core/support" |
|
|
|
DIR_STRING="src/core/support" |
|
|
|
BAD_STRING="$DIR_STRING/string.h" |
|
|
|
BAD_STRING="$DIR_STRING/string.h" |
|
|
|
GOOD_STRING="$DIR_STRING/grpc_string.h" |
|
|
|
GOOD_STRING="$DIR_STRING/grpc_string.h" |
|
|
|
grep -rl "$BAD_STRING" include/grpc src/core | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g |
|
|
|
grep -rl "$BAD_STRING" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g |
|
|
|
if [ -f "$BAD_STRING" ]; |
|
|
|
if [ -f "$BAD_STRING" ]; |
|
|
|
then |
|
|
|
then |
|
|
|
mv -f "$BAD_STRING" "$GOOD_STRING" |
|
|
|
mv -f "$BAD_STRING" "$GOOD_STRING" |
|
|
@ -134,28 +127,27 @@ Pod::Spec.new do |s| |
|
|
|
CMD |
|
|
|
CMD |
|
|
|
|
|
|
|
|
|
|
|
# Objective-C wrapper around the core gRPC library. |
|
|
|
# Objective-C wrapper around the core gRPC library. |
|
|
|
s.subspec 'GRPCClient' do |gs| |
|
|
|
s.subspec 'GRPCClient' do |ss| |
|
|
|
gs.source_files = 'src/objective-c/GRPCClient/*.{h,m}', |
|
|
|
src_dir = "#{objc_dir}/GRPCClient" |
|
|
|
'src/objective-c/GRPCClient/private/*.{h,m}' |
|
|
|
ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" |
|
|
|
gs.private_header_files = 'src/objective-c/GRPCClient/private/*.h' |
|
|
|
ss.private_header_files = "#{src_dir}/private/*.h" |
|
|
|
gs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' |
|
|
|
ss.header_mappings_dir = "#{objc_dir}" |
|
|
|
|
|
|
|
|
|
|
|
gs.dependency 'gRPC/C-Core' |
|
|
|
ss.dependency 'gRPC/C-Core' |
|
|
|
# TODO(jcanizales): Remove this when the prepare_command moves everything under "include/grpc" |
|
|
|
ss.dependency 'gRPC/RxLibrary' |
|
|
|
# one directory up. |
|
|
|
|
|
|
|
gs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Public/gRPC/include"' } |
|
|
|
|
|
|
|
gs.dependency 'gRPC/RxLibrary' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Certificates, to be able to establish TLS connections: |
|
|
|
# Certificates, to be able to establish TLS connections: |
|
|
|
gs.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } |
|
|
|
ss.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# RPC library for ProtocolBuffers, based on gRPC |
|
|
|
# RPC library for ProtocolBuffers, based on gRPC |
|
|
|
s.subspec 'ProtoRPC' do |ps| |
|
|
|
s.subspec 'ProtoRPC' do |ss| |
|
|
|
ps.source_files = 'src/objective-c/ProtoRPC/*.{h,m}' |
|
|
|
src_dir = "#{objc_dir}/ProtoRPC" |
|
|
|
|
|
|
|
ss.source_files = "#{src_dir}/*.{h,m}" |
|
|
|
ps.dependency 'gRPC/GRPCClient' |
|
|
|
ss.header_mappings_dir = "#{objc_dir}" |
|
|
|
ps.dependency 'gRPC/RxLibrary' |
|
|
|
|
|
|
|
ps.dependency 'Protobuf', '~> 3.0.0-alpha-3' |
|
|
|
ss.dependency 'gRPC/GRPCClient' |
|
|
|
|
|
|
|
ss.dependency 'gRPC/RxLibrary' |
|
|
|
|
|
|
|
ss.dependency 'Protobuf', '~> 3.0.0-alpha-3' |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|