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
This commit is contained in:
@@ -8843,19 +8843,7 @@ func TestApexJavaCoverage(t *testing.T) {
|
||||
android.FixtureWithRootAndroidBp(bp),
|
||||
dexpreopt.FixtureSetApexBootJars("myapex:mybootclasspathlib"),
|
||||
dexpreopt.FixtureSetApexSystemServerJars("myapex:mysystemserverclasspathlib"),
|
||||
android.FixtureMergeEnv(map[string]string{
|
||||
"EMMA_INSTRUMENT": "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",
|
||||
}
|
||||
`)),
|
||||
java.PrepareForTestWithJacocoInstrumentation,
|
||||
).RunTest(t)
|
||||
|
||||
// Make sure jacoco ran on both mylib and mybootclasspathlib
|
||||
|
Reference in New Issue
Block a user