• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%YAML 1.2
2--- |
3  # This file has been automatically generated from a template file.
4  # Please make modifications to
5  # `templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template`
6  # instead. This file can be regenerated from the template by running
7  # `tools/buildgen/generate_projects.sh`.
8
9  # CocoaPods podspec for the gRPC Proto Compiler Plugin
10  #
11  # Copyright 2016, Google Inc.
12  # All rights reserved.
13  #
14  # Redistribution and use in source and binary forms, with or without
15  # modification, are permitted provided that the following conditions are
16  # met:
17  #
18  #     * Redistributions of source code must retain the above copyright
19  # notice, this list of conditions and the following disclaimer.
20  #     * Redistributions in binary form must reproduce the above
21  # copyright notice, this list of conditions and the following disclaimer
22  # in the documentation and/or other materials provided with the
23  # distribution.
24  #     * Neither the name of Google Inc. nor the names of its
25  # contributors may be used to endorse or promote products derived from
26  # this software without specific prior written permission.
27  #
28  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
40  Pod::Spec.new do |s|
41    # This pod is only a utility that will be used by other pods _at install time_ (not at compile
42    # time). Other pods can access it in their `prepare_command` script, under <pods_root>/<pod name>.
43    # Because CocoaPods installs pods in alphabetical order, beginning this pod's name with an
44    # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
45    # before them.
46    s.name     = '!ProtoCompiler-gRPCPlugin'
47    v = '${settings.version}'
48    s.version  = v
49    s.summary  = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
50    s.description = <<-DESC
51      This podspec only downloads the gRPC protoc plugin so that local pods generating protos can use
52      it in their invocation of protoc, as part of their prepare_command.
53      The generated code will have a dependency on the gRPC Objective-C Proto runtime of the same
54      version. The runtime can be obtained as the "gRPC-ProtoRPC" pod.
55    DESC
56    s.homepage = 'https://grpc.io'
57    s.license  = {
58      :type => 'Apache License, Version 2.0',
59      :text => <<-LICENSE
60        Copyright 2015, Google Inc.
61        All rights reserved.
62
63        Redistribution and use in source and binary forms, with or without
64        modification, are permitted provided that the following conditions are
65        met:
66
67            * Redistributions of source code must retain the above copyright
68        notice, this list of conditions and the following disclaimer.
69            * Redistributions in binary form must reproduce the above
70        copyright notice, this list of conditions and the following disclaimer
71        in the documentation and/or other materials provided with the
72        distribution.
73            * Neither the name of Google Inc. nor the names of its
74        contributors may be used to endorse or promote products derived from
75        this software without specific prior written permission.
76
77        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
78        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
79        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
80        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
81        OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
82        SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
83        LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84        DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85        THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
87        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88      LICENSE
89    }
90    s.authors  = { 'The gRPC contributors' => 'grpc-packages@google.com' }
91
92    repo = 'grpc/grpc'
93    file = "grpc_objective_c_plugin-#{v}-macos-x86_64.zip"
94    s.source = {
95      :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}",
96      # TODO(jcanizales): Add sha1 or sha256
97      # :sha1 => '??',
98    }
99
100    repo_root = '../..'
101    plugin = 'grpc_objective_c_plugin'
102
103    s.preserve_paths = plugin
104
105    # Restrict the protoc version to the one supported by this plugin.
106    s.dependency '!ProtoCompiler', '3.6.0'
107    # For the Protobuf dependency not to complain:
108    s.ios.deployment_target = '7.0'
109    s.osx.deployment_target = '10.9'
110    # Restrict the gRPC runtime version to the one supported by this plugin.
111    s.dependency 'gRPC-ProtoRPC', v
112
113    # This is only for local development of the plugin: If the Podfile brings this pod from a local
114    # directory using `:path`, CocoaPods won't download the zip file and so the plugin won't be
115    # present in this pod's directory. We use that knowledge to check for the existence of the file
116    # and, if absent, compile the plugin from the local sources.
117    s.prepare_command = <<-CMD
118      if [ ! -f #{plugin} ]; then
119        cd #{repo_root}
120        # This will build the plugin and put it in #{repo_root}/bins/opt.
121        #
122        # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and
123        # library binary) if found, which _we do not want_. Find a way for this to always use the
124        # sources in the repo.
125        make #{plugin}
126        cd -
127      fi
128    CMD
129  end
130