From c179ea68129972f6c5789c5fc8344d06caebcc8b Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 9 Oct 2020 10:54:15 -0700 Subject: Make java_binary common variant a dependency ctx.PrimaryModule() is wrong in the case of a java_binary that supports both host and device, use an explicit dependency instead. Once the dependency exists there is no need to manually request the jar be installed, it will automatically be installed by the host installation rules for dependencies. Test: TestBinary Change-Id: Iddeea2d08bc574c79d42139020558cd70d718ca1 --- java/java.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index b06e604a9..615cbadfb 100644 --- a/java/java.go +++ b/java/java.go @@ -2472,12 +2472,11 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh") } - // Depend on the installed jar so that the wrapper doesn't get executed by - // another build rule before the jar has been installed. - jarFile := ctx.PrimaryModule().(*Binary).installFile - + // The host installation rules make the installed wrapper depend on all the dependencies + // of the wrapper variant, which will include the common variant's jar file. This is + // verified by TestBinary. j.binaryFile = ctx.InstallExecutable(android.PathForModuleInstall(ctx, "bin"), - ctx.ModuleName(), j.wrapperFile, jarFile) + ctx.ModuleName(), j.wrapperFile) } } -- cgit v1.2.3-59-g8ed1b