RSDK-12498: Fix building against local protos #537
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This would have been helpful for recent work updating the GetImages stuff, but building against local protos has been broken for a while. The surface issue was that the
BUF_VIAM_API_SOURCEwas pointing to a directory that did not have abuf.yaml, and hence was not specifying the dependency ongoogleapis, but the larger issue is that this directory was empty because the Viam API repo had migrated to buf v2 which places everything in the project root, and C++ SDK was still using v1.Hence migrate to v2, which as a corollary both fixes and considerably simplifies local proto generation. Basically v2 modifies the yaml syntax somewhat and favors putting
buf.yamlandbuf.lockin the project root. Note thatbuf.work.yamlis not a thing in v2: https://buf.build/docs/migration-guides/migrate-v2-config-files/#bufyaml-modules-and-workspaces so it's only necessary to point buf at the API repo root. I added a TODO comment saying this may obviate the sibling repo structure requirement as well.Tested locally by building a default configuration and with
VIAMCPPSDK_USE_LOCAL_PROTOS=1, and also building the targetupdate-static-protoswhich suggests that this change should not break the proto update workflow, but if it does we probably won't know til it happens