From 3dac486013cf4256f7ce1bc15e0aa43bbb2524fe Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Mon, 19 Aug 2024 16:56:11 -0700 Subject: [PATCH] Only add deps on java_binary's jni_libs on host The jni_libs property of java_binary is documented to only install the jni libraries on host. However, it was adding installable deptag deps on those libraries, even if they were for device. This caused soong to emit installation rules for the jni libraries, causing them to be installed to the staging directory, but not emitting proper information to make, so they wouldn't be included on the built partitions. Only install them if the module is built for host, so that they don't erroneously appear in the staging directory. Bug: 344695913 Test: Presubmits Change-Id: Ic40b4fc6d7dbd51c03b08e28037be5428db49c33 --- java/java.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/java.go b/java/java.go index 258ebba0c..46344c842 100644 --- a/java/java.go +++ b/java/java.go @@ -1864,10 +1864,12 @@ func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) { if ctx.Arch().ArchType == android.Common { j.deps(ctx) } - if ctx.Arch().ArchType != android.Common { - // These dependencies ensure the host installation rules will install the jar file and - // the jni libraries when the wrapper is installed. + // These dependencies ensure the installation rules will install the jar file when the + // wrapper is installed, and the jni libraries on host when the wrapper is installed. + if ctx.Arch().ArchType != android.Common && ctx.Os().Class == android.Host { ctx.AddVariationDependencies(nil, jniInstallTag, j.binaryProperties.Jni_libs...) + } + if ctx.Arch().ArchType != android.Common { ctx.AddVariationDependencies( []blueprint.Variation{{Mutator: "arch", Variation: android.CommonArch.String()}}, binaryInstallTag, ctx.ModuleName())