ProtoCompiler podspec

Still needed:

- Make it build protoc if it’s not in the root (i.e. if we're developing locally)
- Put the gRPC plugin in the GitHub release page, and add a podspec for it that does the same
pull/7313/head
Jorge Canizales 9 years ago
parent 60fec9e547
commit 3e53e1a5be
  1. 56
      src/objective-c/ProtoCompiler.podspec
  2. 1
      src/objective-c/tests/Podfile
  3. 13
      src/objective-c/tests/RemoteTestClient/RemoteTest.podspec

@ -0,0 +1,56 @@
# BoringSSL CocoaPods podspec
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Pod::Spec.new do |s|
s.name = 'ProtoCompiler'
v = '3.0.0-beta-3.1'
s.version = v
s.summary = 'The Protobuf Compiler (protoc) generates Objective-C files from .proto files'
s.description = <<-DESC
This podspec only downloads protoc so that local pods generating protos can execute it as part
of their prepare_command.
The generated code will have a dependency on the Protobuf Objective-C runtime of the same
version. The runtime can be obtained as the "Protobuf" pod.
DESC
s.homepage = 'https://github.com/google/protobuf'
s.license = 'New BSD'
# "The name and email addresses of the library maintainers, not the Podspec maintainer."
s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
s.source = {
:http => "https://github.com/google/protobuf/releases/download/v#{v}/protoc-#{v}-osx-fat.zip",
# TODO(jcanizales): Add sha1 or sha256
# :sha1 => '??',
}
s.preserve_paths = 'protoc',
'google/**/*.proto' # Well-known protobuf types
end

@ -17,6 +17,7 @@ GRPC_LOCAL_SRC = '../../..'
).each do |target_name|
target target_name do
pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true
pod 'ProtoCompiler', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
pod 'BoringSSL', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
pod 'gRPC', :path => GRPC_LOCAL_SRC

@ -11,13 +11,18 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
repo_root = '../../../..'
pods_root = "#{repo_root}/src/objective-c/tests/Pods"
bin_dir = "#{repo_root}/bins/$CONFIG"
protoc = "#{pods_root}/ProtoCompiler/protoc" # "#{bin_dir}/protobuf/protoc"
plugin = "#{bin_dir}/grpc_objective_c_plugin"
s.prepare_command = <<-CMD
BINDIR=../../../../bins/$CONFIG
PROTOC=$BINDIR/protobuf/protoc
PLUGIN=$BINDIR/grpc_objective_c_plugin
$PROTOC --plugin=protoc-gen-grpc=$PLUGIN --objc_out=. --grpc_out=. *.proto
#{protoc} --plugin=protoc-gen-grpc=#{plugin} --objc_out=. --grpc_out=. *.proto
CMD
s.dependency "ProtoCompiler", "~> 3.0.0-beta-3.1"
s.subspec "Messages" do |ms|
ms.source_files = "*.pbobjc.{h,m}"
ms.header_mappings_dir = "."

Loading…
Cancel
Save