summaryrefslogtreecommitdiff
path: root/java/aar.go
diff options
context:
space:
mode:
author Ulyana Trafimovich <skvadrik@google.com> 2020-12-07 10:01:40 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-12-07 10:01:40 +0000
commit678ddb9d24065b459a84d47b2aa5936a9aad0a7c (patch)
treef224df1ae40e6d2b912c979114566b50d940b891 /java/aar.go
parent47132c49431ce6eb0a57a8850f2fe90d93fd062d (diff)
parent65b031910bc36bd079759d002ab7b3d66668f132 (diff)
Merge changes I697a65e4,Iaac6aaf6
* changes: Do not propagate <uses-library> deps through static SDK component libs. Make error message more precise.
Diffstat (limited to 'java/aar.go')
-rw-r--r--java/aar.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/java/aar.go b/java/aar.go
index 1940d7f7b..3b6b34e27 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -407,6 +407,7 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
ctx.VisitDirectDeps(func(module android.Module) {
depName := ctx.OtherModuleName(module)
+ depTag := ctx.OtherModuleDependencyTag(module)
var exportPackage android.Path
aarDep, _ := module.(AndroidLibraryDependency)
@@ -414,7 +415,7 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
exportPackage = aarDep.ExportPackage()
}
- switch ctx.OtherModuleDependencyTag(module) {
+ switch depTag {
case instrumentationForTag:
// Nothing, instrumentationForTag is treated as libTag for javac but not for aapt2.
case libTag:
@@ -439,7 +440,6 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
transitiveStaticLibs = append(transitiveStaticLibs, aarDep.ExportedStaticPackages()...)
transitiveStaticLibs = append(transitiveStaticLibs, exportPackage)
transitiveStaticLibManifests = append(transitiveStaticLibManifests, aarDep.ExportedManifests()...)
- classLoaderContexts.AddContextMap(aarDep.ClassLoaderContexts(), depName)
if aarDep.ExportedAssets().Valid() {
assets = append(assets, aarDep.ExportedAssets().Path())
}
@@ -458,11 +458,8 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
}
}
- // Add nested dependencies after processing the direct dependency: if it is a <uses-library>,
- // nested context is added as its subcontext, and should not be re-added at the top-level.
- if dep, ok := module.(Dependency); ok {
- classLoaderContexts.AddContextMap(dep.ClassLoaderContexts(), depName)
- }
+ // Merge dep's CLC after processing the dep itself (which may add its own <uses-library>).
+ maybeAddCLCFromDep(module, depTag, depName, classLoaderContexts)
})
deps = append(deps, sharedLibs...)