[Ravenwood] Install transitive JNI libraries too

Ignore-AOSP-First: Will cherry-pick later.
Bug: 318393625
Bug: 323931246

Test: run-ravenwood-tests.sh
Test: (with local change) atest RavenwoodBivalentTest_device RavenwoodMockitoTest_device
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:55c035761c8b7b758d710ed5eeb9192525677057)
Merged-In: Ie0f6bbf1aa6252d415c53cfc19178f0986cc57f1

Change-Id: Ie0f6bbf1aa6252d415c53cfc19178f0986cc57f1
This commit is contained in:
Makoto Onuki
2024-02-10 00:15:21 +00:00
parent 5b636d3144
commit 2ca8427124
3 changed files with 138 additions and 40 deletions

View File

@@ -920,15 +920,39 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
shouldCollectRecursiveNativeDeps bool,
checkNativeSdkVersion bool) ([]jniLib, android.Paths, []Certificate) {
var jniLibs []jniLib
var prebuiltJniPackages android.Paths
var certificates []Certificate
seenModulePaths := make(map[string]bool)
if checkNativeSdkVersion {
checkNativeSdkVersion = app.SdkVersion(ctx).Specified() &&
app.SdkVersion(ctx).Kind != android.SdkCorePlatform && !app.RequiresStableAPIs(ctx)
}
jniLib, prebuiltJniPackages := collectJniDeps(ctx, shouldCollectRecursiveNativeDeps,
checkNativeSdkVersion, func(dep cc.LinkableInterface) bool {
return !dep.IsNdk(ctx.Config()) && !dep.IsStubs()
})
var certificates []Certificate
ctx.VisitDirectDeps(func(module android.Module) {
otherName := ctx.OtherModuleName(module)
tag := ctx.OtherModuleDependencyTag(module)
if tag == certificateTag {
if dep, ok := module.(*AndroidAppCertificate); ok {
certificates = append(certificates, dep.Certificate)
} else {
ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", otherName)
}
}
})
return jniLib, prebuiltJniPackages, certificates
}
func collectJniDeps(ctx android.ModuleContext,
shouldCollectRecursiveNativeDeps bool,
checkNativeSdkVersion bool,
filter func(cc.LinkableInterface) bool) ([]jniLib, android.Paths) {
var jniLibs []jniLib
var prebuiltJniPackages android.Paths
seenModulePaths := make(map[string]bool)
ctx.WalkDeps(func(module android.Module, parent android.Module) bool {
otherName := ctx.OtherModuleName(module)
@@ -936,7 +960,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) {
if dep, ok := module.(cc.LinkableInterface); ok {
if dep.IsNdk(ctx.Config()) || dep.IsStubs() {
if filter != nil && !filter(dep) {
return false
}
@@ -977,18 +1001,10 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
prebuiltJniPackages = append(prebuiltJniPackages, info.JniPackages...)
}
if tag == certificateTag {
if dep, ok := module.(*AndroidAppCertificate); ok {
certificates = append(certificates, dep.Certificate)
} else {
ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", otherName)
}
}
return false
})
return jniLibs, prebuiltJniPackages, certificates
return jniLibs, prebuiltJniPackages
}
func (a *AndroidApp) WalkPayloadDeps(ctx android.ModuleContext, do android.PayloadDepsCallback) {