summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-11-06 17:19:34 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-11-06 17:19:34 +0000
commit3f92ee1d89a1865d19f1369b27a6631b8940ef48 (patch)
tree534843df6592b93144e59deca4b5d3c135e25633 /java/java.go
parent75f66efa35f1531f8d3b675a7e8f3d5c7afd8dc9 (diff)
parentb614cd441b355e48e59d1f5cd61a800103404151 (diff)
Merge "Verify that libraries in apexes don't link to implementations outside the apex" into main
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go
index 53b3481d0..86f7845bc 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1610,6 +1610,8 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
j.data = append(j.data, android.OutputFileForModule(ctx, dep, ""))
})
+ var directImplementationDeps android.Paths
+ var transitiveImplementationDeps []depset.DepSet[android.Path]
ctx.VisitDirectDepsWithTag(jniLibTag, func(dep android.Module) {
sharedLibInfo, _ := android.OtherModuleProvider(ctx, dep, cc.SharedLibraryInfoProvider)
if sharedLibInfo.SharedLibrary != nil {
@@ -1628,11 +1630,20 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
Output: relocatedLib,
})
j.data = append(j.data, relocatedLib)
+
+ directImplementationDeps = append(directImplementationDeps, android.OutputFileForModule(ctx, dep, ""))
+ if info, ok := android.OtherModuleProvider(ctx, dep, cc.ImplementationDepInfoProvider); ok {
+ transitiveImplementationDeps = append(transitiveImplementationDeps, info.ImplementationDeps)
+ }
} else {
ctx.PropertyErrorf("jni_libs", "%q of type %q is not supported", dep.Name(), ctx.OtherModuleType(dep))
}
})
+ android.SetProvider(ctx, cc.ImplementationDepInfoProvider, &cc.ImplementationDepInfo{
+ ImplementationDeps: depset.New(depset.PREORDER, directImplementationDeps, transitiveImplementationDeps),
+ })
+
j.Library.GenerateAndroidBuildActions(ctx)
}