From 581bbbe8cbdfc3b4b3d6cbee2751d39dacf91edf Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 14 May 2020 20:49:32 +0100 Subject: [PATCH] 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 Change-Id: Ie533c16c753dc9c43171d0223953adea7b2b5ee6 --- apex/androidmk.go | 2 +- apex/apex.go | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/apex/androidmk.go b/apex/androidmk.go index 2c5407c9e..ec3601120 100644 --- a/apex/androidmk.go +++ b/apex/androidmk.go @@ -166,7 +166,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String()) } if fi.class == javaSharedLib { - javaModule := fi.module.(javaLibrary) + javaModule := fi.module.(java.Dependency) // soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise // we will have foo.jar.jar diff --git a/apex/apex.go b/apex/apex.go index 3eae7809b..b521ff3f8 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1693,16 +1693,10 @@ func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) ap 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 } @@ -1970,7 +1964,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } 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 { @@ -1978,7 +1972,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { 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