From db41747c8b30cdd4efb508586976b9c94e16fca1 Mon Sep 17 00:00:00 2001 From: dimitry Date: Mon, 20 May 2019 16:16:47 +0200 Subject: [PATCH] Fix override for native_bridge modules Native_bridge modules should override only native_bridge modules and not regular ones. Bug: http://b/77159578 Test: make 4-arch product Change-Id: I79d96736082397abeb36d653840679a7aa0edbf5 --- cc/androidmk.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cc/androidmk.go b/cc/androidmk.go index a02549d77..ae34e3d1e 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -139,6 +139,18 @@ func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, ret *andro } } +func makeOverrideModuleNames(ctx AndroidMkContext, overrides []string) []string { + if ctx.Target().NativeBridge == android.NativeBridgeEnabled { + var result []string + for _, override := range overrides { + result = append(result, override+nativeBridgeSuffix) + } + return result + } + + return overrides +} + func (library *libraryDecorator) androidMkWriteExportedFlags(w io.Writer) { exportedFlags := library.exportedFlags() if len(exportedFlags) > 0 { @@ -171,7 +183,7 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", library.unstrippedOutputFile.String()) } if len(library.Properties.Overrides) > 0 { - fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES := "+strings.Join(library.Properties.Overrides, " ")) + fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES := "+strings.Join(makeOverrideModuleNames(ctx, library.Properties.Overrides), " ")) } if len(library.post_install_cmds) > 0 { fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD := "+strings.Join(library.post_install_cmds, "&& ")) @@ -246,7 +258,7 @@ func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Andr } if len(binary.Properties.Overrides) > 0 { - fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES := "+strings.Join(binary.Properties.Overrides, " ")) + fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES := "+strings.Join(makeOverrideModuleNames(ctx, binary.Properties.Overrides), " ")) } if len(binary.post_install_cmds) > 0 { fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD := "+strings.Join(binary.post_install_cmds, "&& "))