Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buf breaking fails when using git submodule #3532

Closed
ln-12 opened this issue Dec 12, 2024 · 2 comments
Closed

buf breaking fails when using git submodule #3532

ln-12 opened this issue Dec 12, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@ln-12
Copy link

ln-12 commented Dec 12, 2024

GitHub repository with your minimal reproducible example (do not leave this field blank or fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)

https://github.com/ln-12/buf_breaking_test (app files)
https://github.com/ln-12/buf_breaking_test2 (backend files)

Commands

./generate_proto.sh

Output

Failure: Module "path: "backend_repo/protobuf", excludes: "backend_repo/protobuf/c"" had no .proto files

Expected Output

I expected no errors

Anything else?

In my project I have two sources of .proto files. One is inside app/src/main/proto (app related proto files) and the other one is backend_repo/protobuf (backend related proto files).

The app files are used for a local cache (see here) and are checked in with the rest of the app source code while the backend files are used for the communication via ConnectRPC. In my example I did not specify and rpc related messages to keep it simple and used local plugin instead of remote one as I run into rate limits while testing. Our backend files are located in a separate git repository which is shared across all devices.

The setup and workflow fit our needs quite nice but I just cannot get buf breaking to work. It always fails with some form of Module XYZ had no .proto files. Is there anything I am doing wrong or are git submodules not yet supported? While setting up this example I noticed that it seems to work perfectly fine without the submodule for the backend proto files.

@ln-12 ln-12 added the Bug Something isn't working label Dec 12, 2024
@emcfarlane
Copy link
Contributor

Hey @ln-12 I could reproduce the issue but it looks to be from an invalid submodule file in your config:

--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
 [submodule "backend_repo"]
        path = backend_repo
-       url = ./backend_repo/
+       url = https://github.com/ln-12/buf_breaking_test2

You will need to commit this change, and then update the generate.sh script. Because you are using submodules you'll need to set the recurse_submodule option, see the configuration docs.

buf breaking --against '.git#branch=main,recurse_submodules=true'

@ln-12
Copy link
Author

ln-12 commented Dec 13, 2024

The local submodule path was just an issue of my example, in my real project it already was set to the git url.

The missing config for me was the recurse_submodules option. I don't know why I did not see that earlier, thanks a lot for that super fast help!

@ln-12 ln-12 closed this as completed Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants