rules_proto icon indicating copy to clipboard operation
rules_proto copied to clipboard

proto_gazelle doesn't work on subdirectory

Open ql-owo-lp opened this issue 2 years ago • 1 comments

I configured proto_gazelle in my BUILD

proto_gazelle(
    name = "gazelle",
    cfgs = ["//:.gazelle-proto-config.yaml"],
    command = "update",
    data = [
        ":gazelle_protobuf_generate_imports",
    ],
    gazelle = ":gazelle-protobuf",
    imports = [
        "gazelle-proto-imports.csv",
    ],
)

bazel run //:gazelle works perfectly in this case. However, bazel run //:gazelle -- some_dir doesn't work. Only proto_library rules are generated, all other rules suchs as proto_compile rules are not generated. I have to manually pass arguments like bazel run //:gazelle -- -proto_configs=.gazelle-proto-config.yaml -proto_imports_in=gazelle-proto-imports.csv some_dir for it to work.

ql-owo-lp avatar Mar 26 '22 15:03 ql-owo-lp

I figured this out by looking at bazel-bin/gazelle-runner.bash. You need to prefix the arguments with -args, eg bazel run //:gazelle -- -args example/. That should be changed or the documentation fixed, but that's the answer to the mystery.

sacsar avatar Aug 02 '22 22:08 sacsar