summaryrefslogtreecommitdiff
path: root/rust/androidmk.go
AgeCommit message (Collapse)Author
2025-02-11Remove unused dist-related variables Cole Faust
Bug: 395184523 Test: verified ninja files did not change Change-Id: I90e6813163c00975cf722cfb2d79033141d1a4c2
2024-05-10Remove duplicated CollectDependencyAconfigFiles() Justin Yun
android.ModuleBase already calls aconfigUpdateAndroidBuildActions() that is the same with CollectDependencyAconfigFiles(). Remove the CollectDependencyAconfigFiles() to avoid duplication with aconfigUpdateAndroidBuildActions(). To make the aconfig information available in GenerateAndroidBuildActions() of all modules, call aconfigUpdateAndroidBuildActions() before calling GenerateAndroidBuildActions() of each module. Also, we don't need SetAconfigFileMkEntries(), which is a duplicate of aconfigUpdateAndroidMkData() Bug: 335363964 Test: diff `adb shell printflags` before and after the change. Change-Id: I52808e442e9fed7db1eae7b7c5ed0b1c5ba74f5d
2024-04-11Merge "rust: Fix handling of bindgen header libs" into main Ivan Lozano
2024-04-05Deprecate Snapshot build Kiyoung Kim
Existing snapshot code will no longer work from VNDK deprecation, but it can give confusion to users if we keep code for the snapshot - and it adds complexity on existing code while it is not in use. This change removes all snapshot definition except host snapshot and its usage. Bug: 330100430 Bug: 332986564 Test: AOSP CF build succeeded Change-Id: Ieb6fa43d5e38315c662ce997bc305b744b367c24
2024-03-29rust: Fix handling of bindgen header libs Ivan Lozano
Static libraries were being appended to the list of header library dependencies. They should not be. This also makes sure we track them appropriately in Make. Test: m blueprint_tests Change-Id: Ifa664f09fe2102aea57d22cbaaeba71f0c26074d
2024-02-05Reapply "Rename LOCAL_USE_VNDK" Kiyoung Kim
Similar with aosp/2897612, rename LOCAL_USE_VNDK into LOCAL_IN_VENDOR or LOCAL_IN_PRODUCT to make variable useful from VNDK deprecation. Bug: 316829758 Test: AOSP CF build succeeded Change-Id: If7bead24add014ed9e0e9e1d265b0199b911be89
2024-02-02Revert "Rename LOCAL_USE_VNDK" Kiyoung Kim
Revert submission 2931430-local_use_vndk Reason for revert: build fails with barbet targets Reverted changes: /q/submissionid:2931430-local_use_vndk Change-Id: Ic5b850e2905d1b93e8b4d08921106940991587b8
2024-01-30Rename LOCAL_USE_VNDK Kiyoung Kim
Similar with aosp/2897612, rename LOCAL_USE_VNDK into LOCAL_IN_VENDOR or LOCAL_IN_PRODUCT to make variable useful from VNDK deprecation. Bug: 316829758 Test: AOSP CF build succeeded Change-Id: I76741e45a2d80000adec6abfd8e9d6ee97c4ea23
2024-01-10move SetAconfigFileMkEntries to android LaMont Jones
This will need to be called by some modules handled in android. Bug: 308625757 Test: manual Change-Id: Ic56e8ef3a453c59866aab6d39a21108cf8536b56
2023-12-14Properly package aconfig files for vendor partition Yu Liu
Bug: 311173471 Test: Unit tests Change-Id: Ibb857b69c3f83326a9ff5732e11dd09887e4ba6e
2023-12-07rust: add aconfig_flag support LaMont Jones
Bug: b/308625757 Test: manual Change-Id: Ifd98cd0ad4e2525b08f5766e9332991c049162ea
2023-11-30Move test data installation to Soong Colin Cross
To generate module-info.json in Soong for b/309006256 Soong needs to know the test data paths. Moving test data installation into Soong will also help later for test suite packaging. Add ModuleContext.InstallTestData that installs the files listed in a []DataPath alongside the test. The files will also be passed to Make to allow it to continue packaging them into the test suites for now. Update the module types that are producing LOCAL_TEST_DATA entries in their Android.mk files to go through InstallTestData instead. Bug: 311428265 Test: atest --host toybox-gtests --test-timeout=120000 Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
2023-08-17Add transitive shared libs to LOCAL_SHARED_LIBRARIES for rust modules Cole Faust
Rust modules are different from C++ modules in that they will install their transitive shared libs alongside a binary. C++ modules don't do this, you have to install the transitive shared lib manually. (but they do install direct shared libs) It does this by using InstallDepNeeded, a mechanism that adds dependencies from installed files to the installed copies of dependencies if InstallDepNeeded() returns true. This mechanism does not end up tracking the installed files all the way to FULL_SYSTEMIMAGE_DEPS. We're attempting to make FULL_SYSTEMIMAGE_DEPS more accurate so that we can track the files that should be installed properly, and remove the need for `m installclean`. Listing the libraries a binary uses in LOCAL_SHARED_LIBRARIES does properly track them and end up listing them in FULL_SYSTEMIMAGE_DEPS. Bug: 205632228 Test: Building the systemimage with a change to delete anything not in FULL_SYSTEMIMAGE_DEPS Change-Id: I4ba75b40b3ac77250297209a851bc9ba377782f5
2023-03-16Fix the make name of rust snapshots Justin Yun
Rust snapshot must have proper suffix for androidmk to avoid conflict with the existing modules. Bug: 230780263 Bug: 235895567 Test: m nothing Change-Id: I35794196553621cd722c067d7965b2a61aa351bd
2023-02-06Copy Rust fuzzer dependencies to /data. Ivan Lozano
Fix an issue where rust_fuzz modules were not correctly packaging and copying their dependencies. This is done by extending the CC fuzz packager to simply handle both Rust and CC modules, ensuring this doesn't get out of sync again. Fuzzer related functions are added to the Linkable interface to facilitate this. There was a bug where the Make definitions for Rust fuzzers were not being created as well, and that is addressed here. Bug: 249551848 Test: m android_log_fuzzer #check $OUT/data/fuzz/arm64/libs Change-Id: I9b41153e0cf08ab510476b75003c3a3baccc3858
2022-08-17Move common test_options properties into the android package Zhenhuang Wang
Multiple modules (e.g. java, cc, python, rust) define the `test_options` field. Extract the common properties in test_options to share across different test rules. Bug: 240928948 Test: `refreshmod` and diff with original module-info.json Change-Id: I404a7a157b4ccaa53d800ee2217559ff695bd825
2022-02-17Propagate data_bins from Soong to Make yangbill
Write the list of a test module's data_bins value to the `LOCAL_TEST_DATA_BINS` Makefile variable defined for each module. This enables downstream tools to correctly set up the runtime environment for execution. And currently only sh_test, cc_tests, and rust_tests has this attribute in Android.bp. Bug: 215234071 Test: m out/soong/Android-aosp_cf_x86_64_phone.mk Change-Id: I8d47f5f9b25afdc5975c6b414405badb38dbde4b
2021-12-15Remove InstallBypassMake and ToMakePath Colin Cross
InstallBypassMake and ToMakePath are obsolete, remove them. Bug: 204136549 Test: m checkbuild Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-11-15Merge "Use new soong_cc_rust_prebuilt.mk" Ivan Lozano
2021-11-12Use new soong_cc_rust_prebuilt.mk Ivan Lozano
soong_{cc,rust}_prebuilt.mk has been merged. Use the new file. Bug: N/A, clean-up Test: m Change-Id: I3f03e866815f6394aacd8cb0deba04f381b78c29
2021-11-12rust: Support new rust_stdlib_prebuilt_host type Ivan Lozano
Refactor Rust prebuilts to support the new rust_stdlib_prebuilt_host module type, and change the format for depending on the prebuilt host stdlibs. Bug: 140642453 Test: m Change-Id: Ifbc4741818777934e917631c788b20911856c44a
2021-11-09rust: Refactor stripped output file path Ivan Lozano
Rust installed files reside in "$MODULE_OUT/stripped/" when they are stripped, otherwise they reside in "$MODULE_OUT". However, other parts of Soong assume that installed files are always in $MODULE_OUT (cc_modules place *unstripped* files in $MODULE_OUT/unstripped). This notably causes problems when adding Rust modules as test data in AndroidMkDataPaths. When Rust modules are parsed by AndroidMkDataPaths, if they are stripped then they incorrectly get installed as test data with the path: <install_root>/<relative_install_path>/stripped/file. This CL refactors how we handle Rust stripped output such that the installed file always resides in $MODULE_OUT. Bug: 171710847 Test: Installed files now always reside in $MODULE_OUT Change-Id: I53a6ff57a0a5a55cd95ea78ae592ce22abfa20c9
2021-11-08Move rust module installation into Soong Colin Cross
Move rust module installation rules into Soong by overriding InstallBypassMake. Bug: 204136549 Bug: 205530905 Test: m checkbuild Test: m && acloud create --local-instance --local-image Change-Id: Icc00c4ea5d91ae489c1d9d3b66a072c9de86c717
2021-11-03rust: Emit toc files for cdylibs Ivan Lozano
Write toc files that list the exported symbols so dependents are only rebuilt if the exported symbols change. This exports the CC function TransformSharedObjectToToc, and also removes an unused arg from its signature. Bug: 178185435 Test: New Soong test passes. Test: m <toc file path> Change-Id: I7ab69bf7e7f32f25eb4c7ca9d18d877dac1511db
2021-07-16Refactoring fuzz packaging code hamzeh
Rust and cc fuzz packaging have common. This change is to put this common methods and fields into fuzz_common. Test: make haiku and make haiku-rust ran locally and verify corpus, dict and config are packaged along with the executable. Change-Id: I04bf535cd2597ed8b2bd3d8e6ea8c28f38bdc18b
2021-05-01Add support for packaging rust fuzzers hamzeh
Test: make haiku-rust Change-Id: Idd4d836d11e0ae615b59c6648d49348449589787
2021-04-14Merge changes from topic "rust_vendor_support" Ivan Lozano
* changes: Add more Rust vendor image support. rust: Use new common image mutator interface.
2021-04-14Merge changes from topic "rust_benchmark" Jeffrey Vander Stoep
* changes: Attach rust_benchmark to atest and tradefed. Add rust_benchmark module to soong.
2021-04-13Add more Rust vendor image support. Ivan Lozano
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-09rust: Add HWASan build support Tri Vo
HWASan for static Rust executables is not supported yet. Bug: 180495975 Test: build local test app with HWASan Change-Id: I46e851c82a16943586ec3a789f09a58651d036e3
2021-04-07Stripped rust bin/libs are included in APEX Jiyong Park
Previously, when a rust bin or library is selected for an APEX, OutputFile() was used to get the file to be used. However, OutputFile() always returns the unstripped output file even when the stripped output file is available. As a result, APEX having a rust module was very big due to the debugging information that exists in the unstripped file. When a rust module is directly installed to the built-in partitions, we use the stripped one whenever it's available. To make the same happen when the rust module is placed in an APEX, OutputFile() is modified to return the unstripped output if it's available. Bug: 181751814 Test: TARGET_BUILD_APPS=com.android.virt m The size is reduced from 180MB to 43MB Change-Id: I6f8479e6a4794aac8bf94a84afdf65d417c75db0
2021-04-06Attach rust_benchmark to atest and tradefed. Jakub Kotur
Automatically generate required tradefed configs for rust benchmarks so that they're available in atest. Test: atest <module with rust_benchmark defined> Bug: 155309706 Change-Id: I6002100367a66b6b0555614acc6cebb00dbf435d
2021-02-19Add ctx to AndroidMkExtraEntriesFunc Colin Cross
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to access providers. Test: m checkbuild Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-01-29rust: Allow rust_tests to include data files. Ivan Lozano
Adds the ability to define data files that should be installed alongside the test. This also fixes a bug wherein rust_test properties were duplicated. Bug: 171710847 Test: rust_test module with "data" property installs files to device. Change-Id: I091489afaf7e76b751a33a28049590d9fb39fe5f
2021-01-15Migrate Rust to LLVM coverage. Joel Galenson
Bug: 177675913 Test: Manually compile, run, and see output with llvm-cov. Change-Id: I66729cff87a848782e9fa1b95cbbc06318c5761a
2020-12-10Rust: Vendor support for Rust static libraries. Ivan Lozano
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-01Add test suite handling to central androidmk code Liz Kammer
MTS is introducing partial MTS test suites that are per-module, with names of the format: mts-${MODULE}. By centralizing the code for test suites, we can automatically add "mts" test suite when an "mts-${MODULE}" test suite is specified, reducing duplication. Test: m mts Bug: 170318013 Change-Id: I8ce9d3c252fcc0a937bb5f2826d21cb6c6932d82
2020-11-30rust modules can be included in apex Jiyong Park
We will have some APEXes having rust binaries and libraries. So, adding the support for the types of modules. rust.Module now inherits from android.ApexModuleBase and implements the android.ApexModule interface. Bug: 172414324 Test: m Exempt-From-Owner-Approval: rebased after +2 from the owner Change-Id: I356ef4c45f782a6460f001e83af96d1710642d80
2020-11-24Refactor rust to use AndroidMkEntries Liz Kammer
This is to facilitate consolidation of compatibility suite logic. Test: go soong tests Test: m nothing & compare soong Android mk files -- only diffs are elimination of duplicate LOCAL_UNINSTALLABLE_MODULE := true lines Change-Id: I76211505b2b6afde5d0431586b77d799cf70c6b9
2020-11-16Add unit_test test option in test configs Dan Shi
This change allows a test (native, java, rust or python) to be included in host-unit-tests suite when test option `unit_test` is set to true. Bug: 172006742 Test: m host-unit-tests Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
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-18rust: Add libstd linkage mutator for rlibs. Ivan Lozano
The current state of linkage is that device targets always link libstd dynamically except for rust_ffi_static which requires a static libstd linkage. However this prevents producing rust_ffi_static modules which depend on other Rust libraries as those dependencies will link libstd dynamically and cause a collision. We also want our rust_test modules to statically link in libstd as well. This adds a linkage mutator for rlibs that creates a variant for each libstd linkage. Dependent modules can then select the variant that matches their linkage of libstd. Also fixes an issue where installation paths were being generated for rlibs and static libs even though they weren't being installed. This broke when adding the linkage mutator as Make would complain about multiple targets producing the same output. Bug: 168729404 Test: rust_ffi_static module with other rustlib dependency can be built. Change-Id: I955b484bf5809e8fc5517750c7f8df82d3ca8895
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
2020-08-28rust: strip libraries and binaries ThiƩbaud Weksteen
Reuses the cc.Stripper logic. Abstracts Stripper to avoid the spreading of references to the cc package. rustc requires unstripped libraries (precisely, with the `.rustc` section) when building dependent targets. Contrary to cc, the output of a compiler module will remain unstripped and only an extra build rule will be added. This rule will be referenced at install time (in baseCompiler.install or androidmk). This change drastically reduces the size of the installed libraries: (unstripped, from out/target/product/crosshatch/system) $ find . -name \*.dylib.so -print0 | du -c --files0-from=- 149996 total (stripped, with this change) $ find . -name \*.dylib.so -print0 | du -c --files0-from=- 42380 total Bug: 153430439 Test: cd external/rust; mma Change-Id: I94fd8bbcec97e0610aa325d3db4460be84d01734
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-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-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
2020-06-25Support multiple dists per Android.bp module, and dist output selection. Jingwen Chen
This CL adds "dists" to the base property struct to support multiple dist file configurations, and generic tag support to dist tagged outputs of modules. Fixes: b/152834186 Test: soong tests and `m sdk dist` Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-11Make rust_test file output more similar to cc_test. Ivan Lozano
This changes the way the output filename is calculated for rust_test binaries to be more similar to cc_test. This also removes the option to define multiple test binaries in a single rust_test module via the TestPerSrc mutator. Now each rust_test module corresponds to a single test binary. Bug: 158500462 Test: m -j pin-utils_tests_pin_utils Test: m -j unicode-xid_device_tests_unicode_xid Change-Id: I6e0f79dcb4e49fa49d6ebb36abeef67a9eb180a0
2020-05-05Add gcov coverage support to Rust modules. Ivan Lozano
This adds gcov coverage support for Rust device library and binary modules (including test modules). Support is provided to pass Rust static library gcno files to CC modules and visa versa. Additional changes: * Begin mutator added for Rust modules. * SuffixInList added to android package. * CoverageEnabled added to Coverage interface. * CoverageFiles added to LinkableLibrary interface. * Fix in coverage mutator for non-CC modules which marked the wrong variant as the coverage variant. * Added coverage libraries to the cc.GatherRequiredDepsForTest. Bug: 146448203 Test: NATIVE_COVERAGE=true COVERAGE_PATHS='*' m -j <rust_module> Change-Id: If20728bdde42a1dd544a35a40f0d981b80a5835f