diff options
author | Roland Levillain <rpl@google.com> | 2020-06-09 13:07:36 +0100 |
---|---|---|
committer | Roland Levillain <rpl@google.com> | 2020-06-15 11:57:31 +0100 |
commit | ada1270ef8796ff436a08ff958033c9c51b94bd9 (patch) | |
tree | a5594844825180162fd000ca0a1ea9b7b1f9fe33 /java/java.go | |
parent | 2752d926a9aa78f68c0713af6ecda11b5b02b583 (diff) |
Introduce product variables to select Java code coverage paths in Soong.
Introduce product variables `JavaCoveragePaths` and
`JavaCoverageExcludePaths` (resp. populated from environment variables
`JAVA_COVERAGE_PATHS` and `JAVA_COVERAGE_EXCLUDE_PATHS`). Use them to
control which Java modules are candidate for instrumentation based on
their source path. By default (when `JavaCoveragePaths` is empty),
have all Java module be candidate for instrumentation, to preserve the
existing behavior.
Test: export EMMA_INSTRUMENT=true \
&& export EMMA_INSTRUMENT_FRAMEWORK=true \
&& export JAVA_COVERAGE_PATHS=art \
&& m
Bug: 158212027
Bug: 156284897
Change-Id: Ibe9c1f41ed6110867411952689c5a7ad6536f277
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go index 1cdfbf187..8b5aeaaf6 100644 --- a/java/java.go +++ b/java/java.go @@ -601,7 +601,9 @@ type jniLib struct { } func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool { - return j.properties.Instrument && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT") + return j.properties.Instrument && + ctx.Config().IsEnvTrue("EMMA_INSTRUMENT") && + ctx.DeviceConfig().JavaCoverageEnabledForPath(ctx.ModuleDir()) } func (j *Module) shouldInstrumentStatic(ctx android.BaseModuleContext) bool { |