uber / prototool

Your Swiss Army Knife for Protocol Buffers
MIT License
5.05k stars 345 forks source link

Expose prototool as a Bazel rule #556

Open jathu opened 4 years ago

jathu commented 4 years ago

In this PR we create a rule that allows prototool to be invoked by a Bazel run command. Much of the inspiration came from buildifier.

Although we can currently invoke prototool using the provided binary, it requires all arguments to be absolute:

> bazel run @com_uber_prototool//cmd/prototool -- lint $PWD/protobuf/grpc/health/v1/health.proto
../../../../../../../../../../../../../../../../../Users/appleseed/protobuf/grpc/health/v1/health.proto:26:1:Expected "healthv1" for option "go_package" but was "google.golang.org/grpc/health/grpc_health_v1".

As you can see, the output isn't that elegant either. Compare that to the new rule:

> bazel run //:prototool -- lint protobuf/grpc/health/v1/health.proto
protobuf/grpc/health/v1/health.proto:26:1:Expected "healthv1" for option "go_package" but was "google.golang.org/grpc/health/grpc_health_v1".
CLAassistant commented 3 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Jathu Satkunarajah seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.