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