Support for rust recovery snapshot.
Bug: 197866992 Test: source build/envsetup.sh Test: m -j nothing Change-Id: I02bb188669cf9f17073592a4622998f96d5f54ac
This commit is contained in:
@@ -66,7 +66,7 @@ func (recoverySnapshotImage) moduleNameSuffix() string {
|
|||||||
|
|
||||||
// Override existing vendor and recovery snapshot for cc module specific extra functions
|
// Override existing vendor and recovery snapshot for cc module specific extra functions
|
||||||
var VendorSnapshotImageSingleton vendorSnapshotImage = vendorSnapshotImage{&snapshot.VendorSnapshotImageSingleton}
|
var VendorSnapshotImageSingleton vendorSnapshotImage = vendorSnapshotImage{&snapshot.VendorSnapshotImageSingleton}
|
||||||
var recoverySnapshotImageSingleton recoverySnapshotImage = recoverySnapshotImage{&snapshot.RecoverySnapshotImageSingleton}
|
var RecoverySnapshotImageSingleton recoverySnapshotImage = recoverySnapshotImage{&snapshot.RecoverySnapshotImageSingleton}
|
||||||
|
|
||||||
func RegisterVendorSnapshotModules(ctx android.RegistrationContext) {
|
func RegisterVendorSnapshotModules(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("vendor_snapshot", vendorSnapshotFactory)
|
ctx.RegisterModuleType("vendor_snapshot", vendorSnapshotFactory)
|
||||||
@@ -231,7 +231,7 @@ func vendorSnapshotFactory() android.Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func recoverySnapshotFactory() android.Module {
|
func recoverySnapshotFactory() android.Module {
|
||||||
return snapshotFactory(recoverySnapshotImageSingleton)
|
return snapshotFactory(RecoverySnapshotImageSingleton)
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotFactory(image SnapshotImage) android.Module {
|
func snapshotFactory(image SnapshotImage) android.Module {
|
||||||
@@ -326,7 +326,7 @@ func (p *BaseSnapshotDecorator) SetSnapshotAndroidMkSuffix(ctx android.ModuleCon
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
images := []SnapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
|
images := []SnapshotImage{VendorSnapshotImageSingleton, RecoverySnapshotImageSingleton}
|
||||||
|
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
if p.Image == image {
|
if p.Image == image {
|
||||||
@@ -583,7 +583,7 @@ func VendorSnapshotSharedFactory() android.Module {
|
|||||||
// overrides the recovery variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
// overrides the recovery variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func RecoverySnapshotSharedFactory() android.Module {
|
func RecoverySnapshotSharedFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, SnapshotSharedSuffix)
|
module, prebuilt := snapshotLibraryFactory(RecoverySnapshotImageSingleton, SnapshotSharedSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyShared()
|
prebuilt.libraryDecorator.BuildOnlyShared()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -603,7 +603,7 @@ func VendorSnapshotStaticFactory() android.Module {
|
|||||||
// overrides the recovery variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
// overrides the recovery variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func RecoverySnapshotStaticFactory() android.Module {
|
func RecoverySnapshotStaticFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, SnapshotStaticSuffix)
|
module, prebuilt := snapshotLibraryFactory(RecoverySnapshotImageSingleton, SnapshotStaticSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyStatic()
|
prebuilt.libraryDecorator.BuildOnlyStatic()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,7 @@ func VendorSnapshotHeaderFactory() android.Module {
|
|||||||
// overrides the recovery variant of the cc header library with the same name, if BOARD_VNDK_VERSION
|
// overrides the recovery variant of the cc header library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func RecoverySnapshotHeaderFactory() android.Module {
|
func RecoverySnapshotHeaderFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, snapshotHeaderSuffix)
|
module, prebuilt := snapshotLibraryFactory(RecoverySnapshotImageSingleton, snapshotHeaderSuffix)
|
||||||
prebuilt.libraryDecorator.HeaderOnly()
|
prebuilt.libraryDecorator.HeaderOnly()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -698,7 +698,7 @@ func VendorSnapshotBinaryFactory() android.Module {
|
|||||||
// development/vendor_snapshot/update.py. As a part of recovery snapshot, recovery_snapshot_binary
|
// development/vendor_snapshot/update.py. As a part of recovery snapshot, recovery_snapshot_binary
|
||||||
// overrides the recovery variant of the cc binary with the same name, if BOARD_VNDK_VERSION is set.
|
// overrides the recovery variant of the cc binary with the same name, if BOARD_VNDK_VERSION is set.
|
||||||
func RecoverySnapshotBinaryFactory() android.Module {
|
func RecoverySnapshotBinaryFactory() android.Module {
|
||||||
return snapshotBinaryFactory(recoverySnapshotImageSingleton, snapshotBinarySuffix)
|
return snapshotBinaryFactory(RecoverySnapshotImageSingleton, snapshotBinarySuffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotBinaryFactory(image SnapshotImage, moduleSuffix string) android.Module {
|
func snapshotBinaryFactory(image SnapshotImage, moduleSuffix string) android.Module {
|
||||||
@@ -800,7 +800,7 @@ func RecoverySnapshotObjectFactory() android.Module {
|
|||||||
}
|
}
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
|
|
||||||
prebuilt.Init(module, recoverySnapshotImageSingleton, snapshotObjectSuffix)
|
prebuilt.Init(module, RecoverySnapshotImageSingleton, snapshotObjectSuffix)
|
||||||
module.AddProperties(&prebuilt.properties)
|
module.AddProperties(&prebuilt.properties)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
@@ -113,7 +113,7 @@ func ShouldCollectHeadersForSnapshot(ctx android.ModuleContext, m LinkableInterf
|
|||||||
return ctx.Config().VndkSnapshotBuildArtifacts()
|
return ctx.Config().VndkSnapshotBuildArtifacts()
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, image := range []SnapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton} {
|
for _, image := range []SnapshotImage{VendorSnapshotImageSingleton, RecoverySnapshotImageSingleton} {
|
||||||
if isSnapshotAware(ctx.DeviceConfig(), m, image.IsProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
|
if isSnapshotAware(ctx.DeviceConfig(), m, image.IsProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,8 @@ func init() {
|
|||||||
func registerRustSnapshotModules(ctx android.RegistrationContext) {
|
func registerRustSnapshotModules(ctx android.RegistrationContext) {
|
||||||
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
||||||
"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
|
"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
|
||||||
|
cc.RecoverySnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
||||||
|
"recovery_snapshot_rlib", RecoverySnapshotRlibFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotLibraryFactory(image cc.SnapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
|
func snapshotLibraryFactory(image cc.SnapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
|
||||||
@@ -104,6 +106,13 @@ func VendorSnapshotRlibFactory() android.Module {
|
|||||||
return module.Init()
|
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 {
|
func (library *snapshotLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
|
||||||
arches := config.Arches()
|
arches := config.Arches()
|
||||||
if len(arches) == 0 || arches[0].ArchType.String() != library.Arch() {
|
if len(arches) == 0 || arches[0].ArchType.String() != library.Arch() {
|
||||||
|
@@ -71,6 +71,10 @@ func (RecoverySnapshotImage) Init(ctx android.RegistrationContext) {
|
|||||||
ctx.RegisterSingletonType("recovery-snapshot", RecoverySnapshotSingleton)
|
ctx.RegisterSingletonType("recovery-snapshot", RecoverySnapshotSingleton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (RecoverySnapshotImage) RegisterAdditionalModule(ctx android.RegistrationContext, name string, factory android.ModuleFactory) {
|
||||||
|
ctx.RegisterModuleType(name, factory)
|
||||||
|
}
|
||||||
|
|
||||||
func (RecoverySnapshotImage) shouldGenerateSnapshot(ctx android.SingletonContext) bool {
|
func (RecoverySnapshotImage) shouldGenerateSnapshot(ctx android.SingletonContext) bool {
|
||||||
// RECOVERY_SNAPSHOT_VERSION must be set to 'current' in order to generate a
|
// RECOVERY_SNAPSHOT_VERSION must be set to 'current' in order to generate a
|
||||||
// snapshot.
|
// snapshot.
|
||||||
|
Reference in New Issue
Block a user