From 0cf214ae3b21371f744e6b594807f3b9a20d8114 Mon Sep 17 00:00:00 2001 From: Nora Trapp Date: Mon, 22 Jul 2019 18:57:52 -0700 Subject: [PATCH] grpc-swift 0.9.1 (new formula) Closes #42323. Signed-off-by: Chongyu Zhu --- Formula/grpc-swift.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Formula/grpc-swift.rb diff --git a/Formula/grpc-swift.rb b/Formula/grpc-swift.rb new file mode 100644 index 0000000000..5b3eea8e86 --- /dev/null +++ b/Formula/grpc-swift.rb @@ -0,0 +1,36 @@ +class GrpcSwift < Formula + desc "The Swift language implementation of gRPC" + homepage "https://github.com/grpc/grpc-swift" + url "https://github.com/grpc/grpc-swift/archive/0.9.1.tar.gz" + sha256 "6b3a2ed13c805c6b8f339f558f2a1372bdcf84c079c104a6d0b54fd7650b8fbf" + head "https://github.com/grpc/grpc-swift.git" + + depends_on :xcode => ["10.0", :build] + depends_on "protobuf" + depends_on "swift-protobuf" + + def install + system "swift", "build", "--disable-sandbox", "-c", "release", "--product", "protoc-gen-swiftgrpc" + bin.install ".build/release/protoc-gen-swiftgrpc" + end + + test do + (testpath/"echo.proto").write <<~EOS + syntax = "proto3"; + service Echo { + rpc Get(EchoRequest) returns (EchoResponse) {} + rpc Expand(EchoRequest) returns (stream EchoResponse) {} + rpc Collect(stream EchoRequest) returns (EchoResponse) {} + rpc Update(stream EchoRequest) returns (stream EchoResponse) {} + } + message EchoRequest { + string text = 1; + } + message EchoResponse { + string text = 1; + } + EOS + system Formula["protobuf"].opt_bin/"protoc", "echo.proto", "--swiftgrpc_out=." + assert_predicate testpath/"echo.grpc.swift", :exist? + end +end