From 85fa344d09ef79a1449a524ecd605ea2333e7cad Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 17 Jun 2021 20:31:40 +0100 Subject: [PATCH] Copy implementation and header jars to make when possible Fixes test issues caused by a jar containing a classes.dex file was copied to a place that was expected a jar containing class files. Bug: 191360201 Test: - in master-art find out/ -name \*core-icu4j\* | xargs rm -fr art/tools/buildbot-build.sh --target --installclean art/tools/bootjars.sh --path --core - examine file output from previous script for core-icu4j, before this change it contained classes.dex file after this change it contained *.class files. Change-Id: I05ecf652535ec097125fb76d6ca80fee6587f98d --- apex/prebuilt.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apex/prebuilt.go b/apex/prebuilt.go index 67ee500c2..1283d2302 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -231,8 +231,17 @@ func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries { // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise // we will have foo.jar.jar entries.SetString("LOCAL_MODULE_STEM", strings.TrimSuffix(fi.stem(), ".jar")) - entries.SetString("LOCAL_SOONG_CLASSES_JAR", fi.builtFile.String()) - entries.SetString("LOCAL_SOONG_HEADER_JAR", fi.builtFile.String()) + var classesJar android.Path + var headerJar android.Path + if javaModule, ok := fi.module.(java.ApexDependency); ok { + classesJar = javaModule.ImplementationAndResourcesJars()[0] + headerJar = javaModule.HeaderJars()[0] + } else { + classesJar = fi.builtFile + headerJar = fi.builtFile + } + entries.SetString("LOCAL_SOONG_CLASSES_JAR", classesJar.String()) + entries.SetString("LOCAL_SOONG_HEADER_JAR", headerJar.String()) entries.SetString("LOCAL_SOONG_DEX_JAR", fi.builtFile.String()) entries.SetString("LOCAL_DEX_PREOPT", "false") },