apex: track transitive dependencies of rust jni lib
dependencies of rust library registered as jni_lib are correctly tracked. Bug: 220397949 Test: m nothing Change-Id: I43016a77656d04f59f798b02d541c6a19288ec9c
This commit is contained in:
parent
72518f45e9
commit
34d5c33529
2 changed files with 32 additions and 2 deletions
|
@ -1745,6 +1745,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
fi := apexFileForRustLibrary(ctx, r)
|
||||
fi.isJniLib = isJniLib
|
||||
filesInfo = append(filesInfo, fi)
|
||||
return true // track transitive dependencies
|
||||
} else {
|
||||
propertyName := "native_shared_libs"
|
||||
if isJniLib {
|
||||
|
|
|
@ -971,6 +971,9 @@ func TestApexWithStubs(t *testing.T) {
|
|||
rustDeps := ctx.ModuleForTests("foo.rust", "android_arm64_armv8-a_apex10000").Rule("rustc").Args["linkFlags"]
|
||||
ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
|
||||
ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")
|
||||
|
||||
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
|
||||
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
|
||||
}
|
||||
|
||||
func TestApexCanUsePrivateApis(t *testing.T) {
|
||||
|
@ -6830,7 +6833,7 @@ func TestApexWithJniLibs(t *testing.T) {
|
|||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
jni_libs: ["mylib"],
|
||||
jni_libs: ["mylib", "libfoo.rust"],
|
||||
updatable: false,
|
||||
}
|
||||
|
||||
|
@ -6856,15 +6859,41 @@ func TestApexWithJniLibs(t *testing.T) {
|
|||
stl: "none",
|
||||
apex_available: [ "myapex" ],
|
||||
}
|
||||
|
||||
rust_ffi_shared {
|
||||
name: "libfoo.rust",
|
||||
crate_name: "foo",
|
||||
srcs: ["foo.rs"],
|
||||
shared_libs: ["libfoo.shared_from_rust"],
|
||||
prefer_rlib: true,
|
||||
apex_available: ["myapex"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libfoo.shared_from_rust",
|
||||
srcs: ["mylib.cpp"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
stubs: {
|
||||
versions: ["10", "11", "12"],
|
||||
},
|
||||
}
|
||||
|
||||
`)
|
||||
|
||||
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
|
||||
// Notice mylib2.so (transitive dep) is not added as a jni_lib
|
||||
ensureEquals(t, rule.Args["opt"], "-a jniLibs mylib.so")
|
||||
ensureEquals(t, rule.Args["opt"], "-a jniLibs libfoo.rust.so mylib.so")
|
||||
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
|
||||
"lib64/mylib.so",
|
||||
"lib64/mylib2.so",
|
||||
"lib64/libfoo.rust.so",
|
||||
"lib64/libc++.so", // auto-added to libfoo.rust by Soong
|
||||
"lib64/liblog.so", // auto-added to libfoo.rust by Soong
|
||||
})
|
||||
|
||||
// b/220397949
|
||||
ensureListContains(t, names(rule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
|
||||
}
|
||||
|
||||
func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue