Skip to content

Commit d74c6f3

Browse files
committed
protoc-gen-grpc-swift 1.1.0
1 parent 3246e67 commit d74c6f3

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Formula/p/protoc-gen-grpc-swift.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
class ProtocGenGrpcSwift < Formula
2+
desc "Protoc plugin for generating gRPC Swift stubs"
3+
homepage "https://github.com/grpc/grpc-swift-protobuf"
4+
url "https://github.com/grpc/grpc-swift-protobuf/archive/refs/tags/1.1.0.tar.gz"
5+
sha256 "fe19d6931605e957031369578ab03faa6b3b3ad8fdee0214a08275ef209f36f9"
6+
license "Apache-2.0"
7+
version_scheme 1
8+
head "https://github.com/grpc/grpc-swift-protobuf.git", branch: "main"
9+
10+
livecheck do
11+
url :stable
12+
regex(/^v?(\d+(?:\.\d+)+)$/i)
13+
end
14+
15+
depends_on xcode: ["15.0", :build]
16+
# https://swiftpackageindex.com/grpc/grpc-swift/documentation/grpccore/compatibility#Platforms
17+
depends_on macos: :sequoia
18+
depends_on "protobuf"
19+
depends_on "swift-protobuf"
20+
21+
uses_from_macos "swift" => :build
22+
23+
def install
24+
args = if OS.mac?
25+
["--disable-sandbox"]
26+
else
27+
["--static-swift-stdlib"]
28+
end
29+
system "swift", "build", *args, "-c", "release", "--product", "protoc-gen-grpc-swift"
30+
bin.install ".build/release/protoc-gen-grpc-swift"
31+
end
32+
33+
test do
34+
(testpath/"echo.proto").write <<~PROTO
35+
syntax = "proto3";
36+
service Echo {
37+
rpc Get(EchoRequest) returns (EchoResponse) {}
38+
rpc Expand(EchoRequest) returns (stream EchoResponse) {}
39+
rpc Collect(stream EchoRequest) returns (EchoResponse) {}
40+
rpc Update(stream EchoRequest) returns (stream EchoResponse) {}
41+
}
42+
message EchoRequest {
43+
string text = 1;
44+
}
45+
message EchoResponse {
46+
string text = 1;
47+
}
48+
PROTO
49+
system Formula["protobuf"].opt_bin/"protoc", "echo.proto", "--grpc-swift_out=."
50+
assert_path_exists testpath/"echo.grpc.swift"
51+
end
52+
end

0 commit comments

Comments
 (0)