homebrew-core/Formula/swift-protobuf.rb

44 lines
1.3 KiB
Ruby

class SwiftProtobuf < Formula
desc "Plugin and runtime library for using protobuf with Swift"
homepage "https://github.com/apple/swift-protobuf"
url "https://github.com/apple/swift-protobuf/archive/1.0.1.tar.gz"
sha256 "2398da2bcd57c4c6fd895f975c059506839831f00a92b7cb5b4da2183888dca2"
revision 1
head "https://github.com/apple/swift-protobuf.git"
bottle do
cellar :any_skip_relocation
sha256 "36ac0a9b330d3133037650aaef61bed54f7bdc66660ba154384d8dcfc777a0d8" => :high_sierra
sha256 "e7d437e475082894cad58a3b86d7190c9145a3f711472afd934a016e375fd9ba" => :sierra
end
depends_on :xcode => ["8.3", :build]
depends_on "protobuf"
conflicts_with "protobuf-swift",
:because => "both install `protoc-gen-swift` binaries"
def install
system "swift", "build", "--disable-sandbox", "-c", "release", "-Xswiftc",
"-static-stdlib"
bin.install ".build/release/protoc-gen-swift"
doc.install "Documentation/PLUGIN.md"
end
test do
(testpath/"test.proto").write <<~EOS
syntax = "proto3";
enum Flavor {
CHOCOLATE = 0;
VANILLA = 1;
}
message IceCreamCone {
int32 scoops = 1;
Flavor flavor = 2;
}
EOS
system Formula["protobuf"].opt_bin/"protoc", "test.proto", "--swift_out=."
assert_predicate testpath/"test.pb.swift", :exist?
end
end