summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2020-10-09 19:00:54 -0700
committerColin Cross <ccross@android.com>2020-10-09 19:27:34 -0700
commit89226d9ef94040215ff9d97212d997a656f5d508 (patch)
tree45485d3cf844e392b552c9e1f249671557eda296 /java/java.go
parentc179ea68129972f6c5789c5fc8344d06caebcc8b (diff)
Add jni_libs to host java binaries
Add a property to support dependencies on JNI libraries for host java binaries. Fixes: 170389375 Test: TestBinary Change-Id: Ieeca3c3997615f0b17ae1f058b94e6c9ba929cab
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/java/java.go b/java/java.go
index 615cbadfb..3ce188586 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2432,6 +2432,10 @@ type binaryProperties struct {
// Name of the class containing main to be inserted into the manifest as Main-Class.
Main_class *string
+
+ // Names of modules containing JNI libraries that should be installed alongside the host
+ // variant of the binary.
+ Jni_libs []string
}
type Binary struct {
@@ -2473,8 +2477,8 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
// 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.
+ // of the wrapper variant, which will include the common variant's jar file and any JNI
+ // libraries. This is verified by TestBinary.
j.binaryFile = ctx.InstallExecutable(android.PathForModuleInstall(ctx, "bin"),
ctx.ModuleName(), j.wrapperFile)
}
@@ -2483,6 +2487,10 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
if ctx.Arch().ArchType == android.Common {
j.deps(ctx)
+ } else {
+ // This dependency ensures the host installation rules will install the jni libraries
+ // when the wrapper is installed.
+ ctx.AddVariationDependencies(nil, jniLibTag, j.binaryProperties.Jni_libs...)
}
}