43 lines
1.3 KiB
Ruby
43 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.2.tar.gz"
|
|
sha256 "c48234cf89275aab99bf0b982c3c4b53dfe9c7494ce44e96248248c5fabd3b9a"
|
|
head "https://github.com/apple/swift-protobuf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "1a1bab229c457f9bb9643b5d6a37688d0648ef76a9503e9d8331fa4fb2deaced" => :high_sierra
|
|
sha256 "60bbc7b24935e336edc148c0fa98672b8ee1c7cea902e040c95af195bd09fd9b" => :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
|