diff options
author | Colin Cross <ccross@android.com> | 2019-03-26 10:51:39 -0700 |
---|---|---|
committer | Jaewoong Jung <jungjw@google.com> | 2019-03-27 15:09:52 +0000 |
commit | 47fa9d3d83fbafd56723907b23e45ed026ea7a10 (patch) | |
tree | 9cbffe576842d90d59d32fd9ed64638215a77826 /java/app.go | |
parent | c7dd408f890cd03f3f0bfdf2df8002fc7497ccf8 (diff) | |
download | android_build_soong-47fa9d3d83fbafd56723907b23e45ed026ea7a10.tar.gz android_build_soong-47fa9d3d83fbafd56723907b23e45ed026ea7a10.tar.bz2 android_build_soong-47fa9d3d83fbafd56723907b23e45ed026ea7a10.zip |
Always package JNI libs into android_test modules
android_test modules should always have native libraries packaged
into the APK even when use_embedded_native_libs: false is set.
Fixes: 129298278
Test: TestJNIPackaging
Change-Id: Idfcc630f7c6579c1280a920b5d71808b0a502e06
Diffstat (limited to 'java/app.go')
-rw-r--r-- | java/app.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/java/app.go b/java/app.go index 96594df3..ab623e24 100644 --- a/java/app.go +++ b/java/app.go @@ -74,6 +74,11 @@ type appProperties struct { // Store dex files uncompressed in the APK and set the android:useEmbeddedDex="true" manifest attribute so that // they are used from inside the APK at runtime. Use_embedded_dex *bool + + // Forces native libraries to always be packaged into the APK, + // Use_embedded_native_libs still selects whether they are stored uncompressed and aligned or compressed. + // True for android_test* modules. + AlwaysPackageNativeLibs bool `blueprint:"mutated"` } // android_app properties that can be overridden by override_android_app @@ -285,7 +290,8 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path { func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext) android.WritablePath { var jniJarFile android.WritablePath if len(jniLibs) > 0 { - embedJni := ctx.Config().UnbundledBuild() || Bool(a.appProperties.Use_embedded_native_libs) + embedJni := ctx.Config().UnbundledBuild() || Bool(a.appProperties.Use_embedded_native_libs) || + a.appProperties.AlwaysPackageNativeLibs if embedJni { jniJarFile = android.PathForModuleOut(ctx, "jnilibs.zip") TransformJniLibsToJar(ctx, jniJarFile, jniLibs, a.shouldUncompressJNI(ctx)) @@ -507,6 +513,7 @@ func AndroidTestFactory() android.Module { module.Module.properties.Instrument = true module.Module.properties.Installable = proptools.BoolPtr(true) module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true) + module.appProperties.AlwaysPackageNativeLibs = true module.Module.dexpreopter.isTest = true module.AddProperties( @@ -547,6 +554,7 @@ func AndroidTestHelperAppFactory() android.Module { module.Module.properties.Installable = proptools.BoolPtr(true) module.appProperties.Use_embedded_native_libs = proptools.BoolPtr(true) + module.appProperties.AlwaysPackageNativeLibs = true module.Module.dexpreopter.isTest = true module.AddProperties( |