Plugins passed as --plugin not searched from PATH
When extracting plugins such as the ones published from gRPC mainline, the folder contains file formatted like grpc_python_plugin. With this folder on PATH, I would expect --plugin=protoc-gen-grpc_python=grpc_python_plugin to work, but it seems this argument requires an exact path. This appears to be an explicit decision.
https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/command_line_interface.cc#L2292
I feel like sourcing from PATH could be more convenient for this, but if going with the current behavior, at least the error message needs to be changed for this codepath because currently it implies that PATH should work.
protoc --grpc_python_out=build/python --plugin=protoc-gen-grpc_python=grpc_python_plugin testdata/helloworld.proto
grpc_python_plugin: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
Try setting --grpc_python_plugin_out without --plugin (See https://engdoc.corp.google.com/eng/doc/devguide/proto/reference/cpp/google.protobuf.compiler.command_line_interface.md#CommandLineInterface.AllowPlugins.details).
I believe --plugin indeed expects an exact path but is not required. If the plugin cannot be found in plugins (populated with exact paths from --plugin), then SEARCH_PATH is used. In this case, I believe the error message is correct.
Thanks for the example option, I didn't know of that pattern so will try it.
If the plugin cannot be found in plugins (populated with exact paths from --plugin), then SEARCH_PATH is used
I didn't see this behavior when trying myself. All the links are to internal google sites, can you replace with public ones so I can confirm we're looking at the same thing?
Sorry about that, https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.command_line_interface#CommandLineInterface.AllowPlugins.details is the external link
We would accept a PR to improve this error message