package_json = JSON.parse(open("./package.json").read) Pod::Spec.new do |s| s.name = "RNGrpcService" s.version = package_json["version"] s.summary = "RNGrpcService" s.description = package_json["description"] s.homepage = "https://github.com/quarrant/react-native-grpc-service/blob/master/README.md" s.license = package_json["license"] s.author = { "author" => "author@domain.cn" } s.platform = :ios, "9.0" s.source = { :git => "https://github.com/quarrant/react-native-grpc-service.git", :tag => "master" } s.source_files = "ios/*.{h,m}", "ios/**/*.{h,m}" s.requires_arc = true # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0" s.dependency "React" # Pods directory corresponding to this app's Podfile, relative to the location of this podspec. pods_directory = "../../ios/Pods" pods_proto_directory = "#{pods_directory}/!ProtoCompiler" pods_protoc = "#{pods_proto_directory}/protoc" pods_protoc_plugin = "#{pods_directory}/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin" protoDir = "." protoFile = "example.proto" s.prepare_command = <<-CMD mkdir -p ios/proto #{pods_protoc} \ --plugin=protoc-gen-grpc=#{pods_protoc_plugin} \ --objc_out=ios/proto \ --grpc_out=ios/proto \ -I ../../#{protoDir} \ -I #{pods_proto_directory} \ ../../#{protoDir}/#{protoFile} CMD s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' } end