rules_proto_grpc icon indicating copy to clipboard operation
rules_proto_grpc copied to clipboard

Fix bug with proto `against_input` arguments in `buf_proto_breaking_test`

Open codersasha opened this issue 3 years ago • 0 comments

Use .short_path instead of .path, which fixes a bug in buf_proto_breaking_test that caused protos to not be found.

Without this fix, a rule like:

    buf_proto_breaking_test(
        name = "my_proto_breaking_test",
        against_input = "@my-repo-main//:my_proto,
        protos = [":my_proto"],
    )

Fails with an error like:

open bazel-out/k8-fastbuild/bin/external/my-repo-main/my_proto/my_proto-descriptor-set.proto.bin: no such file or directory

With this fix, it works as expected.

This allows checking breaking changes against a main branch by including the main branch in the WORKSPACE file, e.g.:

# Download the main branch, to compare changes e.g. breaking protos.
git_repository(
    name = "my-repo-main",
    branch = "main",
    remote = "https://github.com/my-org/my-repo.git",
)

Then referring to rules in it for comparing breaking changes (obviously, rules that don't exist in the main branch will fail this test, so only add the test once the rule exists).

codersasha avatar Aug 09 '22 07:08 codersasha