summaryrefslogtreecommitdiff
path: root/rust/bindgen.go
AgeCommit message (Collapse)Author
2020-10-03Merge "rust: Allow rust_bindgen to use cc_defaults." Ivan Lozano
2020-10-02rust: Add static binary support Ivan Lozano
Adds the "static_executable" property to rust_binary modules which allows for building fully static executables. This only impacts bionic targets. Bug: 169434439 Test: rust_binary module with static_executable true builds, runs on device. Change-Id: I83c19fddd070859b7e56d248237cfd73e1768519
2020-09-25rust: Allow rust_bindgen to use cc_defaults. Ivan Lozano
rust_bindgen modules can't inherit properties in cc_defaults that would be useful for generating bindings (such as cflags). This CL moves these common properties out into a new struct in cc and adds that struct to cc_default. Additionally, Cppflags is added to rust_bindgen to make sure that these get picked up as well from cc_defaults. Bug: 163598610 Test: rust_bindgen module uses cflags in cc_defaults. Test: New Soong test passes Change-Id: I702442a355244dc01954083f98a2eebbcea12e47
2020-09-25Merge "Avoid Rust source provider rule duplication" Thiébaud Weksteen
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-09-24rust: Add rust_bindgen std version w/ cc defaults. Ivan Lozano
Adds the c_std and cpp_std properties to rust_bindgen, and use the default values from cc if these are undefined. This assumes by default that the header extension indicates whether the header is a C or C++ header file. This default can be overridden by setting either c_std or cpp_std. Test: Soong tests pass, "-std=" arg included in bindgen calls Bug: 163580541 Change-Id: I5b0d3b8eae9a54dd91d8a0aca583d7803a344f27
2020-09-09Merge "rust: Fix rust_bindgen implicits" Ivan Lozano
2020-09-08[rust] Fix missing libclang for bindgen on darwin. Ivan Lozano
The LIBCLANG_PATH provided to bindgen should point to the directory containing libclang, not the file itself. Bug: 167977778 Test: m profcollectd Change-Id: Iabd9970a763c192249b401a618a2d6990b02eab0
2020-08-31rust: Fix rust_bindgen implicits Ivan Lozano
rust_bindgen implicits currently include dependency-exported include directories. This is incorrect, and causes issues when the include directory is a generated directory. Instead, remove the dependency-exported include directories from the implicits list, and also add dependency-exported headers to the implicits to handle these correctly. Bug: 166779501 Test: Rust projects continue to build, test-case no longer failing. Change-Id: Ia2da25de9e712b7306f19603dc9d14de6bac3fb3
2020-08-31Rename ccConfig to cc_config Thiébaud Weksteen
Follow up from aosp/1413495 to set a consistent name throughout the package. Test: m Change-Id: Idafcd973e7d874cd97599ac419c2972a8a5cd0b4
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-10Merge "Export Rust SourceProvider types and methods" Ivan Lozano
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-06Merge "[rust] Escape flags for bindgen" Matthew Maurer
2020-08-05Add support for custom bindgen binaries. Ivan Lozano
In some cases customized logic is required to generate the expected bindgen bindings. This adds support for rust_bindgen modules to define a HostTool module to use instead of bindgen. Bug: 161816141 Test: New Soong tests pass. Test: Local test case shows custom_binary module being used for bindgen generation. Change-Id: Id52aec4f25c38206d7e585d8e662be7836aa1d4b
2020-08-05Merge "[rust] Disable clippy for rust_bindgen modules." Ivan Lozano
2020-08-04[rust] Disable clippy for rust_bindgen modules. Ivan Lozano
bindgen generated code may not pass clippy checks, so preemptively disable clippy for these. Bug: 162828070 Test: clippy is not called when compiling rust_bindgen library variants. Change-Id: I9632c889417bdfd1adf96d9cfbccbe6340824205
2020-08-04[rust] Disable lints for generated bindings Stephen Crane
Bindgen generated bindings will not pass lints, so we need to disable them when building bindings crates. Test: m libbinder_ndk_bindgen Change-Id: I4536f15f8505ff8d5436f1e6cbc2035e6801276d
2020-08-04[rust] Escape flags for bindgen Stephen Crane
Bindgen flags and cflags should be escaped, as they may contain shell globs or other special characters. Test: Updated Soong test passes. Change-Id: I3df8ef25391f53a191f0494c5ff8c641d4d4b6f8
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-29Merge changes I4efdf333,I4abaf8e7 Ivan Lozano
* changes: Ensure hermetic device rust_bindgen. Generate deps file for rust_bindgen modules.
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-24Generate deps file for rust_bindgen modules. Ivan Lozano
Bug: 162007475 Test: deps file generated containing the dependent header files. Change-Id: I4abaf8e76875f7657c1b8386749217adcba1ffa2
2020-07-24Merge "Add a rust_bindgen_host module type." Ivan Lozano
2020-07-23Merge "Call rustfmt on rust_bindgen bindings." Ivan Lozano
2020-07-22Call rustfmt on rust_bindgen bindings. Ivan Lozano
This makes debugging easier when the bindings contain errors. Bug: 161730753 Test: Generated bindings are formatted. Change-Id: Ic46f69d8b6d07b4dc6912b7f02d7427ea6c11cde
2020-07-22Add a rust_bindgen_host module type. Ivan Lozano
Bug: 161826371 Test: Local rust_bindgen_host only provides host variants. Change-Id: I8cc7819a193a6eefe40402e4b6a82f436c5de78a
2020-07-22Add source collision test, rust_bindgen doc. Ivan Lozano
Bug: 159064919 Test: Soong tests pass (and fail if error is modified). Change-Id: Id4f76e53e11e46ae495f9613a2699c598e7daea4
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