I’m migrating a PHP project using protoc to the Buf CLI. To ensure backwards compatibility, I’m trying to have Buf produce more or less exactly the same output as the builtin PHP plugin would do.
I’ve configured my buf.gen.yaml
to use protoc_builtin: php
as the target plugin and left out any opts, as protoc also wasn’t taking any arguments before.
When I run buf generate
, but the GPBMetadata binary files are now in the wrong directory. protoc puts them in a directory at the top level of your output replicating your directory structure (not even your package path, just the directories).
Here’s my directory structure:
src
| users
| user.proto
| items
| user_item.proto
Running this using Buf (which is claiming to use the protoc-builtin php plugin) produces this output:
buf_out
| Users
| User.php
| Metadata
| User.php
| Items
| UserItem.proto
| Metadata
| UserItem.php
However, running this with protoc on my machine, it yields:
builtin-out
| Metadata
| Users
| User.php
| Items
| User_item.proto
| Users
| User.php
| Items
| User_item.proto
Notice also the differences in Snakecase conversion. Clearly Buf is doing more than it’s documentation is telling us.
Are there any flags to Buf that let me revert to the protoc behaviour. Or am I on the wrong version somehow? (using 1.45.0 btw)