commit | f61993aad0077ef623307b8955c2c3f613420081 | [log] [tgz] |
---|---|---|
author | Anqi Dong <anqid@google.com> | Sat Nov 12 01:56:00 2022 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Sat Nov 12 01:56:00 2022 +0000 |
tree | d44418f9485050b31792c59977af3f63362dc0a2 | |
parent | f7c3a1e61a28d5858279bbd97d2cc7ee483e6c2f [diff] |
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 hepler@google.com, 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 <hepler@google.com> Commit-Queue: Anqi Dong <anqid@google.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.