From 54027b572e49c8d17cc686d241878d70c517b969 Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Wed, 9 Sep 2020 14:08:23 +0100 Subject: [PATCH] Replace `is_uses_lib` property with `provides_uses_lib`. The previous property was boolean-valued and provided only the information whether the library should be treated as by Soong. The new property is an optional string, which is the name of the . The name can be different from the module name, as in the case of "qcrilhook" module which provides "com.qualcomm.qcrilhook". Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: I65b68e6f7c420ab9c443a76de4c917d31fcd8c8f --- java/app.go | 6 ++++-- java/java.go | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/java/app.go b/java/app.go index 406894dca..14437a95c 100755 --- a/java/app.go +++ b/java/app.go @@ -1883,8 +1883,10 @@ type UsesLibraryProperties struct { // to true if either uses_libs or optional_uses_libs is set. Will unconditionally default to true in the future. Enforce_uses_libs *bool - // If the library itself is a uses-library (this is needed for non-SDK libraries). - Is_uses_lib *bool + // Optional name of the provided by this module. This is needed for non-SDK + // libraries, because SDK ones are automatically picked up by Soong. The name + // normally is the same as the module name, but there are exceptions. + Provides_uses_lib *string } // usesLibrary provides properties and helper functions for AndroidApp and AndroidAppImport to verify that the diff --git a/java/java.go b/java/java.go index c568ec43d..1a630c792 100644 --- a/java/java.go +++ b/java/java.go @@ -1979,9 +1979,9 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { // added to the Android manifest. j.exportedSdkLibs.MaybeAddLibraryPath(ctx, j.OptionalImplicitSdkLibrary(), j.DexJarBuildPath(), j.DexJarInstallPath()) - // If this is a non-SDK uses-library, export itself. - if proptools.Bool(j.usesLibraryProperties.Is_uses_lib) { - j.exportedSdkLibs.AddLibraryPath(ctx, ctx.ModuleName(), j.DexJarBuildPath(), j.DexJarInstallPath()) + // A non-SDK library may provide a (the name may be different from the module name). + if lib := proptools.String(j.usesLibraryProperties.Provides_uses_lib); lib != "" { + j.exportedSdkLibs.AddLibraryPath(ctx, lib, j.DexJarBuildPath(), j.DexJarInstallPath()) } j.distFiles = j.GenerateTaggedDistFiles(ctx)