From 098c878838e18ac4d24844088a99d6d06ca0b9b0 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 14 May 2021 10:45:25 +0100 Subject: [PATCH] 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 --- java/hiddenapi_modular.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index 186891556..b3a3735d9 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -99,7 +99,12 @@ func hiddenAPIComputeMonolithicStubLibModules(config android.Config) map[android 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{}