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