Make hidden API handle jacoco-stubs consistently
Previously, when code coverage was enabled the monolithic hidden API
processing would add jacoco-stubs to public APIs only as that would
make them accessible for everyone. However, the
art-bootclasspath-fragment added jacoco-stubs to public, system and
test APIs as that was the simplest way of handling it and while the
extract APIs were unnecessary they would not change behavior.
Unfortunately, that lead to a difference in the flags generated which
caused the check that verifies flags are consistent between the
monolithic and modular files to fail.
This change adds jacoco-stubs to system and test APIs for the
monolithic hidden API processing to ensure consistency.
Bug: 179354495
Bug: 188143639
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true out/soong/hiddenapi/hiddenapi-flags.csv
- ran before making the change to reproduce the problem and after
to verify the fix.
Change-Id: Icbd15f0ece871a8c44d9e4a73fd0f7acc3760bba
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index 1868915..b3a3735 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -99,7 +99,12 @@
systemStubModules = append(systemStubModules, config.ProductHiddenAPIStubsSystem()...)
testStubModules = append(testStubModules, config.ProductHiddenAPIStubsTest()...)
if config.IsEnvTrue("EMMA_INSTRUMENT") {
+ // Add jacoco-stubs to public, system and test. It doesn't make any real difference as public
+ // allows everyone access but it is needed to ensure consistent flags between the
+ // bootclasspath fragment generated flags and the platform_bootclasspath generated flags.
publicStubModules = append(publicStubModules, "jacoco-stubs")
+ systemStubModules = append(systemStubModules, "jacoco-stubs")
+ testStubModules = append(testStubModules, "jacoco-stubs")
}
m := map[android.SdkKind][]string{}