From ea9b4fdd270e47a2b3cb63dfca01c0477e0b0c6a Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Sun, 21 Jun 2015 13:37:28 -0700 Subject: Move header_mappings_dir one dir up so imports are like Part of fixing https://github.com/grpc/grpc/issues/2192 --- templates/gRPC.podspec.template | 59 ++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'templates/gRPC.podspec.template') diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index f59b6a9ab1..b26462f913 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -43,7 +43,6 @@ def fix_header_name(name): split_name = split_name[1:] return '/'.join(split_name) %> - Pod::Spec.new do |s| s.name = 'gRPC' s.version = '0.6.0' @@ -59,17 +58,19 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.8' s.requires_arc = true + objc_dir = 'src/objective-c' + # Reactive Extensions library for iOS. - s.subspec 'RxLibrary' do |rs| - rs.source_files = 'src/objective-c/RxLibrary/*.{h,m}', - 'src/objective-c/RxLibrary/transformations/*.{h,m}', - 'src/objective-c/RxLibrary/private/*.{h,m}' - rs.private_header_files = 'src/objective-c/RxLibrary/private/*.h' + s.subspec 'RxLibrary' do |ss| + src_dir = "#{objc_dir}/RxLibrary" + ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/private/*.h" + ss.header_mappings_dir = "#{objc_dir}" end # Core cross-platform gRPC library, written in C. - s.subspec 'C-Core' do |cs| - cs.source_files = \ + s.subspec 'C-Core' do |ss| + ss.source_files = \ % for lib in libs: % if lib.name in ("grpc", "gpr"): % for hdr in lib.get("headers", []): @@ -84,7 +85,7 @@ Pod::Spec.new do |s| % endif % endfor - cs.private_header_files = \ + ss.private_header_files = \ % for lib in libs: % if lib.name in ("grpc", "gpr"): % for hdr in lib.get("headers", []): @@ -93,11 +94,11 @@ Pod::Spec.new do |s| % endif % endfor - cs.header_mappings_dir = '.' + ss.header_mappings_dir = '.' - cs.requires_arc = false - cs.libraries = 'z' - cs.dependency 'OpenSSL', '~> 1.0.200' + ss.requires_arc = false + ss.libraries = 'z' + ss.dependency 'OpenSSL', '~> 1.0.200' end # This is a workaround for Cocoapods Issue #1437. @@ -105,7 +106,7 @@ Pod::Spec.new do |s| # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run # 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 # Move contents of include up a level to avoid manually specifying include paths cp -r "include/grpc" "." @@ -130,25 +131,27 @@ Pod::Spec.new do |s| CMD # Objective-C wrapper around the core gRPC library. - s.subspec 'GRPCClient' do |gs| - gs.source_files = 'src/objective-c/GRPCClient/*.{h,m}', - 'src/objective-c/GRPCClient/private/*.{h,m}' - gs.private_header_files = 'src/objective-c/GRPCClient/private/*.h' - gs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' + s.subspec 'GRPCClient' do |ss| + src_dir = "#{objc_dir}/GRPCClient" + ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}" + ss.private_header_files = "#{src_dir}/private/*.h" + ss.header_mappings_dir = "#{objc_dir}" - gs.dependency 'gRPC/C-Core' - gs.dependency 'gRPC/RxLibrary' + ss.dependency 'gRPC/C-Core' + ss.dependency 'gRPC/RxLibrary' # Certificates, to be able to establish TLS connections: - gs.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } + ss.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } end # RPC library for ProtocolBuffers, based on gRPC - s.subspec 'ProtoRPC' do |ps| - ps.source_files = 'src/objective-c/ProtoRPC/*.{h,m}' - - ps.dependency 'gRPC/GRPCClient' - ps.dependency 'gRPC/RxLibrary' - ps.dependency 'Protobuf', '~> 3.0.0-alpha-3' + s.subspec 'ProtoRPC' do |ss| + src_dir = "#{objc_dir}/ProtoRPC" + ss.source_files = "#{src_dir}/*.{h,m}" + ss.header_mappings_dir = "#{objc_dir}" + + ss.dependency 'gRPC/GRPCClient' + ss.dependency 'gRPC/RxLibrary' + ss.dependency 'Protobuf', '~> 3.0.0-alpha-3' end end -- cgit v1.2.3