Use += for both assignments to LOCAL_C_INCLUDES

include_dirs and local_include_dirs properties both translate to
LOCAL_C_INCLUDES.  Use += for both assignments so they don't
clobber eachother.

Change-Id: Ie9e5e28ecd5a7ca76ab2a981e7d50d2c9b93ad92
This commit is contained in:
Colin Cross 2015-06-30 12:19:47 -07:00
parent b3245e9cf6
commit c41f63071e
2 changed files with 15 additions and 2 deletions

View file

@ -218,6 +218,19 @@ func translateSuffixProperties(suffixProps []*bpparser.Property,
return return
} }
func appendAssign(name string, prop *bpparser.Property, suffix *string) ([]string, error) {
if suffix != nil {
name += "_" + *suffix
}
val, err := valueToString(prop.Value)
if err != nil {
return nil, err
}
return []string{
fmt.Sprintf("%s += %s", name, val),
}, nil
}
func prependLocalPath(name string, prop *bpparser.Property, suffix *string) ([]string, error) { func prependLocalPath(name string, prop *bpparser.Property, suffix *string) ([]string, error) {
if suffix != nil { if suffix != nil {
name += "_" + *suffix name += "_" + *suffix
@ -227,7 +240,7 @@ func prependLocalPath(name string, prop *bpparser.Property, suffix *string) ([]s
return nil, err return nil, err
} }
return []string{ return []string{
fmt.Sprintf("%s := $(addprefix $(LOCAL_PATH)/,%s)\n", name, val), fmt.Sprintf("%s += $(addprefix $(LOCAL_PATH)/,%s)", name, val),
}, nil }, nil
} }

View file

@ -27,7 +27,6 @@ var standardProperties = map[string]struct {
"static_libs": {"LOCAL_STATIC_LIBRARIES", bpparser.List}, "static_libs": {"LOCAL_STATIC_LIBRARIES", bpparser.List},
"whole_static_libs": {"LOCAL_WHOLE_STATIC_LIBRARIES", bpparser.List}, "whole_static_libs": {"LOCAL_WHOLE_STATIC_LIBRARIES", bpparser.List},
"system_shared_libs": {"LOCAL_SYSTEM_SHARED_LIBRARIES", bpparser.List}, "system_shared_libs": {"LOCAL_SYSTEM_SHARED_LIBRARIES", bpparser.List},
"include_dirs": {"LOCAL_C_INCLUDES", bpparser.List},
"asflags": {"LOCAL_ASFLAGS", bpparser.List}, "asflags": {"LOCAL_ASFLAGS", bpparser.List},
"clang_asflags": {"LOCAL_CLANG_ASFLAGS", bpparser.List}, "clang_asflags": {"LOCAL_CLANG_ASFLAGS", bpparser.List},
"cflags": {"LOCAL_CFLAGS", bpparser.List}, "cflags": {"LOCAL_CFLAGS", bpparser.List},
@ -66,6 +65,7 @@ var rewriteProperties = map[string]struct {
string string
f func(name string, prop *bpparser.Property, suffix *string) ([]string, error) f func(name string, prop *bpparser.Property, suffix *string) ([]string, error)
}{ }{
"include_dirs": {"LOCAL_C_INCLUDES", appendAssign},
"local_include_dirs": {"LOCAL_C_INCLUDES", prependLocalPath}, "local_include_dirs": {"LOCAL_C_INCLUDES", prependLocalPath},
"export_include_dirs": {"LOCAL_EXPORT_C_INCLUDE_DIRS", prependLocalPath}, "export_include_dirs": {"LOCAL_EXPORT_C_INCLUDE_DIRS", prependLocalPath},
"suffix": {"LOCAL_MODULE_STEM", prependLocalModule}, "suffix": {"LOCAL_MODULE_STEM", prependLocalModule},