Allow non-SDK Java libraries to masquerade as <uses-library>.
Extend usesLibraryProperties with a boolean is_uses_lib property and
move these properties from java.AndroidApp to java.Module to allow
java.Library modules set the new propery and be recognized as
<uses-library> by Soong.
Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I01cd5e0da3dd543c1c0597249d37d0914b213ca7
diff --git a/java/aar.go b/java/aar.go
index 0f5e30d..667dd9d 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -378,6 +378,10 @@
exportPackage = aarDep.ExportPackage()
}
+ if dep, ok := module.(Dependency); ok {
+ sdkLibraries.AddLibraryPaths(dep.ExportedSdkLibs())
+ }
+
switch ctx.OtherModuleDependencyTag(module) {
case instrumentationForTag:
// Nothing, instrumentationForTag is treated as libTag for javac but not for aapt2.
@@ -399,9 +403,6 @@
sharedLibs = append(sharedLibs, exportPackage)
}
case staticLibTag:
- if dep, ok := module.(Dependency); ok {
- sdkLibraries.AddLibraryPaths(dep.ExportedSdkLibs())
- }
if exportPackage != nil {
transitiveStaticLibs = append(transitiveStaticLibs, aarDep.ExportedStaticPackages()...)
transitiveStaticLibs = append(transitiveStaticLibs, exportPackage)