From e4432874a9bc69b4f54a0cab1e7df8f1d57432d0 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Wed, 18 Aug 2021 16:57:11 +0100 Subject: Propagate dependencies from `java_library` to apps. Automatically add `uses_libs`/`optional_uses_libs` properties specified in `java_library` modules to the apps that transitively depend on these libraries. Note that a library may choose to specify its deps as either optional or required. If this is not the right choice for an app, it should be able to override it by specifying its own `uses_libs`/ `optional_uses_libs` properties. Add Soong tests to cover the new cases. Bug: 196377222 Test: lunch aosp_cf_x86_64_phone-userdebug && m Change-Id: I601f3e2830ed9699b78d911966ee70812d32b4f6 --- java/java.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index 5bf3d79fb..b46324f9f 100644 --- a/java/java.go +++ b/java/java.go @@ -511,7 +511,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.dexProperties.Uncompress_dex = proptools.BoolPtr(shouldUncompressDex(ctx, &j.dexpreopter)) } j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex - j.classLoaderContexts = make(dexpreopt.ClassLoaderContextMap) + j.classLoaderContexts = j.usesLibrary.classLoaderContextForUsesLibDeps(ctx) j.compile(ctx, nil) // Collect the module directory for IDE info in java/jdeps.go. @@ -530,6 +530,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) { j.deps(ctx) + j.usesLibrary.deps(ctx, false) } const ( -- cgit v1.2.3-59-g8ed1b