rules_proto
rules_proto copied to clipboard
proto_gazelle doesn't work on subdirectory
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.
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.