1Pod::Spec.new do |s| 2 s.name = 'RemoteTest' 3 s.version = '0.0.1' 4 s.license = 'Apache License, Version 2.0' 5 s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } 6 s.homepage = 'https://grpc.io/' 7 s.summary = 'RemoteTest example' 8 s.source = { :git => 'https://github.com/grpc/grpc.git' } 9 10 s.ios.deployment_target = '9.0' 11 s.osx.deployment_target = '10.10' 12 s.tvos.deployment_target = '10.0' 13 s.watchos.deployment_target = '4.0' 14 15 # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. 16 s.dependency "!ProtoCompiler-gRPCPlugin" 17 18 repo_root = '../../../..' 19 bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin" 20 21 protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc" 22 well_known_types_dir = "#{repo_root}/third_party/protobuf/src" 23 plugin = "#{bazel_exec_root}/src/compiler/grpc_objective_c_plugin" 24 25 # Since we switched to importing full path, -I needs to be set to the directory 26 # from which the imported file can be found, which is the grpc's root here 27 if ENV['FRAMEWORKS'] != 'NO' then 28 s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' } 29 s.prepare_command = <<-CMD 30 # Cannot find file if using *.proto. Maybe files' paths must match the -I flags 31 #{protoc} \ 32 --plugin=protoc-gen-grpc=#{plugin} \ 33 --objc_out=. \ 34 --grpc_out=generate_for_named_framework=#{s.name}:. \ 35 --objc_opt=generate_for_named_framework=#{s.name} \ 36 -I #{repo_root} \ 37 -I #{well_known_types_dir} \ 38 #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto 39 CMD 40 else 41 s.prepare_command = <<-CMD 42 #{protoc} \ 43 --plugin=protoc-gen-grpc=#{plugin} \ 44 --objc_out=. \ 45 --grpc_out=. \ 46 -I #{repo_root} \ 47 -I #{well_known_types_dir} \ 48 #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto 49 CMD 50 end 51 52 s.subspec 'Messages' do |ms| 53 ms.source_files = 'src/objective-c/examples/RemoteTestClient/*.pbobjc.{h,m}' 54 ms.header_mappings_dir = '.' 55 ms.requires_arc = false 56 ms.dependency 'Protobuf' 57 end 58 59 s.subspec 'Services' do |ss| 60 ss.source_files = 'src/objective-c/examples/RemoteTestClient/*.pbrpc.{h,m}' 61 ss.header_mappings_dir = '.' 62 ss.requires_arc = true 63 ss.dependency 'gRPC-ProtoRPC' 64 ss.dependency "#{s.name}/Messages" 65 end 66 67 s.pod_target_xcconfig = { 68 # This is needed by all pods that depend on Protobuf: 69 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', 70 # This is needed by all pods that depend on gRPC-RxLibrary: 71 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 72 } 73 74end 75