Sen descrición

Tim Burks ae4b141221 Update Travis CI to use 4.0.3 release build. %!s(int64=7) %!d(string=hai) anos
Assets f9de073b4a Update vendor-grpc script to include roots.pem and update roots.pem version. %!s(int64=8) %!d(string=hai) anos
Docker 4904e4567f Update protoc compiler in Docker image and make it smaller %!s(int64=7) %!d(string=hai) anos
Examples 55925d91b0 Test with debug builds. %!s(int64=7) %!d(string=hai) anos
Plugin 3e00aa5569 Improve test synchronization. %!s(int64=7) %!d(string=hai) anos
Sources 10316035a1 Merge pull request #157 from grpc/test-sync %!s(int64=7) %!d(string=hai) anos
Tests a51d6e22e8 Merge branch 'master' of github.com:grpc/grpc-swift into optional-completion-blocks %!s(int64=7) %!d(string=hai) anos
scripts e8d2b1350b Update Examples to version 0.2.1 + minor cleanup. %!s(int64=8) %!d(string=hai) anos
third_party f9de073b4a Update vendor-grpc script to include roots.pem and update roots.pem version. %!s(int64=8) %!d(string=hai) anos
.gitignore 63a52c86b5 This fixes the tests for me. %!s(int64=7) %!d(string=hai) anos
.gitmodules 63c6acfa40 Move CgRPC, gRPC, and QuickProto to "Sources" directory and add new top-level Package.swift. %!s(int64=9) %!d(string=hai) anos
.swift-version 04887237e1 Update .swift-version %!s(int64=8) %!d(string=hai) anos
.travis-install.sh ae4b141221 Update Travis CI to use 4.0.3 release build. %!s(int64=7) %!d(string=hai) anos
.travis.yml 6462c1db79 Replace ExampleTests with direct builds of the Echo and Simple examples in "make test". %!s(int64=7) %!d(string=hai) anos
AUTHORS 0aa90a79ee Relicense to Apache 2, change owners to "the gRPC Authors". %!s(int64=8) %!d(string=hai) anos
CONTRIBUTING.md 98a8b64da5 Update README and CONTRIBUTING. %!s(int64=9) %!d(string=hai) anos
DOCKER.md 410ff70c78 update PROTOBUF %!s(int64=7) %!d(string=hai) anos
LICENSE 0aa90a79ee Relicense to Apache 2, change owners to "the gRPC Authors". %!s(int64=8) %!d(string=hai) anos
LINUX.md 93f426875b Update Echo sample path %!s(int64=8) %!d(string=hai) anos
Makefile 5f5c121670 Add functional testing of the Echo example to the top-level "make test". %!s(int64=7) %!d(string=hai) anos
OVERVIEW.md a11da8644e Fix font weight formatting in OVERVIEW.md %!s(int64=8) %!d(string=hai) anos
PATENTS 36f2bde28e Add PATENTS declaration %!s(int64=9) %!d(string=hai) anos
Package.swift 6a553c3636 Add a runtime support class for unary client calls. %!s(int64=7) %!d(string=hai) anos
README.md 75d0e0822c Update README. %!s(int64=8) %!d(string=hai) anos
SwiftGRPC.podspec 524f7461df Add `SwiftProtobuf` to the podspec, because the runtime support code in `SwiftGRPC` now depends on it. %!s(int64=7) %!d(string=hai) anos
swift-vendoring.sh.template ffe96e6693 Updating for grpc-1.4.5, WIP. Builds but does not pass tests. %!s(int64=8) %!d(string=hai) anos
vendor-boringssl.sh 3252f97e0e Exclude example program - containing main() - from boringssl vendoring. %!s(int64=8) %!d(string=hai) anos
vendor-grpc.sh f9de073b4a Update vendor-grpc script to include roots.pem and update roots.pem version. %!s(int64=8) %!d(string=hai) anos

README.md

Build Status

Swift gRPC

This repository contains an experimental Swift gRPC API and code generator.

It is intended for use with Apple's swift-protobuf support for Protocol Buffers. Both projects contain code generation plugins for protoc, Google's Protocol Buffer compiler, and both contain libraries of supporting code that is needed to build and run the generated code.

APIs and generated code is provided for both gRPC clients and servers, and can be built either with Xcode or the Swift Package Manager. Support is provided for all four gRPC API styles (Unary, Server Streaming, Client Streaming, and Bidirectional Streaming) and connections can be made either over secure (TLS) or insecure channels.

The Echo example provides a comprehensive demonstration of currently-supported features.

Swift Package Manager builds may also be made on Linux systems. Please see DOCKER.md and LINUX.md for details.

gRPC dependencies are vendored

Swift gRPC includes vendored copies of the gRPC core library and BoringSSL, an OpenSSL fork that is used by the gRPC Core. These are built automatically in Swift Package Manager builds.

Usage

The recommended way to use Swift gRPC is to first define an API using the Protocol Buffer language and then use the Protocol Buffer Compiler and the Swift Protobuf and Swift gRPC plugins to generate the necessary support code.

Getting the dependencies

Binary releases of protoc, the Protocol Buffer Compiler, are available on GitHub.

To build the plugins, run make in the Plugin directory. This uses the Swift Package Manager to build both of the necessary plugins: protoc-gen-swift, which generates Protocol Buffer support code and protoc-gen-swiftgrpc, which generates gRPC interface code.

Using the plugins

To use the plugins, protoc and both plugins should be in your search path. Invoke them with commands like the following:

protoc <your proto files> \
    --swift_out=. \
    --swiftgrpc_out=.

By convention the --swift_out option invokes the protoc-gen-swift plugin and --swiftgrpc_out invokes protoc-gen-swiftgrpc.

Building your project

Most grpc-swift development is done with the Swift Package Manager. For usage in Xcode projects, we rely on the swift package generate-xcodeproj command to generate an Xcode project for the grpc-swift core libraries.

The top-level Makefile uses the Swift Package Manager to generate an Xcode project for the SwiftGRPC package:

$ make

This will create SwiftGRPC.xcodeproj, which you should add to your project, along with setting build dependencies on BoringSSL, CgRPC, gRPC, and CzLib.

Please also note that your project will need to include the SwiftProtobuf.xcodeproj from Swift Protobuf and the source files that you generated with protoc and the plugins.

Please see Echo for a working Xcode-based example and file issues if you find any problems.

Low-level gRPC

While the recommended way to use gRPC is with Protocol Buffers and generated code, at its core gRPC is a powerful HTTP/2-based communication system that can support arbitrary payloads. As such, each gRPC library includes low-level interfaces that can be used to directly build API clients and servers with no generated code. For an example of this in Swift, please see the Simple example.

Having build problems?

grpc-swift depends on Swift, Xcode, and swift-proto. We are currently testing with the following versions:

  • Xcode 9.1
  • Swift 4.0-dev
  • swift-protobuf 1.0.2

License

grpc-swift is released under the same license as gRPC, repeated in LICENSE.

Contributing

Please get involved! See our guidelines for contributing.