Plugin support for protobuf compiler (protoc) targets. |
|
Issue description*** NOT A BUG *** Protobuf compiler (protoc) has plugin support to generate stubs in other languages. Details: https://developers.google.com/protocol-buffers/docs/reference/other The initial purpose of this stuff in Chromium is Tracing V2 (bit.ly/TracingV2) objective. Custom 'append-only' protobuf writer in Tracing V2 is optimised for constant memory footprint and speed in order to eliminate variable memory overhead and meet performance constraints at some critical paths. This goal is achieved by sacrificing with serialized data size and bounding capabilities in a basic subset of proto language. Another developer (xyzzyz@chromium.org) intend to use a protoc plugin which generates gRPC stubs. Technically there is already GN build file for 'proto_library'. The CL crrev.com/2082693002/ just extends those GN/gyp files in order to support passing additional plugin to protoc. Usage example: proto_library("tracing_proto") { visibility = [ "//components/tracing/*" ] sources = [ "foo.proto", "bar.proto", ] proto_out_dir = "components/tracing/proto" generator_plugin = "proto_zero_plugin" # Executable name of the plugin generator_plugin_suffix = ".zeropb" # Suffix prior .cc and .h generate_cc = false # Don't generate built-in cpp_out deps = [ # Build plugin executable "//components/tracing/proto_zero_plugin:proto_zero_plugin($host_toolchain)", ] }
,
Aug 2 2016
Change crrev.com/2202233002 is intended to avoid writing complex boilerplates. For example: proto_library("proto_zero_testing_messages") { ... generator_plugin_label = "tools/proto_zero_plugin:proto_zero_plugin" generator_plugin_suffix = ".pbzero" generate_cc = false generate_python = false plugin_host_label = generator_plugin_label + "($host_toolchain)" generator_plugin = rebase_path(get_label_info(plugin_host_label, "root_out_dir") + "/" + get_label_info(plugin_host_label, "name"), root_build_dir) if (is_win) { generator_plugin += ".exe" } deps = [ plugin_host_label, ] } Can be simplified to: proto_library("proto_zero_testing_messages") { ... generator_plugin_label = "tools/proto_zero_plugin:proto_zero_plugin" generator_plugin_suffix = ".pbzero" generate_cc = false generate_python = false }
,
Aug 3 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b01034d7a9d4377f8d2e244a3e14d334435de67d commit b01034d7a9d4377f8d2e244a3e14d334435de67d Author: kraynov <kraynov@chromium.org> Date: Wed Aug 03 10:48:03 2016 Path evaluation to protobuf plugin. Protobuf compiler (protoc) plugin is basically an executable. Path for executables can vary if building for diffent platforms. This change allows to skip writing complex boilerplate each time. BUG= 622680 Review-Url: https://codereview.chromium.org/2202233002 Cr-Commit-Position: refs/heads/master@{#409481} [modify] https://crrev.com/b01034d7a9d4377f8d2e244a3e14d334435de67d/components/tracing/BUILD.gn [modify] https://crrev.com/b01034d7a9d4377f8d2e244a3e14d334435de67d/third_party/protobuf/proto_library.gni |
|
►
Sign in to add a comment |
|
Comment 1 by bugdroid1@chromium.org
, Jul 6 2016