Просмотр исходного кода

Remove Cocoapods script and references (#1439)

Motivation:

We no longer support Cocoapods, so we should remove any
references to them from the repo.

Modifications:

- Remove pod related tooling and documentation.

Result:

More accurate documentation. Cleaner repo.
George Barnett 3 лет назад
Родитель
Сommit
703d351545

+ 0 - 20
CGRPCZlib.podspec

@@ -1,20 +0,0 @@
-Pod::Spec.new do |s|
-
-    s.name = 'CGRPCZlib'
-    s.module_name = 'CGRPCZlib'
-    s.version = '1.6.0'
-    s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
-    s.summary = 'Compression library that provides in-memory compression and decompression functions'
-    s.homepage = 'https://www.grpc.io'
-    s.authors  = { 'The gRPC contributors' => 'grpc-packages@google.com' }
-
-    s.swift_version = '5.2'
-    s.ios.deployment_target = '10.0'
-    s.osx.deployment_target = '10.12'
-    s.tvos.deployment_target = '10.0'
-    s.watchos.deployment_target = '6.0'
-    s.source = { :git => "https://github.com/grpc/grpc-swift.git", :tag => s.version }
-
-    s.source_files = 'Sources/CGRPCZlib/**/*.{swift,c,h}'
-
-end

+ 0 - 2
Examples/Google/SpeechToText/README.md

@@ -29,8 +29,6 @@ This project requires a Google Cloud API Key. Please [register](https://cloud.go
 
 ## Helpful Links
 * [Getting Started with Speech APIs](https://cloud.google.com/speech-to-text/docs/quickstart)
-* [CocoaPods](https://cocoapods.org/)
-* [gRPC-Swift CocoaPod](https://cocoapods.org/pods/gRPC-Swift)
 
 NOTE: Implementation of the AudioStreamManager is based off of [Google's Example Audio Streaming](https://github.com/GoogleCloudPlatform/ios-docs-samples/blob/master/speech/Swift/Speech-gRPC-Streaming/Speech/AudioController.swift)
 

+ 4 - 31
README.md

@@ -22,10 +22,10 @@ insecure channels.
 gRPC Swift has recently been rewritten on top of [SwiftNIO][swift-nio] as
 opposed to the core library provided by the [gRPC project][grpc].
 
-Version | Implementation | Branch                 | `protoc` Plugin         | CocoaPod              | Support
---------|----------------|------------------------|-------------------------|-----------------------|-----------------------------------------
-1.x     | SwiftNIO       | [`main`][branch-new]   | `protoc-gen-grpc-swift` | [gRPC-Swift][pod-new] | Actively developed and supported
-0.x     | gRPC C library | [`cgrpc`][branch-old]  | `protoc-gen-swiftgrpc`  | [SwiftGRPC][pod-old]  | No longer developed; security fixes only
+Version | Implementation | Branch                 | `protoc` Plugin         | Support
+--------|----------------|------------------------|-------------------------|-----------------------------------------
+1.x     | SwiftNIO       | [`main`][branch-new]   | `protoc-gen-grpc-swift` | Actively developed and supported
+0.x     | gRPC C library | [`cgrpc`][branch-old]  | `protoc-gen-swiftgrpc`  | No longer developed; security fixes only
 
 The remainder of this README refers to the 1.x version of gRPC Swift.
 
@@ -81,21 +81,6 @@ Alternatively, gRPC Swift can be manually integrated into a project:
 1. Add the generated project to your own project, and
 1. Add a build dependency on `GRPC`.
 
-#### CocoaPods
-
-gRPC Swift is currently available [from CocoaPods][pod-new]. To integrate, add
-the following line to your `Podfile`:
-
-```ruby
-    pod 'gRPC-Swift', '~> 1.0.0'
-```
-
-Then, run `pod install` from command line and use your project's generated
-`.xcworkspace` file. You might also need to add `use_frameworks!` to your `Podfile`.
-
-*⚠️ If you have conficting modules as a result of having a transitive
-dependency on '[gRPC-Core][grpc-core-pod]' see [grpc/grpc-swift#945][grpc-swift-945].*
-
 ### Getting the `protoc` Plugins
 
 Binary releases of `protoc`, the Protocol Buffer Compiler, are available on
@@ -111,14 +96,6 @@ To install these plugins, just copy the two executables (`protoc-gen-swift` and
 that is part of your `PATH` environment variable. Alternatively the full path to
 the plugins can be specified when using `protoc`.
 
-Alternatively, you can get the latest precompiled version of the plugins by adding
-the following line to your `Podfile`:
-
-```ruby
-    pod 'gRPC-Swift-Plugins'
-```
-The plugins are available in the `Pods/gRPC-Swift-Plugins/` folder afterwards.
-
 #### Homebrew
 
 The plugins are available from [homebrew](https://brew.sh) and can be installed with:
@@ -178,15 +155,11 @@ Please get involved! See our [guidelines for contributing](CONTRIBUTING.md).
 [docs-tutorial]: ./docs/basic-tutorial.md
 [docs-interceptors-tutorial]: ./docs/interceptors-tutorial.md
 [grpc]: https://github.com/grpc/grpc
-[grpc-core-pod]: https://cocoapods.org/pods/gRPC-Core
-[grpc-swift-945]: https://github.com/grpc/grpc-swift/pull/945
 [protobuf-releases]: https://github.com/protocolbuffers/protobuf/releases
 [swift-nio-platforms]: https://github.com/apple/swift-nio#supported-platforms
 [swift-nio]: https://github.com/apple/swift-nio
 [swift-protobuf]: https://github.com/apple/swift-protobuf
 [xcode-spm]: https://help.apple.com/xcode/mac/current/#/devb83d64851
-[pod-new]: https://cocoapods.org/pods/gRPC-Swift
-[pod-old]: https://cocoapods.org/pods/SwiftGRPC
 [branch-new]: https://github.com/grpc/grpc-swift/tree/main
 [branch-old]: https://github.com/grpc/grpc-swift/tree/cgrpc
 [examples-out-of-source]: https://github.com/grpc/grpc-swift/tree/main/Examples

+ 1 - 3
docs/plugin.md

@@ -96,9 +96,7 @@ desired, and setting `KeepMethodCasing=true` will yield stubs named `Foo`.
 The **GRPCModuleName** option allows the name of the gRPC Swift runtime module
 to be specified. The value, if not specified, defaults to "GRPC".
 
-*Note: most users will not need to use this option. It is intended as a
-workaround for CocoaPods users who may end up with a transitive dependency on
-the gRPC core C library whose module name is also "GRPC".*
+*Note: most users will not need to use this option.*
 
 ### SwiftProtobufModuleName
 

+ 0 - 20
gRPC-Swift-Plugins.podspec

@@ -1,20 +0,0 @@
-Pod::Spec.new do |s|
-
-    s.name = 'gRPC-Swift-Plugins'
-    s.version = '1.6.0'
-    s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
-    s.summary = 'Swift gRPC code generator plugin binaries'
-    s.homepage = 'https://www.grpc.io'
-    s.authors  = { 'The gRPC contributors' => 'grpc-packages@google.com' }
-
-    s.swift_version = '5.2'
-    s.ios.deployment_target = '10.0'
-    s.osx.deployment_target = '10.12'
-    s.tvos.deployment_target = '10.0'
-    s.watchos.deployment_target = '6.0'
-    s.source = { :http => "https://github.com/grpc/grpc-swift/releases/download/#{s.version}/protoc-grpc-swift-plugins-#{s.version}.zip"}
-
-    s.preserve_paths = '*'
-    s.dependency 'gRPC-Swift', s.version.to_s
-
-end

+ 0 - 29
gRPC-Swift.podspec

@@ -1,29 +0,0 @@
-Pod::Spec.new do |s|
-
-    s.name = 'gRPC-Swift'
-    s.module_name = 'GRPC'
-    s.version = '1.6.0'
-    s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
-    s.summary = 'Swift gRPC code generator plugin and runtime library'
-    s.homepage = 'https://www.grpc.io'
-    s.authors  = { 'The gRPC contributors' => 'grpc-packages@google.com' }
-
-    s.swift_version = '5.2'
-    s.ios.deployment_target = '10.0'
-    s.osx.deployment_target = '10.12'
-    s.tvos.deployment_target = '10.0'
-    s.watchos.deployment_target = '6.0'
-    s.source = { :git => "https://github.com/grpc/grpc-swift.git", :tag => s.version }
-
-    s.source_files = 'Sources/GRPC/**/*.{swift,c,h}'
-
-    s.dependency 'CGRPCZlib', s.version.to_s
-    s.dependency 'Logging', '>= 1.4.0', '< 2.0.0'
-    s.dependency 'SwiftNIO', '>= 2.32.0', '< 3.0.0'
-    s.dependency 'SwiftNIOExtras', '>= 1.4.0', '< 2.0.0'
-    s.dependency 'SwiftNIOHTTP2', '>= 1.18.2', '< 2.0.0'
-    s.dependency 'SwiftNIOSSL', '>= 2.14.0', '< 3.0.0'
-    s.dependency 'SwiftNIOTransportServices', '>= 1.11.1', '< 2.0.0'
-    s.dependency 'SwiftProtobuf', '>= 1.9.0', '< 2.0.0'
-
-end

+ 0 - 302
scripts/build_podspecs.py

@@ -1,302 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2020, gRPC Authors All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import json
-import random
-import string
-import argparse
-import subprocess
-import sys
-
-
-class TargetDependency(object):
-    def __init__(self, name):
-        self.name = name
-
-    def __str__(self):
-        return "s.dependency '{name}', s.version.to_s".format(name=self.name)
-
-
-class ProductDependency(object):
-    def __init__(self, name, lower, upper):
-        self.name = name
-        self.lower = lower
-        self.upper = upper
-
-    def __str__(self):
-        return "s.dependency '{name}', '>= {lower}', '< {upper}'".format(
-                name=self.name, lower=self.lower, upper=self.upper)
-
-
-class Pod:
-    def __init__(self, name, module_name, version, description, dependencies=None, is_plugins_pod=False):
-        self.name = name
-        self.module_name = module_name
-        self.version = version
-        self.is_plugins_pod = is_plugins_pod
-        self.dependencies = dependencies if dependencies is not None else []
-        self.description = description
-
-    def as_podspec(self):
-        print('\n')
-        print('Building Podspec for %s' % self.name)
-        print('-' * 80)
-
-        indent=' ' * 4
-
-        podspec = "Pod::Spec.new do |s|\n\n"
-        podspec += indent + "s.name = '%s'\n" % self.name
-        if not self.is_plugins_pod:
-            podspec += indent + "s.module_name = '%s'\n" % self.module_name
-        podspec += indent + "s.version = '%s'\n" % self.version
-        podspec += indent + "s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }\n"
-        podspec += indent + "s.summary = '%s'\n" % self.description
-        podspec += indent + "s.homepage = 'https://www.grpc.io'\n"
-        podspec += indent + "s.authors  = { 'The gRPC contributors' => \'grpc-packages@google.com' }\n\n"
-
-        podspec += indent + "s.swift_version = '5.4'\n"
-        podspec += indent + "s.ios.deployment_target = '10.0'\n"
-        podspec += indent + "s.osx.deployment_target = '10.12'\n"
-        podspec += indent + "s.tvos.deployment_target = '10.0'\n"
-        podspec += indent + "s.watchos.deployment_target = '6.0'\n"
-
-        if self.is_plugins_pod:
-            podspec += indent + "s.source = { :http => \"https://github.com/grpc/grpc-swift/releases/download/#{s.version}/protoc-grpc-swift-plugins-#{s.version}.zip\"}\n\n"
-            podspec += indent + "s.preserve_paths = '*'\n"
-        else:
-            podspec += indent + "s.source = { :git => \"https://github.com/grpc/grpc-swift.git\", :tag => s.version }\n\n"
-            podspec += indent + "s.source_files = 'Sources/%s/**/*.{swift,c,h}'\n" % (self.module_name)
-
-            podspec += "\n" if len(self.dependencies) > 0 else ""
-
-        for dep in sorted(self.dependencies, key=lambda x: x.name):
-            podspec += indent + str(dep) + "\n"
-
-        podspec += "\nend"
-        return podspec
-
-class PodManager:
-    def __init__(self, directory, version, should_publish, package_dump):
-        self.directory = directory
-        self.version = version
-        self.should_publish = should_publish
-        self.package_dump = package_dump
-
-    def write(self, pod, contents):
-        print('    Writing to %s/%s.podspec ' % (self.directory, pod))
-        with open('%s/%s.podspec' % (self.directory, pod), 'w') as podspec_file:
-            podspec_file.write(contents)
-
-    def publish(self, pod_name):
-        subprocess.check_call(['pod', 'repo', 'update'])
-        print('    Publishing %s.podspec' % (pod_name))
-
-        args = ['pod', 'trunk', 'push', '--synchronous']
-
-        # The gRPC-Swift pod emits warnings about redundant availability
-        # guards on watchOS. These are redundant for the Cocoapods where we set
-        # the deployment target for watchOS to watchOS 6. However they are
-        # required for SPM where the deployment target is lower (and we can't
-        # raise it without breaking all of our consumers). We'll allow warnings
-        # to work around this.
-        if pod_name == "gRPC-Swift":
-            args.append("--allow-warnings")
-
-        path_to_podspec = self.directory + '/' + pod_name + ".podspec"
-        args.append(path_to_podspec)
-        subprocess.check_call(args)
-
-    def build_pods(self):
-        cgrpczlib_pod = Pod(
-            self.pod_name_for_grpc_target('CGRPCZlib'),
-            'CGRPCZlib',
-            self.version,
-            'Compression library that provides in-memory compression and decompression functions',
-            dependencies=self.build_dependency_list('CGRPCZlib')
-        )
-
-        grpc_pod = Pod(
-            self.pod_name_for_grpc_target('GRPC'),
-            'GRPC',
-            self.version,
-            'Swift gRPC code generator plugin and runtime library',
-            dependencies=self.build_dependency_list('GRPC')
-        )
-
-        grpc_plugins_pod = Pod(
-            'gRPC-Swift-Plugins',
-            '',
-            self.version,
-            'Swift gRPC code generator plugin binaries',
-            dependencies=[TargetDependency("gRPC-Swift")],
-            is_plugins_pod=True
-        )
-
-        return [cgrpczlib_pod, grpc_pod, grpc_plugins_pod]
-
-    def go(self, start_from):
-        pods = self.build_pods()
-
-        if start_from:
-            pods = pods[list(pod.name for pod in pods).index(start_from):]
-
-        # Create .podspec files and publish
-        for target in pods:
-            self.write(target.name, target.as_podspec())
-            if self.should_publish:
-                self.publish(target.name)
-            else:
-                print('    Skipping Publishing...')
-
-
-    def pod_name_for_package(self, name):
-        """Return the CocoaPod name for a given Swift package."""
-        pod_mappings = {
-            'swift-log': 'Logging',
-            'swift-nio': 'SwiftNIO',
-            'swift-nio-extras': 'SwiftNIOExtras',
-            'swift-nio-http2': 'SwiftNIOHTTP2',
-            'swift-nio-ssl': 'SwiftNIOSSL',
-            'swift-nio-transport-services': 'SwiftNIOTransportServices',
-            'SwiftProtobuf': 'SwiftProtobuf'
-        }
-        return pod_mappings[name]
-
-
-    def pod_name_for_grpc_target(self, name):
-        """Return the CocoaPod name for a given gRPC Swift target."""
-        return {
-          'GRPC': 'gRPC-Swift',
-          'CGRPCZlib': 'CGRPCZlib'
-        }[name]
-
-
-    def get_package_requirements(self, package_name):
-        """
-        Returns the lower and upper bound version requirements for a given
-        package dependency.
-        """
-        for dependency in self.package_dump['dependencies']:
-            if dependency['name'] == package_name:
-                # There should only be 1 range.
-                requirement = dependency['requirement']['range'][0]
-                return (requirement['lowerBound'], requirement['upperBound'])
-
-        # This shouldn't happen.
-        raise ValueError('Could not find package called', package_name)
-
-
-    def get_dependencies(self, target_name):
-        """
-        Returns a tuple of dependency lists for a given target.
-
-        The first entry is the list of product dependencies; dependencies on
-        products from other packages. The second entry is a list of target
-        dependencies, i.e. dependencies on other targets within the package.
-        """
-        for target in self.package_dump['targets']:
-            if target['name'] == target_name:
-                product_dependencies = set()
-                target_dependencies = []
-
-                for dependency in target['dependencies']:
-                    if 'product' in dependency:
-                        product_dependencies.add(dependency['product'][1])
-                    elif 'target' in dependency:
-                        target_dependencies.append(dependency['target'][0])
-                    else:
-                        raise ValueError('Unexpected dependency type:', dependency)
-
-                return (product_dependencies, target_dependencies)
-
-        # This shouldn't happen.
-        raise ValueError('Could not find dependency called', target_name)
-
-
-    def build_dependency_list(self, target_name):
-        """
-        Returns a list of dependencies for the given target.
-
-        Dependencies may be either 'TargetDependency' or 'ProductDependency'.
-        """
-        product, target = self.get_dependencies(target_name)
-        dependencies = []
-
-        for package_name in product:
-            (lower, upper) = self.get_package_requirements(package_name)
-            pod_name = self.pod_name_for_package(package_name)
-            dependencies.append(ProductDependency(pod_name, lower, upper))
-
-        for target_name in target:
-            pod_name = self.pod_name_for_grpc_target(target_name)
-            dependencies.append(TargetDependency(pod_name))
-
-        return dependencies
-
-
-def dir_path(path):
-    if os.path.isdir(path):
-        return path
-
-    raise NotADirectoryError(path)
-
-def main():
-    parser = argparse.ArgumentParser(description='Build Podspec files for gRPC Swift')
-
-    parser.add_argument(
-        '-p',
-        '--path',
-        type=dir_path,
-        help='The directory where generated podspec files will be saved. If not passed, defaults to the current working directory.'
-    )
-
-    parser.add_argument(
-        '-u',
-        '--upload',
-        action='store_true',
-        help='Determines if the newly built Podspec files should be pushed.'
-    )
-
-    parser.add_argument(
-        '-f',
-        '--start-from',
-        help='The name of the Podspec to start from.'
-    )
-
-    parser.add_argument('version')
-    args = parser.parse_args()
-
-    should_publish = args.upload
-    version = args.version
-    path = args.path
-    start_from = args.start_from
-
-    if not path:
-        path = os.getcwd()
-
-    print("Reading package description...")
-    lines = subprocess.check_output(["swift", "package", "dump-package"])
-    package_dump = json.loads(lines)
-    assert(package_dump["name"] == "grpc-swift")
-
-    pod_manager = PodManager(path, version, should_publish, package_dump)
-    pod_manager.go(start_from)
-
-    return 0
-
-if __name__ == "__main__":
-    main()

+ 0 - 3
scripts/bundle-plugins-for-release.sh

@@ -25,9 +25,6 @@ set -eu
 #   └── bin
 #       ├── protoc-gen-grpc-swift
 #       └── protoc-gen-swift
-#
-# Note: the name of the generated zip should match that expected by the
-# buid_podspecs.py script.
 
 if [[ $# -lt 1 ]]; then
   echo "Usage: $0 RELEASE_VERSION"