bufbuild / rules_buf

Bazel rules for Buf.
Apache License 2.0
47 stars 17 forks source link

Add `module` option to `lint` and `breaking` rules #65

Closed srikrsna-buf closed 5 months ago

srikrsna-buf commented 5 months ago

Related to #63. This adds support for the module option introduced in the plugin versions v1.32.1. Users need to specify the module option to specify which module rules to apply for a given target.

With v1, the rule expects the config of the current module:

buf_lint_test(
    name = "bar_proto_lint",
    config = "//barapis:buf.yaml", # Config of the current module located at `barapis` directory
    targets = [":bar_proto"],
)

With v2 we refer to the root buf.yaml and specify the module that the current proto target belongs to:

buf_lint_test(
    name = "bar_proto_lint",
    config = "//:buf.yaml", # The root `buf.yaml`
    module = "barapis", # The path or full module name that this target belongs to
    targets = [":bar_proto"],
)