Support prepended arch-specific properties

Arch-specific static libraries should be prepended so that the common
static libraries can depend on them.

Bug: 26968262
Change-Id: I40a21d18ece8f6d20824437e7180628b29ffdd04
This commit is contained in:
Colin Cross 2016-05-05 15:57:15 -07:00
parent 3b1fffa33b
commit 6ee75b61cd
2 changed files with 13 additions and 3 deletions

View File

@ -306,10 +306,10 @@ type BaseLinkerProperties struct {
// in their entirety. For static library modules, all of the .o files from the intermediate
// directory of the dependency will be linked into this modules .a file. For a shared library,
// the dependency's .a file will be linked into this module using -Wl,--whole-archive.
Whole_static_libs []string `android:"arch_variant"`
Whole_static_libs []string `android:"arch_variant,variant_prepend"`
// list of modules that should be statically linked into this module.
Static_libs []string `android:"arch_variant"`
Static_libs []string `android:"arch_variant,variant_prepend"`
// list of modules that should be dynamically linked into this module.
Shared_libs []string `android:"arch_variant"`

View File

@ -621,7 +621,17 @@ func (a *AndroidModuleBase) appendProperties(ctx AndroidBottomUpMutatorContext,
return true, nil
}
err := proptools.AppendProperties(dst, src, filter)
order := func(property string,
dstField, srcField reflect.StructField,
dstValue, srcValue interface{}) (proptools.Order, error) {
if proptools.HasTag(dstField, "android", "variant_prepend") {
return proptools.Prepend, nil
} else {
return proptools.Append, nil
}
}
err := proptools.ExtendProperties(dst, src, filter, order)
if err != nil {
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
ctx.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())