From 44b85d01c92e676786154c0b2c39b9569fe518ab Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 19 Feb 2021 17:37:04 -0800 Subject: [PATCH] Update soong copy of java binaries when Make copy is installed m is handled by Make and installs the Make copy of a host java binary in out/host/linux-x86/bin, and doesn't depend on the Soong copy in out/soong/host/linux-x86/bin. That can leave a stale binary in the Soong directory, and since the Soong directory is first in the path set up by envsetup.sh, can result in confusing behavior to end users. cc_binary already has the Make binary depend on the Soong binary so that they are both updated. Do the same for java_binary. Fixes: 180405155 Test: m metalava Change-Id: Ic84a131a2851cc4a18ce3725da3c4067137d6120 --- java/androidmk.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/java/androidmk.go b/java/androidmk.go index e7261f894..9bdb70cb9 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -287,9 +287,16 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries { }, }} } else { + outputFile := binary.wrapperFile + // Have Make installation trigger Soong installation by using Soong's install path as + // the output file. + if binary.Host() { + outputFile = binary.binaryFile + } + return []android.AndroidMkEntries{android.AndroidMkEntries{ Class: "EXECUTABLES", - OutputFile: android.OptionalPathForPath(binary.wrapperFile), + OutputFile: android.OptionalPathForPath(outputFile), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetBool("LOCAL_STRIP_MODULE", false)