blob: fc671ef4da250b1f9e78abac41be8a5acb10831a [file] [log] [blame]
murgatroid9924754c02015-06-11 13:57:55 -07001Pod::Spec.new do |s|
2 s.name = "HelloWorld"
3 s.version = "0.0.1"
Jan Tattermusch4d5c3102017-06-07 10:23:56 +02004 s.license = "Apache License, Version 2.0"
Yuchen Zengabc74272016-06-20 14:40:57 -07005 s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
Mehrdad Afsharibb3d95b2017-07-10 22:24:28 +00006 s.homepage = "https://grpc.io/"
Yuchen Zengabc74272016-06-20 14:40:57 -07007 s.summary = "HelloWorld example"
8 s.source = { :git => 'https://github.com/grpc/grpc.git' }
murgatroid9924754c02015-06-11 13:57:55 -07009
Jorge Canizalesdfe91b52015-10-11 13:51:07 -070010 s.ios.deployment_target = "7.1"
11 s.osx.deployment_target = "10.9"
murgatroid9924754c02015-06-11 13:57:55 -070012
13 # Base directory where the .proto files are.
14 src = "../../protos"
15
murgatroid9924754c02015-06-11 13:57:55 -070016 # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
Jorge Canizales4a18c672016-08-18 13:26:25 -070017 s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0"
Jorge Canizales6eade6d2016-07-11 00:34:14 -070018
Jorge Canizales45bb7f32016-07-11 11:09:59 -070019 # Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
Jorge Canizales8f525f92016-07-11 14:23:51 -070020 pods_root = 'Pods'
Jorge Canizales6eade6d2016-07-11 00:34:14 -070021
Jorge Canizales45bb7f32016-07-11 11:09:59 -070022 # Path where Cocoapods downloads protoc and the gRPC plugin.
Jorge Canizales6eade6d2016-07-11 00:34:14 -070023 protoc_dir = "#{pods_root}/!ProtoCompiler"
24 protoc = "#{protoc_dir}/protoc"
Jorge Canizales6eade6d2016-07-11 00:34:14 -070025 plugin = "#{pods_root}/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin"
26
Jorge Canizales45bb7f32016-07-11 11:09:59 -070027 # Directory where the generated files will be placed.
28 dir = "#{pods_root}/#{s.name}"
29
murgatroid9924754c02015-06-11 13:57:55 -070030 s.prepare_command = <<-CMD
31 mkdir -p #{dir}
Jorge Canizales6eade6d2016-07-11 00:34:14 -070032 #{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
murgatroid9924754c02015-06-11 13:57:55 -070039 CMD
40
Jorge Canizales45bb7f32016-07-11 11:09:59 -070041 # Files generated by protoc
murgatroid9924754c02015-06-11 13:57:55 -070042 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 Canizales45bb7f32016-07-11 11:09:59 -070046 # The generated files depend on the protobuf runtime.
Jorge Canizales6eade6d2016-07-11 00:34:14 -070047 ms.dependency "Protobuf"
murgatroid9924754c02015-06-11 13:57:55 -070048 end
49
Jorge Canizales45bb7f32016-07-11 11:09:59 -070050 # Files generated by the gRPC plugin
murgatroid9924754c02015-06-11 13:57:55 -070051 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
Jorge Canizales45bb7f32016-07-11 11:09:59 -070055 # The generated files depend on the gRPC runtime, and on the files generated by protoc.
Jorge Canizales6eade6d2016-07-11 00:34:14 -070056 ss.dependency "gRPC-ProtoRPC"
murgatroid9924754c02015-06-11 13:57:55 -070057 ss.dependency "#{s.name}/Messages"
58 end
Jorge Canizalese4704d32016-07-18 11:08:04 -070059
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 }
murgatroid9924754c02015-06-11 13:57:55 -070066end