From 618922e510a2ed995fad9c60d3d49e0b831d80ac Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 8 Jan 2020 13:35:43 +0900 Subject: jacoco correctly gathers info from APK-in-APEX This change fixes a bug that jacoco-report-classes-all.jar does not include info for APK-in-APEX such as the MediaProvider apk in com.android.mediaprovider APEX. Firstly, LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR is correctly set also for the APKs included in APEXes. Secondly, the Make modules for the embedded APKs are now built with soong_app_prebuilt.mk to correctly import the jacoco file into the Make world. Bug: 147296855 Test: execute the following command in internal master. $ choosecombo cf_x86_phone userdebug $ NINJA_ARGS="-t path out/target/product/vsoc_x86/jacoco-report-classes-all.jar out/target/common/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/jacoco-report-classes.jar" EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m The result shows that there is a path as follows: out/target/product/vsoc_x86/jacoco-report-classes-all.jar out/target/product/vsoc_x86/apex/com.android.mediaprovider/priv-app/MediaProvider/MediaProvider.apk out/target/product/vsoc_x86/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/package.apk out/target/common/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/jacoco-report-classes.jar Change-Id: I52d11534a34eb35219bfafca4453e75a1b701c0e --- java/java.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index a48b5a300..bfdc7fcc0 100644 --- a/java/java.go +++ b/java/java.go @@ -447,6 +447,7 @@ type Dependency interface { ExportedPlugins() (android.Paths, []string) SrcJarArgs() ([]string, android.Paths) BaseModuleName() string + JacocoReportClassesFile() android.Path } type SdkLibraryDependency interface { @@ -1719,6 +1720,10 @@ func (j *Module) Stem() string { return proptools.StringDefault(j.deviceProperties.Stem, j.Name()) } +func (j *Module) JacocoReportClassesFile() android.Path { + return j.jacocoReportClassesFile +} + // // Java libraries (.jar file) // @@ -2295,6 +2300,10 @@ func (j *Import) Stem() string { return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name()) } +func (a *Import) JacocoReportClassesFile() android.Path { + return nil +} + func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) } -- cgit v1.2.3-59-g8ed1b