Commit graph

12 commits

Author SHA1 Message Date
Ivan Lozano
0a468a4f3b rust: made-to-order rust staticlibs
Whenever any two Rust static libraries are included
as static libraries anywhere in a CC dependency tree, we sometimes
get duplicate symbol errors. To avoid this, we no longer
directly link multiple rust static libs to CC modules.

Instead, we build rust_ffi_rlib modules and produce the actual
static library that gets linked against the CC module based on
that CC module's full list of Rust rlib dependencies.

This introduces a new static_rlibs property for cc modules to
define the rust_ffi_rlib dependencies, which are then used to
generate the module above.

This CL is intended to deprecate rust_ffi_static. It leaves
rust_ffi_static and rust_ffi static variants in place until
the remaining rust_ffi_static declarations and uses can be
removed. In the meantime, rust_ffi_static produces
rust_ffi_rlib variants as well to make the transition easier.

Bug: 254469782
Test: m # with no changes
Test: m libapexsupport # with static_rlibs
Test: m libunwindstack # with static_rlibs
Test: m netsimd # with static_rlibs, no duplicate symbols
Test: m blueprint_tests # New Soong tests

Change-Id: I47e27ac967ef0cad46d398ebf59d8275929ae28a
2024-05-16 13:00:43 -04:00
Kiyoung Kim
1db4a74a59 Remove VNDK information from Rust, etc, and sysprop tests
VNDK is deprecated in 24Q2, so soong should be tested with no device and
platform vndk versions. This change removes all VNDK related tests and
VNDK versions from soong-etc, soong-rust and soong-sysprop tests.

Bug: 330100430
Test: m nothing --no-skip-soong-tests passed
Change-Id: Ie34d23f0facab31078de54682f7cc78d37fcd4be
2024-04-01 15:53:58 +09:00
Wen-yi Chu
41326c1f41 Revert "support sandboxed rust rules"
Revert submission 2629131-sandbox-rust-inputs

Reason for revert: Fail on android build.

Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs

Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
2023-09-22 22:05:54 +00:00
Sam Delmerico
a588d153c8 support sandboxed rust rules
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.

Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
2023-09-15 22:46:56 +00:00
Matthew Maurer
65a54a8e3d rust: Set android_vendor and android_product cfg
Add `android_vendor` and `android_product` cfgs, similar to
__ANDROID_VENDOR__ and __ANDROID_PRODUCT__ defines for C++

Bug: 270718001
Test: m nothing with added test
Change-Id: Ibeabe2983d1454e5a2ec0bb2f43e793b8f32a5c2
2023-02-24 19:21:08 +00:00
Matthew Maurer
993db7a7cc rust: Enable Rust modules in Product
The prohibition on Rust dylibs outside system still stands, but rlibs,
rust_ffi_static, and binaries will all work fine.

Test: m nothing (new soong tests added by this commit)
Test: Created sample product_specific rust_binary, checked out/ location
Bug: 165791368
Change-Id: I6453274064bb24b2019f38e57fc0d09b7c0fcf30
2023-01-24 16:39:52 -08:00
Ivan Lozano
c08897c1e4 Add more Rust vendor image support.
This adds Rust vendor image support for all module types except
Rust prebuilts.

Bug: 184042776
Test: New Soong tests.
Test: Example cc_library vendor module can depend on rust_ffi_shared.
Test: Example rust_library vendor-only module compiles.

Change-Id: Iaa30ad51fdaedcbf14687da5472581f6af62ff59
2021-04-13 13:17:12 -04:00
Jiyong Park
f58c46e36f Don't use incorrect version names like VER or BOARD even in tests
All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.

Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
2021-04-05 09:32:06 +09:00
Ivan Lozano
f76cdf7c20 rust: Emit android vndk cfg flag.
Pass an "android_vndk" cfg flag that indicates this code
targets the vndk. This can be useful in instances where code
might need to behave differently.

This also includes a fix to make sure our vendor Soong tests
are correctly configured.

Bug: 179907868
Test: Soong tests pass.
Test: Example module emits new cfg flags.
Change-Id: I01cdf91f6f9d42cd8a759266d5170479664bf4bc
2021-02-12 12:17:50 -05:00
Ivan Lozano
e6d3098c1b rust: Add rust_ffi_static vendor ramdisk Support
Similar to our vendor support, this adds support for linking rust static
libraries to vendor ramdisk cc modules.

A bug fix is also included where a restriction against setting rust_ffi
vendor-specific was not being enforced.

Bug: 179397942
Test: Example modules link, Soong tests pass.
Change-Id: I737cdf0c2f49ab349bcea2a0429e6298ebc1313e
2021-02-08 09:36:26 -05:00
Justin Yun
ebcf0c5e15 Define odm_available property to install a vendor variant to odm
'vendor_available: true' creates a vendor variant from a system
module. The vendor variant of the module is installed to /vendor.
However, we may want to install the vendor variant to /odm, instead.

'device_specific: true' does not work for this purpose because
'vendor_available: true' is allowed only for the system or product
modules to create a vendor variant. But 'device_specific: true'
itself creates a vendor variant that may not work with
'vendor_available: true'.

To install the vendor variant to /odm, we define a new property
'odm_available'. 'odm_available' is exactly the same as the
'vendor_available' except the install path of the vendor variant.
By defining 'odm_available: true', the vendor variant of the module
will be installed to /odm or /vendor/odm instead of /vendor.

Bug: 176147321
Bug: 176079978
Test: check if a module with 'odm_available: true' is installed to
      /vendor/odm
Change-Id: I2d16bd2c515796597b2fbd1eb66f7c2736434697
2021-01-25 17:08:44 +09:00
Ivan Lozano
6a88443089 Rust: Vendor support for Rust static libraries.
We don't have Rust VNDK support yet, but static linkage can be
supported in the interim. This adds support for making rust_ffi_static
libraries available to CC vendor modules.

Since rust_ffi_static modules will link against rlibs, we allow rlib
linkage into vendor as well, but only for the variants which use the
rlib libstd.

Bug: 172525289
Test: New Soong tests pass
Test: Example vendor cc_binary links against rust_ffi_static module.
Change-Id: Idf3aeb51e32293866f1ad965e329aa6b9e0bf2ef
2020-12-10 10:29:54 -05:00