Merge "add jacocoagent by default to Java modules" into tm-mainline-prod

This commit is contained in:
TreeHugger Robot
2022-09-16 18:31:11 +00:00
committed by Android (Google) Code Review
6 changed files with 71 additions and 45 deletions

View File

@@ -649,6 +649,10 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool {
return false
}
func (j *Module) setInstrument(value bool) {
j.properties.Instrument = value
}
func (j *Module) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
return android.SdkSpecFrom(ctx, String(j.deviceProperties.Sdk_version))
}
@@ -783,9 +787,6 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
} else if j.shouldInstrumentStatic(ctx) {
ctx.AddVariationDependencies(nil, staticLibTag, "jacocoagent")
}
if j.shouldInstrument(ctx) {
ctx.AddVariationDependencies(nil, libTag, "jacocoagent")
}
if j.useCompose() {
ctx.AddVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag,
@@ -1414,10 +1415,6 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.headerJarFile = j.implementationJarFile
}
if j.shouldInstrumentInApex(ctx) {
j.properties.Instrument = true
}
// enforce syntax check to jacoco filters for any build (http://b/183622051)
specs := j.jacocoModuleToZipCommand(ctx)
if ctx.Failed() {