From 7f8721618cbdcd169694d980cd598d0b80ef9629 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 17 Jun 2021 19:33:24 +0100 Subject: [PATCH] Exclude jacocoagent from boot jars package check This replicates the previous behavior when the boot jars package check was performed by a singleton. When the singleton was removed and the check was performed by the platform-bootclasspath the logic to exclude jacocoagent from the list was lost. This change replaces it. Bug: 191377804 Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true check-boot-jars - fails without this change passes with this change. Change-Id: If9eae254045bef9a0c0963213721fc12a9f463cb --- java/boot_jars.go | 2 +- java/hiddenapi_modular.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/java/boot_jars.go b/java/boot_jars.go index 5ec9f714b..86ebe36b4 100644 --- a/java/boot_jars.go +++ b/java/boot_jars.go @@ -37,7 +37,7 @@ func buildRuleForBootJarsPackageCheck(ctx android.ModuleContext, bootDexJarByMod rule.Command().BuiltTool("check_boot_jars"). Input(ctx.Config().HostToolPath(ctx, "dexdump")). Input(android.PathForSource(ctx, "build/soong/scripts/check_boot_jars/package_allowed_list.txt")). - Inputs(bootDexJarByModule.bootDexJars()). + Inputs(bootDexJarByModule.bootDexJarsWithoutCoverage()). Text("&& touch").Output(timestamp) rule.Build("boot_jars_package_check", "check boot jar packages") diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index 60300afe1..de72b39aa 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -589,6 +589,19 @@ func (b bootDexJarByModule) bootDexJars() android.Paths { return paths } +// bootDexJarsWithoutCoverage returns the boot dex jar paths sorted by their keys without coverage +// libraries if present. +func (b bootDexJarByModule) bootDexJarsWithoutCoverage() android.Paths { + paths := android.Paths{} + for _, k := range android.SortedStringKeys(b) { + if k == "jacocoagent" { + continue + } + paths = append(paths, b[k]) + } + return paths +} + // HiddenAPIOutput encapsulates the output from the hidden API processing. type HiddenAPIOutput struct { HiddenAPIFlagOutput