-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pw_protobuf: Put codegen in a ::pwpb suffix namespace
The namespace suffix is applied at the package level, as specified in the originating .proto file. This change is mostly in order to avoid clashing with code generated by the stock C++ representation outputted by protoc. This is useful, for example, for projects that would like to use the stock C++ proto library for additional tests, but which need to use pw_protobuf due to needs of embedded targets. For now, this change is set up in a way so that it is, by default, backwards compatible with existing code. A flag has been added to the plugin to opt out of legacy behaviour, but has not been implemented in any rules that invoke the Pigweed proto compiler plugin. Because of limitations with the current proto plugin implementation, some external identifiers (references to things in other .proto files, typically) are not parsed with a package annotation, and so we are unable to codegen the ::pwpb suffix in the correct place. For now, I've introduced an auxiliary namespace (discussed with [email protected], seems like the best fast workaround). In the long term, potentially we can coax the plugin to traverse the build graph better. (Package or namespace overrides are supported for Java / Obj-C / C#, so presumably some mechanism is available.) b/250945489 Change-Id: Ic1fae107063ec75d81da34baa89be61f66d4f94d Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/117934 Reviewed-by: Wyatt Hepler <[email protected]> Commit-Queue: Anqi Dong <[email protected]>
- Loading branch information
Showing
4 changed files
with
183 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters