Replace javaLibrary with java.Dependency,android.Module
Passes an additional android.Module parameter through to avoid having
to use javaLibrary interface.
Bug: 146586360
Test: m nothing
Merged-In: Ie533c16c753dc9c43171d0223953adea7b2b5ee6
Change-Id: Ie533c16c753dc9c43171d0223953adea7b2b5ee6
(cherry picked from commit 581bbbe8cbdfc3b4b3d6cbee2751d39dacf91edf)
diff --git a/apex/apex.go b/apex/apex.go
index 57fc650..cd86eea 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1692,16 +1692,10 @@
return af
}
-// TODO(b/146586360): replace javaLibrary(in apex/apex.go) with java.Dependency
-type javaLibrary interface {
- android.Module
- java.Dependency
-}
-
-func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
+func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib java.Dependency, module android.Module) apexFile {
dirInApex := "javalib"
fileToCopy := lib.DexJar()
- af := newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
+ af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, javaSharedLib, module)
af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
return af
}
@@ -1972,7 +1966,7 @@
}
case javaLibTag:
if javaLib, ok := child.(*java.Library); ok {
- af := apexFileForJavaLibrary(ctx, javaLib)
+ af := apexFileForJavaLibrary(ctx, javaLib, javaLib)
if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
} else {
@@ -1980,7 +1974,7 @@
return true // track transitive dependencies
}
} else if sdkLib, ok := child.(*java.SdkLibrary); ok {
- af := apexFileForJavaLibrary(ctx, sdkLib)
+ af := apexFileForJavaLibrary(ctx, sdkLib, sdkLib)
if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
return false