summaryrefslogtreecommitdiff
path: root/rust/source_provider.go
AgeCommit message (Collapse)Author
2025-01-29Convert rust module-info.json to soong Cole Faust
This leads to idendical results as before, with the exception of the "required" field in module-info.json. Make has more complicated logic to fill out the required field than soong, and it leads to make-specific names such as ones suffixed with :32 and don't make sense in soong. I'm don't think there are critical users of that field though, so I'll try removing it. Everything else should be identical to the make-generated information though. Bug: 389720048 Test: diff'd module-info.json before and after this cl in soong+make mode Change-Id: I74aefe578287f07474c15e5f92a0c2780a679047
2023-01-26Remove unused field 'subAndroidMkOnce'. Andrew Walbran
Test: m crosvm vmbase_example_bin Change-Id: Ica201b8bfa89073bcd7d5e3c1a2822adfe7ad28c
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
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-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-09-25Avoid Rust source provider rule duplication Thiébaud Weksteen
Until now, source provider modules duplicated the rule to generate the source for each variant. Add a inter-variant dependency between the source and the other variants (e.g. rlib, dylib) to avoid this duplication. Add documentation on this behaviour. Bug: 162588681 Test: m Change-Id: I41c9e2220f8875245415e17374852e540dfd47ec
2020-08-28rust: add ccToolchain to Module Thiébaud Weksteen
The cc toolchain information is required when using cc.Stripper. Move to a Module method to avoid importing the cc package everywhere. Test: m nothing Bug: 153430439 Change-Id: I497dcdff4e767ecb8b8688c73cf88850c302683d
2020-08-13rust: modify linting properties Thiébaud Weksteen
Move the linting properties to an enum with 4 possible options: "default", "android", "vendor" or "none". The previous logic for default, based on the module's location, is kept. It is now possible to force the upgrade to a certain lint level for some modules (e.g. external/[...]/android). Update the unit tests and documentation. Bug: 163400111 Test: m Change-Id: I8e464b04401158ed2d3c518a9b72f145a9835c99
2020-08-06Export Rust SourceProvider types and methods Andrei Homescu
The AIDL compiler now uses SourceProvider to compiler the generated Rust code from system/tools/aidl/build/aidl_interface.go using its own SourceProvider object, which needs access to baseSourceProvider and all methods of SourceProvider. Test: mmma system/tools/aidl with 1357705 applied Change-Id: I226609a7fccca2e7e1bfbad5d69d1821d37e43a1
2020-08-05Make source_stem required for Rust SourceProviders Ivan Lozano
This removes ambiguity for developers with the 'stem' property. Bug: 159064919 Test: New Soong test; error is produced if this property is undefined. Change-Id: I790fbcfa6cd7dbf6df63b5cf5c22983426ec072e
2020-08-04[rust] Add SourceProviders as crates support. Ivan Lozano
This allows SourceProvider modules to create rust_library variants so that generated source can be referenced as an external crate rather than via an include macro. This is done by including rust_bindgen modules like any other library, as a dependency in either rlibs, dylibs, or rustlibs. This renames the stem and flags properties for rust_bindgen modules to source_stem and bindgen_flags, respectively. This deconflicts with the usage in baseCompiler. This also removes 'subName' from the Module struct and moves it over to SourceProvider, which was the only user. This allows us to set it in baseSourceProvider's AndroidMk; setting it in Module's AndroidMk was causing problems finding NOTICE files for bindgen library variants. Bug: 159064919 Test: New Soong tests pass. Test: Local test rust_binary can use rust_bindgen module as a crate. Change-Id: Ieb2cb614c2dd0b5aa7120541d77f6f822a6a1806
2020-07-28Ensure hermetic device rust_bindgen. Ivan Lozano
rust_bindgen was not hermetic previously as it would pull in host headers for device targets. This fixes that by using the same flags we use when compiling with Clang. This also makes sure our rust_bindgen headers are built as similar as possible to their respective cc_libraries. This also pulls in the bionic dependencies as well, which provide the headers required for device targets. Bug: 162007475 Test: device rust_bindgen deps file does not reference host headers. Change-Id: I4efdf333e011a6c6d73a0345e5485823f166d17a
2020-07-20Add SourceProviders and a rust_bindgen module type Ivan Lozano
Add SourceProvider modules which provides a base interface for more complex code generation usecases such as bindgen. Also adds the rust_bindgen module type which calls bindgen to generate Rust FFI bindings to C. Bug: 159064919 Test: Local test module generates bindings. Test: New Soong tests pass. Change-Id: Ie31467bbbe423497666ad837cf5fe1acd1e76bd8