From c41f63071ebdb34fea48c11bc94b6e4a7e159c06 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 30 Jun 2015 12:19:47 -0700 Subject: [PATCH] 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 --- androidbp/cmd/androidbp.go | 15 ++++++++++++++- androidbp/cmd/soong.go | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/androidbp/cmd/androidbp.go b/androidbp/cmd/androidbp.go index a5cf91ae4..ef7a364eb 100644 --- a/androidbp/cmd/androidbp.go +++ b/androidbp/cmd/androidbp.go @@ -218,6 +218,19 @@ func translateSuffixProperties(suffixProps []*bpparser.Property, 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) { if suffix != nil { name += "_" + *suffix @@ -227,7 +240,7 @@ func prependLocalPath(name string, prop *bpparser.Property, suffix *string) ([]s return nil, err } return []string{ - fmt.Sprintf("%s := $(addprefix $(LOCAL_PATH)/,%s)\n", name, val), + fmt.Sprintf("%s += $(addprefix $(LOCAL_PATH)/,%s)", name, val), }, nil } diff --git a/androidbp/cmd/soong.go b/androidbp/cmd/soong.go index ff026a449..ecae5b0e9 100644 --- a/androidbp/cmd/soong.go +++ b/androidbp/cmd/soong.go @@ -27,7 +27,6 @@ var standardProperties = map[string]struct { "static_libs": {"LOCAL_STATIC_LIBRARIES", bpparser.List}, "whole_static_libs": {"LOCAL_WHOLE_STATIC_LIBRARIES", bpparser.List}, "system_shared_libs": {"LOCAL_SYSTEM_SHARED_LIBRARIES", bpparser.List}, - "include_dirs": {"LOCAL_C_INCLUDES", bpparser.List}, "asflags": {"LOCAL_ASFLAGS", bpparser.List}, "clang_asflags": {"LOCAL_CLANG_ASFLAGS", bpparser.List}, "cflags": {"LOCAL_CFLAGS", bpparser.List}, @@ -66,6 +65,7 @@ var rewriteProperties = map[string]struct { string f func(name string, prop *bpparser.Property, suffix *string) ([]string, error) }{ + "include_dirs": {"LOCAL_C_INCLUDES", appendAssign}, "local_include_dirs": {"LOCAL_C_INCLUDES", prependLocalPath}, "export_include_dirs": {"LOCAL_EXPORT_C_INCLUDE_DIRS", prependLocalPath}, "suffix": {"LOCAL_MODULE_STEM", prependLocalModule},