summaryrefslogtreecommitdiff
path: root/rust/rust.go
AgeCommit message (Collapse)Author
2024-09-11Delete multitree api imports code Spandan Das
The mutltiree workflow has not been in use for a while. This CL cleans up the code that was added to support multitree. Details - Delete cc_api_library, cc_api_headers, cc_api_variant module types. These module types contain build rules for prebuilt stub .so and .h files - Update the DepsMutator of cc.Module to not create a dependency on a sibling cc_api_* module if it exists. e.g. do not create a dependency on libfoo.apiimports if libfoo is listed in `shared_libs`. - Remove cc_api_library from the stub/impl selection logic for cc modules Test: m nothing --no-skip-soong-tests Test: presbumits Change-Id: Ie194157fb3bbc630f384cdd9b694b0fba6786ded
2024-09-03Move checkbuild targets of Soong modules into Soong Colin Cross
Pass the name of Soong's checkbuild target for each module to Make so that it can depend on it from the main checkbuild rule. This will give better control over which files get built, allowing checkbuild to skip the jar combining step when transitive classpath jars are enabled. The per-module checkbuild targets are passed to make instead of added directly as a dependency of checkbuild in order to maintain the existing behavior of only building modules exposed to make in checkbuild. Also tweak the existing calls to CheckbuildFile and add InstallFileWithoutCheckbuild to match the files that are in the Make-based checkbuild. Bug: 308016794 Test: m checkbuild Change-Id: Ic5140819381d58f4d00f23a7a12447950c4cf268
2024-08-27Add a property to rust_ffi targets to exclude them from APEXes. Ashutosh Agarwal
This is a temporary measure until stubs are properly supported by rust_ffi targets. Bug: 361441210 Bug: 362509506 Change-Id: Ieabd4e3abf442de660f39ec6c5776f5832b25e14 Test: manual
2024-07-17Convert rust_libraries and rust_stdlinkage mutators to TransitionMutators Colin Cross
Replace rust.LibraryMutator and rust.LibstdMutator with TransitionMutators. Bug: 319288033 Flag: EXEMPT refactor Test: all soong tests pass Test: no change to build.ninja Change-Id: Ia24a582119d39889279d7b93bac9259685153619
2024-07-11Add IsAddingDependency to IncomingTransitionContext Colin Cross
Add an IsAddingDependency method to IncomingTransitionContext that returns true if IncomingTransition is called after the transition has already won while adding a new dependency. This will be used as part of the transition mutators to support an apex use case where incoming dependencies during the initial apex mutator need to be rewritten onto the platform variant for modules that don't support the apex, but a later call to OtherModuleDependencyVariantExists must not rewrite the requested apex variation onto the platform variant. This should be used sparingly, all uses will have to be removed in order to support creating variants on demand. Bug: 319288033 Test: TestIsAddingDependency Flag: EXEMPT refactor Change-Id: Ib8e419d35ff8f7cbff9667c1cd40d05ccfacab8b
2024-06-28Remove test_per_src Colin Cross
Remove test_per_src, it never worked well and is incompatible with all of the test infrastructure. Uses in the platform have been removed, generally by replacing them with individual cc_test modules. Test: builds Flag: TEST_ONLY Change-Id: I257c035da35ca8358ae9423b46453878f54efeb1
2024-06-26cc/rust: Alias ffi rlib variant for static_libs Ivan Lozano
Alias the rlib variant to "link: static". This allows declaring rust_ffi_rlib modules in static_libs. This effectively removes any distinction between rust_ffi_static and rust_ffi_rlib. Removing the functionality for building Rust staticlib modules will be cleaned up in a follow-on CL. This should have the effect of changing the default linkage for all rust modules in static_libs from linking individual staticlibs to building a single staticlib that includes all rust_ffi rlib dependencies. This removes the static_rlibs property, as we're now handling the choice dynamically. This also makes rlibs only propagate through cc_library_static modules if the rlib is included in whole_static_lib. This both mirrors the expected behavior of cc libraries and helps control which version of a crate ends up in the final link (e.g. libdoh_ffi vs libdoh_ffi_for_test). Bug: 254469782 Test: m Test: m blueprint_tests Change-Id: I2925f67f6dc9329dae3dcccafb8560900ac8a6fc
2024-06-24Export Soong modules and build a database from metadata from Make and Soong. Wei Li
Bug: 324465531 Test: CIs Test: m compliance-metadata.db Change-Id: Ia1c9ab0ae874dd47969555ddbfb93405b57a651f
2024-06-24Merge "Add OutputFilesProvider support for singleton" into main Zi Wang
2024-06-24Add OutputFilesProvider support for singleton mrziwang
This CL also changes to use OutputFilesProvider on rust module, which has singleton involved. Test: CI Bug: 339477385 Bug: 348494466 Change-Id: Idc5c0fb9f8425f09184d5b73531ee3052e5a076c
2024-06-21Move vendor and product variant generation logic from cc package to android ↵ Jihoon Kang
package Although image variation generation logic has moved out of cc package to the android package, the vendor and product partition variants generation logic is still specific to cc package. Therefore, in order to create a product or vendor variant, they have to specified in `ExtraImageVariants`. In order to avoid such confusing behaviors and enforce modules to specify product and vendor installation rules, this change moves the vendor and product variant generation logic to android.ImageInterface. Test: m nothing --no-skip-soong-tests && diff contents of out/soong/Android-{product}.mk Change-Id: I9e14f3739d9dea94167ee6a91e92b2f942055aba
2024-06-05Remove VNDK related code from Soong Kiyoung Kim
As VNDK definition is fully removed from Android.bp, VNDK related code can be removed from Soong. This change removes VNDK related code except VNDK prebuilt which is required to build former versions of VNDK APEX with prebuilts. Bug: 330100430 Test: AOSP CF build succeeded Ignore-AOSP-First: Resolve Conflict Change-Id: Id9c8993343221c8464c97296bde0ff40b14b9b0b
2024-05-24Remove VndkUseCoreVariant related code from build Kiyoung Kim
VndkUseCoreVariant feature is deprecated along with VNDK. This change removes related code from Soong. Bug: 330100430 Test: AOSP CF build succeeded Change-Id: Ie182c9e4dc9cf0a4fe9d5fddf5b36754ddb53d18
2024-05-17Merge changes from topic "rust-made-to-order-staticlibs" into main Ivan Lozano
* changes: rust: made-to-order rust staticlibs rust: refactored transformSrctoCrate
2024-05-16rust: made-to-order rust staticlibs Ivan Lozano
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-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-05-02Make the enabled property configurable Cole Faust
This allows using select statements with it. Bug: 323382414 Test: m nothing --no-skip-soong-tests Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191 Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
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-03-19Add `aliases` property for renaming Rust dependencies. Andrew Walbran
This is equivalent to specifying a dependency name different to the package name in cargo, which some external crates do. Bug: 308790322 Test: Built libgrpcio with aliases for protobuf Change-Id: I2801222051fdd962460cc7f4900cec357f63b974
2024-03-15Support rust in aconfig mode validation. Yu Liu
Bug: 323071835 Test: Unit tests Change-Id: I6de2a6fe1618e21c9aab728e6d77c6b0c6ce33df
2024-01-24Convert coverageMutator to a TransitionMutator Colin Cross
Convert coverageMutator to a TransitionMutator as a step towards variants-on-demand. Bug: 319288033 Test: coverage_test.go Test: treehugger coverage builds Change-Id: Ic50c0040dea8b42c36b5d784221daa00b7b0d379
2024-01-05Generate image variation without version Kiyoung Kim
Current CC/Rust Image variations are generated with target VNDK version. However, this is no longer valid if VNDK is deprecated. This change generates image variation without version ("vendor", "product") if VNDK is deprecated. Bug: 316829758 Test: m nothing --no-skip-soong-tests passed Test: aosp_cf_x86_64_phone build succeeded Change-Id: I2387ed8a2632bfd9462621f882a947695ae1653d
2023-12-19move CollectDependencyAconfigFiles to android LaMont Jones
This needs to be called by some modules in android. Bug: 308625757 Test: manual Change-Id: I389fcfd88a3f4bd85a9218fdd4dd66d8a239bb67
2023-12-14Convert OtherModuleProvider to generic providers API Colin Cross
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider to use the type-safe android.OtherModuleProvider API. Bug: 316410648 Test: builds Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
2023-12-14Convert Provider to generic providers API Colin Cross
Convert all of the callers of Provider/HasProvider to use the type-safe android.ModuleProvider API. Bug: 316410648 Test: builds Change-Id: I73479de1625fa2865b6c73444cd477e50d56dc5a
2023-12-14Convert SetProvider to generic providers API Colin Cross
Convert all of the callers of SetProvider to use the type-safe android.SetProvider API. Bug: 316410648 Test: builds Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-14Convert NewProvider/NewMutatorProvider to generic providers API Colin Cross
Convert all of the callers to NewProvider and NewMutatorProvider to use a generic type parameter instead of an example object. Bug: 316410648 Test: builds Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
2023-12-08Remove ConvertWithBp2build implementations Colin Cross
Remove the ConvertWithBp2build implementations from all the module types, along with the related code. Bug: 315353489 Test: m blueprint_tests Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-07rust: add aconfig_flag support LaMont Jones
Bug: b/308625757 Test: manual Change-Id: Ifd98cd0ad4e2525b08f5766e9332991c049162ea
2023-12-05Add source file provider for genrule/srcs, python libraries and rust libraries. Aditya Choudhary
Change-Id: I2d7d4684a10c15aeecc27b8db800ab27a807d2e2
2023-11-22Merge changes I0caddbf6,Iee20b060,I6c92580b,I45028945,Ia7dd5220, ... into main Matthew Maurer
* changes: rust: Resolve crate roots outside rust-project rust: Cache crateRootPath to avoid ctx rust: internalize srcPathFromModuleSrcs rust: move crateRootPath to compiler rust: Privatize Cargo* methods on compiler rust: Move compiler interface to compiler.go
2023-11-20Add test spec provider to test modules. Aditya Choudhary
Provider added for the following test modules in this change: art_cc_test, cc_benchmark, cc_fuzz, cc_test, cc_test_host, rust_test,and rust_test_host. Bug: 296873595 Test: Manual test Change-Id: I815680529bcbecacb3a2bdb8f3746053afdee48c
2023-11-20rust: Move compiler interface to compiler.go Matthew Maurer
Refactor cleanup Bug: 309943184 Test: m nothing Change-Id: I7dcb0af64a4db71fdc46c0876b22e5015c02438e
2023-10-19Add bp2build converter for rust_ffi_static Vinh Tran
Test: go test Change-Id: Ibf0bb2687073f8650da4ca27c1f57e68a93025d4
2023-10-02Revert "Split Rust crate builds into compile and link phases." Colin Cross
This reverts commit e7c71c344d462cac998b37d551bd78baa892082d. The intermediates created by the separated rust compile steps are very large, on the order of 60GB. This is more than CI can support for now, revert the split into compile and link phases. This comes at the expense of incremental build time, especially when modifying C/C++ sources that are dependencies of rust modules. Bug: 293349612 Test: builds Change-Id: I81169e7d0727330c8de5e7688dcdc87fe7b8d3b5
2023-09-27rust: Import protos from dependent rust_protobuf Ivan Lozano
rust_protobuf were unable to import protos from other rust_protobuf modules. This CL adds support for that. rust_protobuf modules which are listed in rustlibs will have their modules imported into the generated protobuf stub. Additionally, rust_protobuf modules which define "exported_include_dirs" will export those include paths to dependent rust_protobuf modules. Bug: 301266700 Test: m rust Change-Id: I132edffa4d77e0ac80a7ac934f873374c8e94c1b
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-22Revert "support sandboxed rust rules" Wen-yi Chu
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-22Revert "remove rust deps on clang prebuilts" Colin Cross
Revert submission 2758566 Reason for revert: b/301463284 Reverted changes: /q/submissionid:2758566 Change-Id: I54f0ecbbd922deb23009ca89ff79689e128f4f31
2023-09-21remove rust deps on clang prebuilts Sam Delmerico
Prebuilt modules for some clang tools were created in aosp/2746469, but they do not exist for darwin builds. Adding the same modules in prebuilts/clang/host/darwin-x86/Android.bp results in duplicate module names. Instead we can just get a path to these files directly in Soong. Test: CI Test: https://android-build.googleplex.com/builds/abtd/run/L90700000963131594 Change-Id: I620cfd7b1ab34bd0959feea562d599b963717198
2023-09-20Merge changes from topics ↵ Sam Delmerico
"revert-2746976-revert-2605644-rulebuilder-ninja-vars-OAAWYCDDLT-KMAGKVIXAT", "sandbox-rust-inputs" into main * changes: support sandboxed rust rules conditionally escape rule builder command Revert^2 "allow Ninja variables in RuleBuilder API" Revert^2 "add crate_root property to rust modules" Revert^2 "add rust_toolchain_rustc_prebuilt module type"
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-09-15support sandboxed rust rules Sam Delmerico
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-08-25Implement bp2build converter for rust_protobuf_host Vinh Tran
Test: go test Bug: 295925256 Change-Id: I43b7359da8fc19f4338e2583448b7617194df5e6
2023-08-25Implement bp2build converter for rust_binary Vinh Tran
Test: go test Bug: 295910295 Change-Id: Ieb18d9071f28e53a0463614594cee0fd755b7b3c
2023-08-25Allowlist all aconfig deps modulo libprotobuf and libaconfig_protos Vinh Tran
Test: b build //external/rust/crates:all Bug: 295903972 Change-Id: Ieb29516722155ef8921e454eaa1ea51fad99ec08
2023-08-25Implement bp2build converter for rust_proc_macro Vinh Tran
Test: WIP Bug: 297356482 Change-Id: I17d1a0a95d4a67ccbc9b2d74e49bcacd6ff4d26b
2023-08-25Implement bp2build converter for rust_library Vinh Tran
Test: go test Bug: 297294749 Change-Id: I5400fe2c0fe2097b7a5810c736fbd1de4f35c6f7