summaryrefslogtreecommitdiff
path: root/rust/protobuf.go
AgeCommit message (Collapse)Author
2023-09-25Add bp2build for rust_protobuf module Vinh Tran
We only supported bp2build for rust_protobuf_host because the non-host toolchain for rust is not checked in yet. aosp/2759750 changed a converted module from rust_protobuf_host to rust_protobuf and broke CI. This CL adds bp2build support for rust_protobuf but makes the target incompatible with android os for now untilnon-host rust toolchain is checked in. Bug: 301956497 Test: b build //build/make/tools/aconfig:all --config=android Change-Id: I739896c79f32674000c2603e394f16860a6fc57d
2023-09-20Have ConvertWBp2build use Bp2buildMutatorContext Chris Parsons
This no-op refactoring facilitates some upcoming functional changes for "bp2build allowlist v2". The work requires that the bp2build conversion mutator be changed from a TopDown mutator to a BottomUp mutator. Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext makes it easier to make this functional change without touching tens of files and multiple projects. Bug: 285631638 Test: m bp2build Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-08-25Implement bp2build converter for rust_protobuf_host Vinh Tran
Test: go test Bug: 295925256 Change-Id: I43b7359da8fc19f4338e2583448b7617194df5e6
2023-08-14Remove dylibs prop from rust module types Vinh Tran
For device build, rust defaults to dylib linkage for rustlibs deps. `dylibs` prop was provided for flexibility. By removing it, we're enforcing users to either use the default linkage (dylibs for device and rlibs for host) or rlibs prop explicitly. This means no dylibs for host modules. This makes sense because host modules always uses rlib linkage against libstd. The flexibility with dylibs prop opened room for linkage collisions because the dependencies don't link against libstd the same way. Test: go test Change-Id: I2fc221daa8a9bb42bdcf6d9823c723a4ddabe7b5
2023-04-24Add option to use protobuf3 Jeff Vander Stoep
Users of the rust_protobuf module can use the 'use_protobuf3' option to select version 3 of the protobuf crate instead of the current default of version 2. This unblocks teams that would like to use protobuf 3 immediately and provides a mechanism for us to incrementally migrate users of protobuf 2 to protobuf 3. Test: Adds tests that are executed during every build. Bug: 270895633 Change-Id: Ib6a18b77cfa7dc3cc604cea05269004b3712bbb6
2023-03-24rust_proto: use protobuf crate version 2.x Jeff Vander Stoep
Test: build Bug: 270895633 Change-Id: I04e5e7fe70b8c509cd1b35852b75a0f24a633ce9
2022-08-10Revert^4 "rust: Only allow bindgen to produce `rlib`s." Matthew Maurer
199c18850233f3d07f65c7be3bfa70878cc6c345 Change-Id: I28b353fa89354cc572806b2274169342a473a03c
2022-08-02Revert^3 "rust: Only allow bindgen to produce `rlib`s." Matthew Maurer
9cc801ab7af27684c190645f6fd0f9db8f798e15 Change-Id: Ib59840b51b316c0ad03bc66565814dd96be0b072
2022-08-02Revert^2 "rust: Only allow bindgen to produce `rlib`s." Matthew Maurer
b983c8971bc02c15897c198bca15284579a378ae Change-Id: Ic82433885f7932be8cfe65433330527214807684
2022-08-01Revert "rust: Only allow bindgen to produce `rlib`s." Matthew Maurer
This reverts commit 53a452d1ff172fba9060f2997fec006a70e44c8d. Reason for revert: Broken build Change-Id: I4c1c6f2166c3729ef1916ad7c21e32599c5e692f
2022-08-01rust: Only allow bindgen to produce `rlib`s. Matthew Maurer
Generated bindings are intended to be slim translation layers, usually consisting of nothing more than type signatures and constants. Generally, they should also be used in exactly one location by the safe wrapper for these bindings. By preventing them from building as `dylib`s, we avoid the per-library overhead of these non-reused pieces of code. Additionally, default visibility restrict all bindgen modules to their subpackages. This is being done both: * to encourage use of a single safe bindings crate * to avoid diamond dependency graphs with mixed rlib/dylib dependencies Bug: 166332519 Test: m; Make sample module use dylib bindgen dependency, see build failure. Change-Id: I8e9d9cb851c2ec99f4ed63e6e18c4ba26b29721c
2022-01-04rust: Support protobuf wrappers well known types David Duarte
Test: m nothing Change-Id: I271474f59745670cbba98704182d0966eae6b0ee
2020-12-11Merge rust_protobuf and rust_grpcio module types. Ivan Lozano
To allow grpc protobufs to include non-grpc protos in a singular library, we need to allow them to be defined as part of the same module. This CL merges the two previously distinct module types into rust_protobuf, and adds a new property for declaring which protos contain grpc definitions. Bug: 172952239 Test: rust_grpcio modules converted to rust_protobuf modules and build. Test: Example rust_protobuf module with both proto types builds. Change-Id: I0e627fd97bc6f74de89d309e3344694a1e76586d
2020-12-10Rust: WriteFileRule instead of printf for protos Ivan Lozano
Use WriteFileRule instead of a rule that calls printf for generating the module source file for rust_protobuf. Bug: 171361369 Test: rust_protobuf modules compile Change-Id: Ie83a30e19d7d09875f3d209662526783862d8ea0
2020-12-01Pass pctx and ctx to NewRuleBuilder Colin Cross
Enable the RuleBuilder and RuleBuilderCommand methods to access the BuilderContext by passing it to NewRuleBuilder instead of RuleBuilder.Build. Test: genrule_test.go Test: rule_builder_test.go Test: m checkbuild Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
2020-11-30rust: Add support for multiple protos per module. Ivan Lozano
This further emulates the rust-protobuf gen_mod_rs flag by providing support for generating a single module containing multiple protobuf definitions. Bug: 171361369 Test: New Soong tests. Test: Example module containing multiple protos works. Change-Id: I815f9628a8289ae512758073dac49bc4535abf01
2020-11-17rust: Add header library support to rust_bindgen. Ivan Lozano
Allow rust_bindgen modules to define dependencies that only provide headers and may not necessarily need to be linked in. Bug: 161141999 Test: Soong tests pass. Test: Example module has appropriate include flags when compiling. Change-Id: Ic9ce8b1204008ad8dcb18766c914e48bb292d485
2020-11-11rust_grpcio well known types support, default deps Zach Johnson
The usage of the well known type Empty requires a hack in the module above the grpc implementation, this is now the generated stem_mod.rs This also adds additional implicit dependencies that are required by the grpc protobuf generated code. This includes the addition of a 'header_libs' property for library dependencies which export include paths required by protos. We also now include both the protos and the grpcio in the library variant via the mod_stem.rs. Bug: 172592789 Bug: 171504899 Test: m nothing Test: Example rust_grpcio module build command includes dependencies, include paths. Change-Id: I187a13cd5cdea991828a1020314de16727e4f74e
2020-11-06rust: Fix GRPC generator invocation Matthew Maurer
When using the grpc generator, the plugin expects to also have access to the protobuf generator. This patch ensures that aprotoc will use the Soong copy of the protobuf generator, rather than trying to use a locally installed version from PATH. Test: m nothing Change-Id: I26da4d18c97017da7d8cd9515a07a2b7b2575342
2020-11-05Add rust_grpcio module type. Ivan Lozano
Adds a new SourceProvider type to generate grpcio code from protos. Since it's so similar to protobuf, it's basically just a different type of rust_protobuf. Bug: 171504899 Test: Example module compiles. Change-Id: I9882f3ac4d4aeaae0191f2b557e9612b5c7a9ac9
2020-10-09Use protobuf-codegen default and add mod_stem.rs Chih-Hung Hsieh
* Upgrade to new protobuf-codegen; use its standard default output without local change. * Allow a sourceProvider to have multiple output files. For a stem.proto file, output stem.rs and mod_stem.rs. * New protobuf-codegen option gen_mod_rs always generates output file named "mod.rs". To generate multiple .proto files into the same output directory, we need to rename mod.rs to mod_<stem>.rs. * Instead of using the gen_mod_rs option and renaming mod.rs to mod_<stem>.rs, we generate the same mod_<stem>.rs directly with a simple printf command. Bug: 170256643 Test: atest -c --host --include-subdirs external/crosvm Change-Id: Ia09e41029099a6de4d35c96dbabd9ba5514c9019
2020-08-31Add rust_protobuf module. Treehugger Robot
This adds a new SourceProvider module type to handle protobuf code generation. See the new test for an example of how to call this. Bug: 143953733 Test: New soong tests pass. Test: Replacing genrules in crosvm with rust_protobuf modules. Change-Id: Ie3117129cde37b8736bc18ee09bf5cde27c01c34