Let APEX build against preferred java_sdk_library_import

If a java_sdk_library_import has a corresponding java_sdk_library then
make the java_sdk_library_import export both the xml and impl modules
created by the java_sdk_library.

Makes java_sdk_library_import consistent with java_sdk_library by
providing libraries within the same APEX access to the implementation
library instead of the stubs.

Bug: 158304459
Test: m nothing
      Test what happens when building com.android.tethering with and without
      a preferred "framework-tethering" java_sdk_library_import. Make sure that
      it does not change the generated APEX.
Merged-In: I2f4edea937ac377431a5696c92cbd467bded62ef
Change-Id: I2f4edea937ac377431a5696c92cbd467bded62ef
(cherry picked from commit eedc5d55ce)
This commit is contained in:
Paul Duffin
2020-06-12 17:46:39 +01:00
parent a5fa9f6df9
commit f642a31ab5
3 changed files with 248 additions and 38 deletions

View File

@@ -1963,7 +1963,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
case javaLibTag:
switch child.(type) {
case *java.Library, *java.SdkLibrary, *java.DexImport:
case *java.Library, *java.SdkLibrary, *java.DexImport, *java.SdkLibraryImport:
af := apexFileForJavaLibrary(ctx, child.(javaDependency), child.(android.Module))
if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)