summaryrefslogtreecommitdiff
path: root/rust/rust.go
AgeCommit message (Collapse)Author
2025-03-13Change CommonModuleInfoProvider to a pointer. Yu Liu
Bug: 358427516 Test: Manually verified genereated ninja and mk files, unit tests. Change-Id: I53a6dd718232735decbeb93febfd269dd9449e86
2025-03-07Rename CommonModuleInfoKey to be consistent with others. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I1ce8bc782666586633ded9cfaf1b9590e3c0efde
2025-03-07Convert singletonModuleSingletonAdaptor, rustdocSingleton, Yu Liu
sizesSingleton, movedToApexLlndkLibraries and allBuildFlagDeclarationsSingleton to use ModuleProxy. Bug: 377723687 Test: Unit tests and compare the ninja json and mk files generated. Change-Id: I90ea5599a55975b27e9ce6e91b20104849f5887f
2025-02-25Convert the following singletons to use ModuleProxy: Yu Liu
buildTargetSingleton exportedJavaDeclarationsLibrarySingleton javaFuzzPackager kytheExtractAllSingleton kytheExtractJavaSingleton kytheExtractRustSingleton lintSingleton logtagsSingleton makeVarsSingleton ndkAbiDiffSingleton ndkAbiDumpSingleton phonySingleton platformCompatConfigSingleton sdkSingleton Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I625ac8a209ca93755b2ba232202cfb44ecefde0a
2025-02-20Merge "rust: Propagate MTO libs linked whole through dylibs." into main Ivan Lozano
2025-02-19rust: Propagate MTO libs linked whole through dylibs. Ivan Lozano
Because dylibs don't export symbols of whole-archive staticlibs, we simulate this by propagating those static libs through to dependent modules. Similarly, we must do the same for rlibs from cc_* modules used to generate MTO staticlibs. Bug: 395915782 Test: New soong tests Test: m rust Change-Id: I83d6a08234af04af5039764f5a80f659b24aa132
2025-02-19Change depVisitor to use providers instead of type-asserting to Yu Liu
interfaces directly, the next step is to change it to use ModuleProxy once IsDepInSameApex is ready. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I13a4e256a26dbf7f9b3b746d628ac8f68b4e598e
2025-02-13Convert CheckMinSdkVersion to use providers. Yu Liu
Next step is to convert it to use ModuleProxy once IsDepInSameApex is converted to use providers. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I20cb052666fa95eb964e63e3302ac892d3324183
2025-02-13Support DepIsInSameApex using provider. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I8ec5e8a3a06d078602ebaa902cacb70987f1deda
2025-02-12Merge "rust:Add Rust support for made-to-order staticlibs" into main Ivan Lozano
2025-02-12rust:Add Rust support for made-to-order staticlibs Ivan Lozano
If a cc_library_static has a whole_static dependency against a rust_ffi_static module, we need to ensure that rust_* dependents of the cc_library_static don't just throw away the rlibs the cc_library_static module is intending to include whole (and does so by propagating them down to dependents to be included in the generated Rust staticlib). This reuses the plumbing we have in cc to generate a Rust staticlib from the propagated dependencies. Bug: 395915782 Test: m rust Change-Id: I413c8d2476e0b2a1c623581fdbfb5734a62ae455
2025-02-11Merge changes from topics "apex_transition_info", ↵ Colin Cross
"bcp_dependency_through_apex" into main * changes: Convert android.TransitionMutator to TransitionInfo Pass libraryToApex and apexNameToFragment mappings into CreateClasspathElements Convert apex transition tag to dependency on apex Add extra dependency from apex to bootclasspath fragments to modules Move prebuilt mutators earlier
2025-02-11Merge "rust: Rename flag providers for clarity" into main Ivan Lozano
2025-02-10Convert android.TransitionMutator to TransitionInfo Colin Cross
Use the ApexInfo instead of a string as the TransitionInfo for apex variations. This removes the need for apexInfoMutator, which is the last remaining top down mutator. This has a variety of ramifications. One is that it is no longer possible to add a dependency onto the apex variation of a module, as that would require constructing a matching ApexInfo. Instead, anything that wants to add a dependency on the apex variation has to depend on the apex instead, and get to the module by walking its transistive dependencies. Another ramification is that modules in apexes can no longer determine which apexes they are in (unless they set UniqueApexVariations so that each variation is in exactly one apex). This prevents some of the existing container violation checks from working after this CL, tracked in b/394955484. It also requires using unique variation names for the prebuilt and source dependencies of apexes, so the apex variations for dependencies of prebuilts now have a prebuilt_ prefix. Bug: 372543712 Bug: 394955484 Test: go test ./... Change-Id: I3d08aca1ac956ab0e343ec3f235a736cd93be0e1
2025-02-07Merge "Remove configurable values from providers" into main Treehugger Robot
2025-02-06Remove configurable values from providers Cole Faust
Providers are data exported from one module to another. Configurable properties are the collection of all possible values of a property, to be resolved under the module's configuration. If you export a configurable from one module to another and then resolve it there, it will be evaluated with the wrong configuration. Bug: 394967253 Test: m nothing Change-Id: I934b08538bcc3267b3ec44925591f16a1c59292c
2025-02-06Revert "rust: Define UseSdk for Rust modules" Matthew Maurer
Revert submission 3478292 Reason for revert: Nil dereference in Soong when linking Rust into a module affected by the SDK mutator. Reverted changes: /q/submissionid:3478292 Change-Id: I8805da3d7bd6f9da19ba86b72d228e0ef7e213df
2025-02-06Merge changes I902cfb76,I46800788 into main Ivan Lozano
* changes: rust: Use libprofile-clang-extras_ndk for SDK cov rust: Define UseSdk for Rust modules
2025-02-06rust: Define UseSdk for Rust modules Ivan Lozano
Rust modules have the Sdk_version property now, so UseSdk should be able to return non-false values now. Bug: 203478530 Test: m & m rust Change-Id: I468007880ba8688c127965b17e65230bc9aba113
2025-02-05Merge changes Ia968e06b,I60192285,I0e857a64,Ia8880fe5,If7a92ca0, ... into main Colin Cross
* changes: Add explicitlyImpl to shared library dependency tags Don't enforce visiblity on platformBootclasspathImplLibDepTag Don't merge apex variations with different UsePlatformApis Use unique apex variations for bootclasspath fragments Correctly compute externalDep for dependencies of override_apex modules Remove extraneous variation name from OverrideApex
2025-02-05rust: Rename flag providers for clarity Ivan Lozano
Rename the Rust flag and export info providers to make it more clear when workign with the Rust exporter vs the cc exporter. Also renames a test for additional clarity. Test: m blueprint_tests Change-Id: I652b55ef000a2cd00f47b1dbfe86713c33ae9d63
2025-02-05rust: Propagate static libs correctly Ivan Lozano
A dylib link is a final link, so we should not propagate staticlibs through them. Most of the time this made no difference, but this was breaking edge cases on coverage builds. This CL breaks apart linkObjects so we can more finely tune which dependencies we propagate and which we should not. rlibs should only propagate non-whole static librares, while rlibs and dylibs propagate whole static libs. Bug: 377932175 Test: m Test: New Soong tests Change-Id: Ib2ae3dcb7d775a57bd4b1715ec528f48cc0ca026
2025-02-03Add explicitlyImpl to shared library dependency tags Colin Cross
Instead of testing that explicit implementation libraries are not incorrectly used in an apex after the fact add the explicitlyImpl flag to dependency tags and use it in cc.DepIsInSameApex and rust.DepIsInSameApex to require that explicit implementation dependencies are in the same apex. Bug: 372543712 Test: go test ./... Change-Id: Ia968e06b578d5ab886a965c3981565d4895dddcd
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
2025-01-24Merge "Convert rust to use ModuleProxy." into main Yu Liu
2025-01-23Convert rust to use ModuleProxy. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I2eb0134bb727f5875d579dae1fff5b70658bd2bb
2025-01-23Merge "rust: De-duplicate depLinkFlags" into main Ivan Lozano
2025-01-23rust: De-duplicate depLinkFlags Ivan Lozano
In some cases, duplicate link flags can bubble up through dependencies, which may cause link-time errors if e.g. they involve whole-static libraries. Deduplicate these to avoid this issue. Bug: 391296959 Test: m rust Change-Id: I1b14a847cf57d588a28a52cdcefeca443d4d56ac
2025-01-15Convert collectDirectDepsProviders, collectTransitiveSrcFiles and Yu Liu
r8Flags to use ModuleProxy. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Ib3d45c317e1f2669808d0c785454fb8d8fb9cd3b
2025-01-15Convert collectJniDeps to use ModuleProxy. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I36f8b339f70ab47be84c598231cb971145fc4ef7
2025-01-10rust: Add stub support for rust_ffi modules Ivan Lozano
This adds stubs support for rust_ffi and rust_ffi_shared modules. Usage should match current cc usage. The stubs generator leveraged is the cc stubs generator. Bug: 203478530 Test: m blueprint_tests Change-Id: I043b9714a357cd5fe17c183ccdf86900f5172e0e
2025-01-10rust: Add CcInfo.LinkerInfo to Rust modules Ivan Lozano
This prepares Rust modules for stubs and ensures that as CC modules use more of the CcInfo logic, Rust modules are providing the expected information. Bug: 203478530 Test: m Change-Id: I698eca7253010697ce72b2d39dcb6edf864f4581
2025-01-10Refactor cc/rust to prep for Rust stubs Ivan Lozano
This CL largely handles this refactoring in preparation for Rust stubs support. Rust modules need to be able to communicate stubs information to cc, and certain bits of cc needs to be exported so rust can reuse them. A new VersionedLinkableInterface is added to capture most of the stubs-related interface definitions. Bug: 203478530 Test: m blueprint_tests Change-Id: I380225402fa85a3c39e7b18deb657054b3a52fbe
2025-01-08Convert depsToPaths to use ModuleProxy for both cc and rust. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Id465f293c3615fc803b34c990f19b4386ebece1c
2024-12-18Remove source_file_provider.go after it's last usage was removed. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Iff10448dc4dda49e1f02258a4c113db75778a95d
2024-12-17Merge "rust: Alias rust_ffi_rlib to rust_library_rlib" into main Maciej Żenczykowski
2024-12-16Merge "rust: Add version scripts and symbol exports" into main Ivan Lozano
2024-12-13rust: Alias rust_ffi_rlib to rust_library_rlib Ivan Lozano
With the new transition mutators, the distinctions between rust_ffi_rlib and rust_library_rlib are not necessary. This CL removes the remaining distinctions to allow an unusual use case where a rust_library and a rust_ffi_rlib would otherwise be created from the same source. This would allow defining a single rust_library_rlib that works for both rust modules and cc modules. One key change is that rust_ffi_rlibs only produced an rlib-std variant previously, and now produce dylib-std variants as well.This surfaced an issue where a libstd linkage mismatch would cause rustc to throw a consufing missing crate error. We instead add logic to catch this in Soong and provide a more useful error message. Bug: 383552450 Test: m rust Test: m blueprint_tests Change-Id: I611ca46934059735d06229952cfd8e0ab7050486
2024-12-13rust: Add version scripts and symbol exports Ivan Lozano
This allows Rust modules to define a version_script for shared library variants. This requires using a wrapper for the linker (clang++) to intercept the flags which rustc emits. This also adds the ability to export additional symbols in addition to those exported by rustc by default, e.g. whole_static_library symbols. Bug: 314309643 Test: New Soong tests pass. Test: m Test: m <simple version script module> Test: m <simple extra symbols module> Change-Id: I93c9552e5e1181df4663d194c4df4b7053553dd4
2024-12-12Simplify cc.IncomingDepIsInSameApex Colin Cross
The libDepTag checks don't need to be in IncomingDepIsInSameApex, move them back to OutgoingDepIsInSamApex. This also means that the fromStatic field in libraryDependencyTag is no longer necessary, as OutgoingDepIsInSameApex can access c.static() directly. Bug: 372543712 Test: builds Change-Id: I1d97a02055460445bfa854f3d9b78f185d4a6a15
2024-12-11Split DepIsInSameApex into outgoing and incoming Colin Cross
Prepare for calling DepIsInSameApex from the apex transition mutator by splitting all the implementations in two, one that is called on the outgoing module and only takes the depTag, and one that is called on the incoming module and only takes the depTag. apexBundle.depVisitor was passing the child into android.IsDepInSameApex for both the parent and child paramters. The parent field was only used to find the type on which to call DepIsInSameApex, so this effectively used the child's implementation of DepIsInSameApex. That used to be necessary when the parent and child were of different module types, as the parent module type may not have been aware of the rules for the child module type, but is no longer necessary with split outgoing and incoming DepIsInSameApex. Bug: 372543712 Test: all soong tests pass Change-Id: If7c81ec3f7b1ea69d77e9ad7694e238820194e59
2024-12-09Move parent static check in cc.Module.DepIsInSameApex into tag Colin Cross
In order to prepare for splitting DepIsInSameApex so it can be called separately on the outgoing and incoming modules during a transtion, add fromStatic to libraryDependencyTag so that the check doesn't need to access both the parent and the child module. This also fixes cases where the static parent was misdetected, which causes a single test failure that seems correct, TestApexWithTests. cc.Module.DepIsInSameApex correctly identifies that the "mytest" module is static and the "mylib" shared library dependency is not used in the apex. Fix the test to make "mytest" non-static so that "mylib" is included. Bug: 372543712 Test: all Soong tests pass Change-Id: Ibb0cfff77adefb804ff6c66467ac761b723597de
2024-12-03Reland "Skip packaging cross container cc deps of apk-in-apex" Spandan Das
This relands https://r.android.com/3375509, but uses `NotInPlatform` of the top-level app in `collectAppDeps`. The original implementation was reverted because it skipped packaging jni lib deps that crossed an api domain boundary. This is the intended behavior for apk-in-apex, but runs into issues for android_test. The linkerconfig for these has been setup to allow access to LLNDK (in system) and LLNDK_MOVED_TO_APEX_LIBRARIES. Other libraries like `libnativebridge` cannot be accessed by tests on device, so the tests need their own copy. Test: m ArtServiceTests Test: verified that the contents of the apk are same before and after Bug: 375473764 Change-Id: I3a3985e576959c3113fc1e11f43dbe669603ec22
2024-12-02Revert "Skip packaging cross container cc deps of apk-in-apex" Priyanka Advani (xWF)
This reverts commit 6e0c11049d859040c125f19cfab01d473b4bd398. Reason for revert: Droidmonitor created revert due to b/381931089. Will be verifying through ABTD before submission. Change-Id: Id5cb534132c1db84cfda5f1da5c62c0a26bce19c
2024-12-02Skip packaging cross container cc deps of apk-in-apex Spandan Das
With this change, apk-in-apex will skip packaging a cc library dependency if the dependency is part of the platform or part of a different apex. Bug: 375473764 Test: go test ./java ./apex Test: presubmits Change-Id: I91351973c2c941c7531e9f7d4879049eab766a12
2024-11-12Use VisitDirectDepsProxy in checkStaticExecutables. Yu Liu
Bug: 377723687 Test: Check the ninja and mk files. Change-Id: I1c12fcabc7b389a85ffede0f9a03fdaeb92f1f5d
2024-11-06Merge "Verify that libraries in apexes don't link to implementations outside ↵ Colin Cross
the apex" into main
2024-11-05Verify that libraries in apexes don't link to implementations outside the apex Colin Cross
As part of removing some of the complexity in Soong around using stub vs. implementations for shared library dependencies a syntax will be added to Soong to allow explicitly selecting stubs vs. implementation. To avoid incorrect use, add a verification pass on apexes that ensure that all transitive implementation libraries used to link native libraries or binaries in the apex are themselves in the apex. Bug: 372543712 Test: TestApexVerifyNativeImplementationLibs Flag: EXEMPT host only Change-Id: I4aeaca00a359ce97e8f9efd2d8bffb8f9d2dc0df
2024-10-31Distinguish HideFromMake from SkipInstall Spandan Das
Invoking HideFromMake today would also make the module uninstallable. This was a safe assumption since the packaging sytem was in build/make - if a module is not visible to make, it is also uninstallable. With the advent of soong packaging system, this might not always be true. This CL disentangles SkipInstall from HideFromMake. This CL also sets SkipInstall on modules where the installation rules should not be emitted, e.g. to prevent duplicate installation rules between platform and apex variants of libraries Test: m nothing --no-skip-soong-tests Test: no diff in aosp_cf_x86_64_phone's system file_list.txt Change-Id: I80cdd60d2ebdba22fd37e748eb00242cc412bda1
2024-10-24Merge changes from topic "move-depset" into main Colin Cross
* changes: Update DepSet references Move DepSet to blueprint Convert DepSet to a wrapper around a pointer