From 1e3f78f866504a99ecf30fd7dc81d2d374c544cf Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Wed, 7 Sep 2022 12:07:07 -0400 Subject: add jacocoagent by default to Java modules On coverage builds, R8 will fail to properly optimize and fail the build if ignore_warnings: false, because jacoco injects dependencies on jacocoagent classes, but the jacocoagent library is not part of the classpath libraries passed in to R8 in its arguments. Instead we can add jacocoagent as a libs dependency for these modules so that it will get pulled into the r8 flags. Bug: 243903417 Test: m Change-Id: Icc24cc260b896fc800125a0318308d823ccf7a83 --- java/bootclasspath_fragment_test.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'java/bootclasspath_fragment_test.go') diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index 2bfb255af..c63df599a 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -96,23 +96,6 @@ func TestBootclasspathFragmentInconsistentArtConfiguration_ApexMixture(t *testin } func TestBootclasspathFragment_Coverage(t *testing.T) { - prepareForTestWithFrameworkCoverage := android.GroupFixturePreparers( - android.FixtureMergeEnv(map[string]string{ - "EMMA_INSTRUMENT": "true", - "EMMA_INSTRUMENT_FRAMEWORK": "true", - }), - // need to mock jacocoagent here to satisfy dependency added for - // instrumented libraries at build time - android.FixtureAddFile("jacocoagent/Android.bp", []byte(` - java_library { - name: "jacocoagent", - srcs: ["Test.java"], - system_modules: "none", - sdk_version: "none", - } - `)), - ) - prepareWithBp := android.FixtureWithRootAndroidBp(` bootclasspath_fragment { name: "myfragment", @@ -191,7 +174,7 @@ func TestBootclasspathFragment_Coverage(t *testing.T) { t.Run("with coverage", func(t *testing.T) { result := android.GroupFixturePreparers( - prepareForTestWithFrameworkCoverage, + prepareForTestWithFrameworkJacocoInstrumentation, preparer, ).RunTest(t) checkContents(t, result, "mybootlib", "coveragelib") -- cgit v1.2.3-59-g8ed1b