Add defaults modules for avb modules

Bug: 302465542
Test: build
Change-Id: I5bb5a0241d40cf142ed8bbefb76bc8a3709c3e34
This commit is contained in:
Inseob Kim 2023-11-22 18:55:07 +09:00
parent 4ce715f591
commit 87230e613d
3 changed files with 39 additions and 0 deletions

View file

@ -25,6 +25,7 @@ import (
type avbAddHashFooter struct {
android.ModuleBase
android.DefaultableModuleBase
properties avbAddHashFooterProperties
@ -80,6 +81,7 @@ func avbAddHashFooterFactory() android.Module {
module := &avbAddHashFooter{}
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module
}
@ -206,3 +208,19 @@ var _ android.SourceFileProducer = (*avbAddHashFooter)(nil)
func (a *avbAddHashFooter) Srcs() android.Paths {
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 {
android.ModuleBase
android.DefaultableModuleBase
properties avbGenVbmetaImageProperties
@ -47,6 +48,7 @@ func avbGenVbmetaImageFactory() android.Module {
module := &avbGenVbmetaImage{}
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(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)
}
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_system_image", systemImageFactory)
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_defaults", avbGenVbmetaImageDefaultsFactory)
}
type filesystem struct {