aboutsummaryrefslogtreecommitdiffstats
path: root/java/java.go
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2020-06-09 13:07:36 +0100
committerOliver Nguyen <olivernguyen@google.com>2020-06-30 14:50:00 -0700
commit583691a0603940c114b882543089bd56790d25a3 (patch)
treec97596660abfdaa67a8f1cb170be1c0d9fd3fdbd /java/java.go
parent0c9a2d07682f1e5a4b1e10f27ebcb7dec1038fd2 (diff)
downloadbuild_soong-583691a0603940c114b882543089bd56790d25a3.tar.gz
build_soong-583691a0603940c114b882543089bd56790d25a3.tar.bz2
build_soong-583691a0603940c114b882543089bd56790d25a3.zip
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 Merged-In: Ibe9c1f41ed6110867411952689c5a7ad6536f277 Change-Id: Ibe9c1f41ed6110867411952689c5a7ad6536f277
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go
index 90e9b1f6..1560e186 100644
--- a/java/java.go
+++ b/java/java.go
@@ -627,7 +627,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 {