summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorUlyana Trafimovich <skvadrik@google.com>2020-10-07 09:18:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-10-07 09:18:02 +0000
commit9f701fa348964b6863a83589957cc32e7f99657e (patch)
treecc4e64e02dc680c65e6c9597ddcc24eb297753bb /java/java.go
parent3c72ce8696d83466d7ef815a5cdd18df4fd1a59a (diff)
parenta54d33be7712a357914ea6b6d19327c2355f9c8a (diff)
Merge changes from topic "uses-libs-24"
* changes: Fail the build if dexpreopt cannot find path to a <uses-library>. Add dependency on implementation <uses-library> for modules that depend on component libraries.
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go
index 1d7eaa771..1200e2731 100644
--- a/java/java.go
+++ b/java/java.go
@@ -735,9 +735,21 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
return ret
}
- ctx.AddVariationDependencies(nil, libTag, rewriteSyspropLibs(j.properties.Libs, "libs")...)
+ libDeps := ctx.AddVariationDependencies(nil, libTag, rewriteSyspropLibs(j.properties.Libs, "libs")...)
ctx.AddVariationDependencies(nil, staticLibTag, rewriteSyspropLibs(j.properties.Static_libs, "static_libs")...)
+ // For library dependencies that are component libraries (like stubs), add the implementation
+ // as a dependency (dexpreopt needs to be against the implementation library, not stubs).
+ for _, dep := range libDeps {
+ if dep != nil {
+ if component, ok := dep.(SdkLibraryComponentDependency); ok {
+ if lib := component.OptionalSdkLibraryImplementation(); lib != nil {
+ ctx.AddVariationDependencies(nil, usesLibTag, *lib)
+ }
+ }
+ }
+ }
+
ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), pluginTag, j.properties.Plugins...)
ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), exportedPluginTag, j.properties.Exported_plugins...)