From 5b009aedf9f2e3c3c67d07dbce73ba3734d8b77d Mon Sep 17 00:00:00 2001 From: Yuntao Xu Date: Thu, 13 May 2021 12:42:24 -0700 Subject: [PATCH] syntax check to jacoco filters for any build Perform syntax check to jacoco filters for any build. Bug: 183622051 Test: Manual Test: TreeHugger Change-Id: Iff90d7b45bdad8706c43c7e16d98270af688d20b --- java/base.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/base.go b/java/base.go index 19c85cd75..2cc0e767e 100644 --- a/java/base.go +++ b/java/base.go @@ -1177,8 +1177,14 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { j.properties.Instrument = true } + // enforce syntax check to jacoco filters for any build (http://b/183622051) + specs := j.jacocoModuleToZipCommand(ctx) + if ctx.Failed() { + return + } + if j.shouldInstrument(ctx) { - outputFile = j.instrument(ctx, flags, outputFile, jarName) + outputFile = j.instrument(ctx, flags, outputFile, jarName, specs) } // merge implementation jar with resources if necessary @@ -1390,9 +1396,7 @@ func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars } func (j *Module) instrument(ctx android.ModuleContext, flags javaBuilderFlags, - classesJar android.Path, jarName string) android.OutputPath { - - specs := j.jacocoModuleToZipCommand(ctx) + classesJar android.Path, jarName string, specs string) android.OutputPath { jacocoReportClassesFile := android.PathForModuleOut(ctx, "jacoco-report-classes", jarName) instrumentedJar := android.PathForModuleOut(ctx, "jacoco", jarName).OutputPath