diff options
author | 2021-11-24 15:18:37 +0000 | |
---|---|---|
committer | 2021-11-24 15:18:37 +0000 | |
commit | 8c64fa9a8efafadb787143296750b32a0119f23b (patch) | |
tree | b500eac2dde5e1fafdb784a47320221ea1905542 /android/mutator.go | |
parent | 4ad40d99b08022f532d2eb2e5a4d66b3e3f6c20f (diff) | |
parent | ef3676c94b6cd5d158c86416124eb4ded1645e98 (diff) |
Merge "Minor refactoring of Append/PrependProperties() methods Test: `m nothing` and compare ninja file Bug: n/a"
Diffstat (limited to 'android/mutator.go')
-rw-r--r-- | android/mutator.go | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/android/mutator.go b/android/mutator.go index 4b373778e..461cb17d8 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -529,10 +529,10 @@ func (t *topDownMutatorContext) CreateBazelTargetModule( mod.base().addBp2buildInfo(info) } -func (t *topDownMutatorContext) AppendProperties(props ...interface{}) { +func (t *topDownMutatorContext) appendPrependHelper(props []interface{}, + extendFn func([]interface{}, interface{}, proptools.ExtendPropertyFilterFunc) error) { for _, p := range props { - err := proptools.AppendMatchingProperties(t.Module().base().customizableProperties, - p, nil) + err := extendFn(t.Module().base().customizableProperties, p, nil) if err != nil { if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) @@ -543,18 +543,12 @@ func (t *topDownMutatorContext) AppendProperties(props ...interface{}) { } } +func (t *topDownMutatorContext) AppendProperties(props ...interface{}) { + t.appendPrependHelper(props, proptools.AppendMatchingProperties) +} + func (t *topDownMutatorContext) PrependProperties(props ...interface{}) { - for _, p := range props { - err := proptools.PrependMatchingProperties(t.Module().base().customizableProperties, - p, nil) - if err != nil { - if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { - t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) - } else { - panic(err) - } - } - } + t.appendPrependHelper(props, proptools.PrependMatchingProperties) } // android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that |