Skip to content

Commit

Permalink
protoc-gen-js 3.21.2 (new formula)
Browse files Browse the repository at this point in the history
Related: #113481
  • Loading branch information
luangong committed Mar 13, 2024
1 parent 26235c1 commit 7ab8939
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Formula/p/protoc-gen-js.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class ProtocGenJs < Formula
desc "Protocol buffers JavaScript generator plugin"
homepage "https://github.com/protocolbuffers/protobuf-javascript"
url "https://github.com/protocolbuffers/protobuf-javascript/archive/refs/tags/v3.21.2.tar.gz"
sha256 "35bca1729532b0a77280bf28ab5937438e3dcccd6b31a282d9ae84c896b6f6e3"
license "BSD-3-Clause"
head "https://github.com/protocolbuffers/protobuf-javascript.git", branch: "main"

depends_on "bazelisk" => :build
depends_on "protobuf@21"

def install
env_path = "#{HOMEBREW_PREFIX}/bin:/usr/bin:/bin"
args = %W[
--action_env=PATH=#{env_path}
--host_action_env=PATH=#{env_path}
]
system Formula["bazelisk"].opt_bin/"bazelisk", "build", *args, "//generator:protoc-gen-js"
bin.install "bazel-bin/generator/protoc-gen-js"
end

test do
(testpath/"person.proto").write <<~EOS
syntax = "proto3";
message Person {
int64 id = 1;
string name = 2;
}
EOS
system Formula["protobuf@21"].bin/"protoc", "--js_out=import_style=commonjs:.", "person.proto"
assert_predicate testpath/"person_pb.js", :exist?
refute_predicate (testpath/"person_pb.js").size, :zero?
end
end

0 comments on commit 7ab8939

Please sign in to comment.