Add PropertyCustomizer
Allow any module factory to insert a PropertyCustomizer on the module,
which will be called before any other mutators. The PropertyCustomizer
can append or prepend to any properties, allowing module types to extend
other module types by modifying the public, stable interface provided by
the properties.
Change-Id: Idff02be80d939a70df1c6bbccffdd1f04ff975d2
diff --git a/android/module.go b/android/module.go
index 03c06b4..fd37ca8 100644
--- a/android/module.go
+++ b/android/module.go
@@ -25,6 +25,14 @@
"github.com/google/blueprint"
)
+func init() {
+ RegisterTopDownMutator("customizer", customizerMutator).Parallel()
+ RegisterBottomUpMutator("defaults_deps", defaultsDepsMutator).Parallel()
+ RegisterTopDownMutator("defaults", defaultsMutator).Parallel()
+
+ RegisterBottomUpMutator("arch", ArchMutator).Parallel()
+}
+
var (
DeviceSharedLibrary = "shared_library"
DeviceStaticLibrary = "static_library"
@@ -188,6 +196,11 @@
return InitArchModule(m, propertyStructs...)
}
+func AddCustomizer(m blueprint.Module, c PropertyCustomizer) {
+ base := m.(Module).base()
+ base.customizers = append(base.customizers, c)
+}
+
// A AndroidModuleBase object contains the properties that are common to all Android
// modules. It should be included as an anonymous field in every module
// struct definition. InitAndroidModule should then be called from the module's
@@ -238,6 +251,7 @@
hostAndDeviceProperties hostAndDeviceProperties
generalProperties []interface{}
archProperties []*archProperties
+ customizableProperties []interface{}
noAddressSanitizer bool
installFiles Paths
@@ -248,6 +262,8 @@
installTarget string
checkbuildTarget string
blueprintDir string
+
+ customizers []PropertyCustomizer
}
func (a *ModuleBase) base() *ModuleBase {