Support for rust recovery snapshot.

Bug: 197866992
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: I02bb188669cf9f17073592a4622998f96d5f54ac
This commit is contained in:
Jose Galmes
2021-11-05 14:04:54 -07:00
parent ba6d4ac226
commit d7d99be225
4 changed files with 22 additions and 9 deletions

View File

@@ -44,6 +44,8 @@ func init() {
func registerRustSnapshotModules(ctx android.RegistrationContext) {
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
cc.RecoverySnapshotImageSingleton.RegisterAdditionalModule(ctx,
"recovery_snapshot_rlib", RecoverySnapshotRlibFactory)
}
func snapshotLibraryFactory(image cc.SnapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
@@ -104,6 +106,13 @@ func VendorSnapshotRlibFactory() android.Module {
return module.Init()
}
func RecoverySnapshotRlibFactory() android.Module {
module, prebuilt := snapshotLibraryFactory(cc.RecoverySnapshotImageSingleton, cc.SnapshotRlibSuffix)
prebuilt.libraryDecorator.BuildOnlyRlib()
prebuilt.libraryDecorator.setNoStdlibs()
return module.Init()
}
func (library *snapshotLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
arches := config.Arches()
if len(arches) == 0 || arches[0].ArchType.String() != library.Arch() {