Merge "Support adding a library as both a JNI library and a regular library." into main am: 6378fa9a29
am: 10f159b82f
am: ea3ff9410d
am: f310d79d32
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2740334 Change-Id: Ibfd0c1c3983af6fcb80519dabba46d7eea2714bc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2008,6 +2008,9 @@ func (vctx *visitorContext) normalizeFileInfo(mctx android.ModuleContext) {
|
|||||||
// If a module is directly included and also transitively depended on
|
// If a module is directly included and also transitively depended on
|
||||||
// consider it as directly included.
|
// consider it as directly included.
|
||||||
e.transitiveDep = e.transitiveDep && f.transitiveDep
|
e.transitiveDep = e.transitiveDep && f.transitiveDep
|
||||||
|
// If a module is added as both a JNI library and a regular shared library, consider it as a
|
||||||
|
// JNI library.
|
||||||
|
e.isJniLib = e.isJniLib || f.isJniLib
|
||||||
encountered[dest] = e
|
encountered[dest] = e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7977,7 +7977,8 @@ func TestApexWithJniLibs(t *testing.T) {
|
|||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
jni_libs: ["mylib", "libfoo.rust"],
|
binaries: ["mybin"],
|
||||||
|
jni_libs: ["mylib", "mylib3", "libfoo.rust"],
|
||||||
updatable: false,
|
updatable: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8004,6 +8005,24 @@ func TestApexWithJniLibs(t *testing.T) {
|
|||||||
apex_available: [ "myapex" ],
|
apex_available: [ "myapex" ],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used as both a JNI library and a regular shared library.
|
||||||
|
cc_library {
|
||||||
|
name: "mylib3",
|
||||||
|
srcs: ["mylib.cpp"],
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
apex_available: [ "myapex" ],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_binary {
|
||||||
|
name: "mybin",
|
||||||
|
srcs: ["mybin.cpp"],
|
||||||
|
shared_libs: ["mylib3"],
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
apex_available: [ "myapex" ],
|
||||||
|
}
|
||||||
|
|
||||||
rust_ffi_shared {
|
rust_ffi_shared {
|
||||||
name: "libfoo.rust",
|
name: "libfoo.rust",
|
||||||
crate_name: "foo",
|
crate_name: "foo",
|
||||||
@@ -8027,10 +8046,12 @@ func TestApexWithJniLibs(t *testing.T) {
|
|||||||
|
|
||||||
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
|
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
|
||||||
// Notice mylib2.so (transitive dep) is not added as a jni_lib
|
// Notice mylib2.so (transitive dep) is not added as a jni_lib
|
||||||
ensureEquals(t, rule.Args["opt"], "-a jniLibs libfoo.rust.so mylib.so")
|
ensureEquals(t, rule.Args["opt"], "-a jniLibs libfoo.rust.so mylib.so mylib3.so")
|
||||||
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
|
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
|
||||||
|
"bin/mybin",
|
||||||
"lib64/mylib.so",
|
"lib64/mylib.so",
|
||||||
"lib64/mylib2.so",
|
"lib64/mylib2.so",
|
||||||
|
"lib64/mylib3.so",
|
||||||
"lib64/libfoo.rust.so",
|
"lib64/libfoo.rust.so",
|
||||||
"lib64/libc++.so", // auto-added to libfoo.rust by Soong
|
"lib64/libc++.so", // auto-added to libfoo.rust by Soong
|
||||||
"lib64/liblog.so", // auto-added to libfoo.rust by Soong
|
"lib64/liblog.so", // auto-added to libfoo.rust by Soong
|
||||||
|
Reference in New Issue
Block a user