1Pod::Spec.new do |s| 2 s.name = "HelloWorld" 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 = "HelloWorld example" 8 s.source = { :git => 'https://github.com/grpc/grpc.git' } 9 10 s.ios.deployment_target = "7.1" 11 s.osx.deployment_target = "10.9" 12 13 # Base directory where the .proto files are. 14 src = "../../protos" 15 16 # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. 17 s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0" 18 19 # Pods directory corresponding to this app's Podfile, relative to the location of this podspec. 20 pods_root = 'Pods' 21 22 # Path where Cocoapods downloads protoc and the gRPC plugin. 23 protoc_dir = "#{pods_root}/!ProtoCompiler" 24 protoc = "#{protoc_dir}/protoc" 25 plugin = "#{pods_root}/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin" 26 27 # Directory where the generated files will be placed. 28 dir = "#{pods_root}/#{s.name}" 29 30 s.prepare_command = <<-CMD 31 mkdir -p #{dir} 32 #{protoc} \ 33 --plugin=protoc-gen-grpc=#{plugin} \ 34 --objc_out=#{dir} \ 35 --grpc_out=#{dir} \ 36 -I #{src} \ 37 -I #{protoc_dir} \ 38 #{src}/helloworld.proto 39 CMD 40 41 # Files generated by protoc 42 s.subspec "Messages" do |ms| 43 ms.source_files = "#{dir}/*.pbobjc.{h,m}", "#{dir}/**/*.pbobjc.{h,m}" 44 ms.header_mappings_dir = dir 45 ms.requires_arc = false 46 # The generated files depend on the protobuf runtime. 47 ms.dependency "Protobuf" 48 end 49 50 # Files generated by the gRPC plugin 51 s.subspec "Services" do |ss| 52 ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}" 53 ss.header_mappings_dir = dir 54 ss.requires_arc = true 55 # The generated files depend on the gRPC runtime, and on the files generated by protoc. 56 ss.dependency "gRPC-ProtoRPC" 57 ss.dependency "#{s.name}/Messages" 58 end 59 60 s.pod_target_xcconfig = { 61 # This is needed by all pods that depend on Protobuf: 62 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', 63 # This is needed by all pods that depend on gRPC-RxLibrary: 64 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 65 } 66end 67