homebrew-core/Formula/protoc-gen-go.rb

40 lines
1.3 KiB
Ruby
Raw Normal View History

class ProtocGenGo < Formula
desc "Go support for Google's protocol buffers"
homepage "https://github.com/golang/protobuf"
url "https://github.com/golang/protobuf/archive/v1.3.0.tar.gz"
sha256 "f44cfe140cdaf0031dac7d7376eee4d5b07084cce400d7ecfac4c46d33f18a52"
2019-02-13 04:48:45 +00:00
bottle do
cellar :any_skip_relocation
sha256 "d3beffd1377caff7c98221ddf726fb58ba4e5871394c589038dabd3703b58696" => :mojave
sha256 "3ebb0640cd69cf804a31ca05c88b55c1c9459017102931d068787d889b2d90d5" => :high_sierra
sha256 "45d29451aec60e81f6862c366ce03d5e7fd4fdcd717fe7108ae7b41c5f1c036c" => :sierra
end
depends_on "go" => :build
depends_on "protobuf"
def install
ENV["GOPATH"] = buildpath
ENV["GO111MODULE"] = "off"
(buildpath/"src/github.com/golang").mkpath
ln_s buildpath, buildpath/"src/github.com/golang/protobuf"
system "go", "build", "-o", bin/"protoc-gen-go", "protoc-gen-go/main.go"
end
test do
protofile = testpath/"proto3.proto"
protofile.write <<~EOS
syntax = "proto3";
package proto3;
message Request {
string name = 1;
repeated int64 key = 2;
}
EOS
system "protoc", "--go_out=.", "proto3.proto"
assert_predicate testpath/"proto3.pb.go", :exist?
refute_predicate (testpath/"proto3.pb.go").size, :zero?
end
end