Merge "Replace javaLibrary with java.Dependency,android.Module" am: 198c946c8a

Change-Id: I4b8293fbdf2e6895d277551ebabe01a25f6467f3
This commit is contained in:
Treehugger Robot
2020-05-15 13:29:42 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 11 deletions

View File

@@ -169,7 +169,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String()) fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String())
} }
if fi.class == javaSharedLib { if fi.class == javaSharedLib {
javaModule := fi.module.(javaLibrary) javaModule := fi.module.(java.Dependency)
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore // soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
// we will have foo.jar.jar // we will have foo.jar.jar

View File

@@ -1699,16 +1699,10 @@ func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) ap
return af return af
} }
// TODO(b/146586360): replace javaLibrary(in apex/apex.go) with java.Dependency func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib java.Dependency, module android.Module) apexFile {
type javaLibrary interface {
android.Module
java.Dependency
}
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
dirInApex := "javalib" dirInApex := "javalib"
fileToCopy := lib.DexJar() 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() af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
return af return af
} }
@@ -1976,7 +1970,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
} }
case javaLibTag: case javaLibTag:
if javaLib, ok := child.(*java.Library); ok { if javaLib, ok := child.(*java.Library); ok {
af := apexFileForJavaLibrary(ctx, javaLib) af := apexFileForJavaLibrary(ctx, javaLib, javaLib)
if !af.Ok() { if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName) ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
} else { } else {
@@ -1984,7 +1978,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
return true // track transitive dependencies return true // track transitive dependencies
} }
} else if sdkLib, ok := child.(*java.SdkLibrary); ok { } else if sdkLib, ok := child.(*java.SdkLibrary); ok {
af := apexFileForJavaLibrary(ctx, sdkLib) af := apexFileForJavaLibrary(ctx, sdkLib, sdkLib)
if !af.Ok() { if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName) ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
return false return false