Merge "Add defaults modules for avb modules" into main

This commit is contained in:
Treehugger Robot 2023-11-28 01:36:35 +00:00 committed by Gerrit Code Review
commit 0edba2a37e
3 changed files with 39 additions and 0 deletions

View file

@ -25,6 +25,7 @@ import (
type avbAddHashFooter struct { type avbAddHashFooter struct {
android.ModuleBase android.ModuleBase
android.DefaultableModuleBase
properties avbAddHashFooterProperties properties avbAddHashFooterProperties
@ -80,6 +81,7 @@ func avbAddHashFooterFactory() android.Module {
module := &avbAddHashFooter{} module := &avbAddHashFooter{}
module.AddProperties(&module.properties) module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module return module
} }
@ -206,3 +208,19 @@ var _ android.SourceFileProducer = (*avbAddHashFooter)(nil)
func (a *avbAddHashFooter) Srcs() android.Paths { func (a *avbAddHashFooter) Srcs() android.Paths {
return append(android.Paths{}, a.output) return append(android.Paths{}, a.output)
} }
type avbAddHashFooterDefaults struct {
android.ModuleBase
android.DefaultsModuleBase
}
// avb_add_hash_footer_defaults provides a set of properties that can be inherited by other
// avb_add_hash_footer modules. A module can use the properties from an avb_add_hash_footer_defaults
// using `defaults: ["<:default_module_name>"]`. Properties of both modules are erged (when
// possible) by prepending the default module's values to the depending module's values.
func avbAddHashFooterDefaultsFactory() android.Module {
module := &avbAddHashFooterDefaults{}
module.AddProperties(&avbAddHashFooterProperties{})
android.InitDefaultsModule(module)
return module
}

View file

@ -24,6 +24,7 @@ import (
type avbGenVbmetaImage struct { type avbGenVbmetaImage struct {
android.ModuleBase android.ModuleBase
android.DefaultableModuleBase
properties avbGenVbmetaImageProperties properties avbGenVbmetaImageProperties
@ -47,6 +48,7 @@ func avbGenVbmetaImageFactory() android.Module {
module := &avbGenVbmetaImage{} module := &avbGenVbmetaImage{}
module.AddProperties(&module.properties) module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module return module
} }
@ -106,3 +108,20 @@ func (a *avbGenVbmetaImage) OutputFiles(tag string) (android.Paths, error) {
} }
return nil, fmt.Errorf("unsupported module reference tag %q", tag) return nil, fmt.Errorf("unsupported module reference tag %q", tag)
} }
type avbGenVbmetaImageDefaults struct {
android.ModuleBase
android.DefaultsModuleBase
}
// avb_gen_vbmeta_image_defaults provides a set of properties that can be inherited by other
// avb_gen_vbmeta_image modules. A module can use the properties from an
// avb_gen_vbmeta_image_defaults using `defaults: ["<:default_module_name>"]`. Properties of both
// modules are erged (when possible) by prepending the default module's values to the depending
// module's values.
func avbGenVbmetaImageDefaultsFactory() android.Module {
module := &avbGenVbmetaImageDefaults{}
module.AddProperties(&avbGenVbmetaImageProperties{})
android.InitDefaultsModule(module)
return module
}

View file

@ -36,7 +36,9 @@ func registerBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("android_filesystem", filesystemFactory) ctx.RegisterModuleType("android_filesystem", filesystemFactory)
ctx.RegisterModuleType("android_system_image", systemImageFactory) ctx.RegisterModuleType("android_system_image", systemImageFactory)
ctx.RegisterModuleType("avb_add_hash_footer", avbAddHashFooterFactory) ctx.RegisterModuleType("avb_add_hash_footer", avbAddHashFooterFactory)
ctx.RegisterModuleType("avb_add_hash_footer_defaults", avbAddHashFooterDefaultsFactory)
ctx.RegisterModuleType("avb_gen_vbmeta_image", avbGenVbmetaImageFactory) ctx.RegisterModuleType("avb_gen_vbmeta_image", avbGenVbmetaImageFactory)
ctx.RegisterModuleType("avb_gen_vbmeta_image_defaults", avbGenVbmetaImageDefaultsFactory)
} }
type filesystem struct { type filesystem struct {