Merge "Pass exportedFlags directly to Make"

This commit is contained in:
Dan Willemsen 2017-04-05 05:43:02 +00:00 committed by Gerrit Code Review
commit f3d98fbb59

View file

@ -77,23 +77,18 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
return ret, nil
}
func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
writeExportedIncludes := func(w io.Writer) {
var exportedIncludes []string
for _, flag := range library.exportedFlags() {
if strings.HasPrefix(flag, "-I") {
exportedIncludes = append(exportedIncludes, strings.TrimPrefix(flag, "-I"))
}
}
if len(exportedIncludes) > 0 {
fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DIRS :=", strings.Join(exportedIncludes, " "))
}
exportedIncludeDeps := library.exportedFlagsDeps()
if len(exportedIncludeDeps) > 0 {
fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DEPS :=", strings.Join(exportedIncludeDeps.Strings(), " "))
}
func (library *libraryDecorator) androidMkWriteExportedFlags(w io.Writer) {
exportedFlags := library.exportedFlags()
if len(exportedFlags) > 0 {
fmt.Fprintln(w, "LOCAL_EXPORT_CFLAGS :=", strings.Join(exportedFlags, " "))
}
exportedFlagsDeps := library.exportedFlagsDeps()
if len(exportedFlagsDeps) > 0 {
fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DEPS :=", strings.Join(exportedFlagsDeps.Strings(), " "))
}
}
func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
if library.static() {
ret.Class = "STATIC_LIBRARIES"
} else if library.shared() {
@ -125,7 +120,7 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
}
writeExportedIncludes(w)
library.androidMkWriteExportedFlags(w)
fmt.Fprintln(w, "include $(BUILD_HEADER_LIBRARY)")
return nil
@ -135,7 +130,7 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
}
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
writeExportedIncludes(w)
library.androidMkWriteExportedFlags(w)
fmt.Fprintln(w, "LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)"+outputFile.Ext())