apex: do not follow jni_libs from android_app
Because APK-in-APEX embeds its jni_libs in it. We don't have to follow
deps of jni_libs.
Bug: 146992436
Test: m com.android.tethering
deapexer extract com.android.tethering.apex apex
ls apex # there should be no /lib dir
Merged-In: Ifa1a6430a420ae7376b155cd59b8ece462cced7e
Change-Id: Ifa1a6430a420ae7376b155cd59b8ece462cced7e
(cherry picked from commit b7bebe2616
)
This commit is contained in:
@@ -2235,7 +2235,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
return true // track transitive dependencies
|
||||
}
|
||||
} else if java.IsJniDepTag(depTag) {
|
||||
return true
|
||||
// Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
|
||||
return false
|
||||
} else if java.IsXmlPermissionsFileDepTag(depTag) {
|
||||
if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
|
||||
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
|
||||
|
@@ -2889,9 +2889,19 @@ func TestApexWithApps(t *testing.T) {
|
||||
cc_library_shared {
|
||||
name: "libjni",
|
||||
srcs: ["mylib.cpp"],
|
||||
shared_libs: ["libfoo"],
|
||||
stl: "none",
|
||||
system_shared_libs: [],
|
||||
apex_available: [ "myapex" ],
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libfoo",
|
||||
stl: "none",
|
||||
system_shared_libs: [],
|
||||
apex_available: [ "myapex" ],
|
||||
sdk_version: "current",
|
||||
}
|
||||
`)
|
||||
|
||||
@@ -2902,16 +2912,19 @@ func TestApexWithApps(t *testing.T) {
|
||||
ensureContains(t, copyCmds, "image.apex/app/AppFoo/AppFoo.apk")
|
||||
ensureContains(t, copyCmds, "image.apex/priv-app/AppFooPriv/AppFooPriv.apk")
|
||||
|
||||
// JNI libraries are embedded inside APK
|
||||
appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Description("zip jni lib")
|
||||
libjniOutput := ctx.ModuleForTests("libjni", "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module).OutputFile()
|
||||
ensureListContains(t, appZipRule.Implicits.Strings(), libjniOutput.String())
|
||||
// ... uncompressed
|
||||
appZipRule := ctx.ModuleForTests("AppFoo", "android_common_myapex").Description("zip jni libs")
|
||||
// JNI libraries are uncompressed
|
||||
if args := appZipRule.Args["jarArgs"]; !strings.Contains(args, "-L 0") {
|
||||
t.Errorf("jni lib is not uncompressed for AppFoo")
|
||||
t.Errorf("jni libs are not uncompressed for AppFoo")
|
||||
}
|
||||
// JNI libraries including transitive deps are
|
||||
for _, jni := range []string{"libjni", "libfoo"} {
|
||||
jniOutput := ctx.ModuleForTests(jni, "android_arm64_armv8-a_shared_myapex").Module().(*cc.Module).OutputFile()
|
||||
// ... embedded inside APK (jnilibs.zip)
|
||||
ensureListContains(t, appZipRule.Implicits.Strings(), jniOutput.String())
|
||||
// ... and not directly inside the APEX
|
||||
ensureNotContains(t, copyCmds, "image.apex/lib64/"+jni+".so")
|
||||
}
|
||||
// ... and not directly inside the APEX
|
||||
ensureNotContains(t, copyCmds, "image.apex/lib64/libjni.so")
|
||||
}
|
||||
|
||||
func TestApexWithAppImports(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user