murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 1 | Pod::Spec.new do |s| |
| 2 | s.name = "HelloWorld" |
| 3 | s.version = "0.0.1" |
| 4 | s.license = "New BSD" |
Yuchen Zeng | abc7427 | 2016-06-20 14:40:57 -0700 | [diff] [blame] | 5 | s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } |
| 6 | s.homepage = "http://www.grpc.io/" |
| 7 | s.summary = "HelloWorld example" |
| 8 | s.source = { :git => 'https://github.com/grpc/grpc.git' } |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 9 | |
Jorge Canizales | dfe91b5 | 2015-10-11 13:51:07 -0700 | [diff] [blame] | 10 | s.ios.deployment_target = "7.1" |
| 11 | s.osx.deployment_target = "10.9" |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 12 | |
| 13 | # Base directory where the .proto files are. |
| 14 | src = "../../protos" |
| 15 | |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 16 | # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 17 | s.dependency "!ProtoCompiler-gRPCPlugin", "~> 0.14" |
| 18 | |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 19 | # Pods directory corresponding to this app's Podfile, relative to the location of this podspec. |
Jorge Canizales | 8f525f9 | 2016-07-11 14:23:51 -0700 | [diff] [blame] | 20 | pods_root = 'Pods' |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 21 | |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 22 | # Path where Cocoapods downloads protoc and the gRPC plugin. |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 23 | protoc_dir = "#{pods_root}/!ProtoCompiler" |
| 24 | protoc = "#{protoc_dir}/protoc" |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 25 | plugin = "#{pods_root}/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin" |
| 26 | |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 27 | # Directory where the generated files will be placed. |
| 28 | dir = "#{pods_root}/#{s.name}" |
| 29 | |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 30 | s.prepare_command = <<-CMD |
| 31 | mkdir -p #{dir} |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 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 |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 39 | CMD |
| 40 | |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 41 | # Files generated by protoc |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 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 |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 46 | # The generated files depend on the protobuf runtime. |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 47 | ms.dependency "Protobuf" |
| 48 | # This is needed by all pods that depend on Protobuf: |
| 49 | ms.pod_target_xcconfig = { |
| 50 | 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', |
| 51 | } |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 52 | end |
| 53 | |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 54 | # Files generated by the gRPC plugin |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 55 | s.subspec "Services" do |ss| |
| 56 | ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}" |
| 57 | ss.header_mappings_dir = dir |
| 58 | ss.requires_arc = true |
Jorge Canizales | 45bb7f3 | 2016-07-11 11:09:59 -0700 | [diff] [blame] | 59 | # The generated files depend on the gRPC runtime, and on the files generated by protoc. |
Jorge Canizales | 6eade6d | 2016-07-11 00:34:14 -0700 | [diff] [blame] | 60 | ss.dependency "gRPC-ProtoRPC" |
murgatroid99 | 24754c0 | 2015-06-11 13:57:55 -0700 | [diff] [blame] | 61 | ss.dependency "#{s.name}/Messages" |
| 62 | end |
| 63 | end |