From 537ea3d04cf9587809b832b11c9830c433dc8267 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 14 May 2021 10:38:00 +0100 Subject: Generate monolithic hidden API files direct from class jars Previously, the monolithic hidden API files, e.g. hiddenapi-index.csv file, were generated in two steps. First, each module created its own files using the information in its class jars. Then, the monolithic files were created by merging those module specific files into a larger file. This change switches to generating the monolithic files directly from the class jar files and bypassing the intermediate files. In order to ensure that this change did not change the monolithic files it is necessary for the hiddenapi-metadata.csv to go through a reformatting step. Hopefully, this will be able to be removed in a follow up change. Bug: 179354495 Test: verified that the monolithic out/soong/hiddenapi/... files are unchanged by this change Change-Id: I5a78e747516014b7c0f402a4b4431b14be6a84b2 --- java/hiddenapi.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'java/hiddenapi.go') diff --git a/java/hiddenapi.go b/java/hiddenapi.go index 270fd0a2d..2f73262fb 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -91,31 +91,22 @@ type hiddenAPI struct { classesJarPaths android.Paths } -func (h *hiddenAPI) flagsCSV() android.Path { - return h.flagsCSVPath -} - -func (h *hiddenAPI) metadataCSV() android.Path { - return h.metadataCSVPath -} - func (h *hiddenAPI) bootDexJar() android.Path { return h.bootDexJarPath } -func (h *hiddenAPI) indexCSV() android.Path { - return h.indexCSVPath -} - func (h *hiddenAPI) classesJars() android.Paths { return h.classesJarPaths } +// hiddenAPIModule is the interface a module that embeds the hiddenAPI structure must implement. +type hiddenAPIModule interface { + android.Module + hiddenAPIIntf +} + type hiddenAPIIntf interface { bootDexJar() android.Path - flagsCSV() android.Path - indexCSV() android.Path - metadataCSV() android.Path classesJars() android.Paths } @@ -312,6 +303,7 @@ func buildRuleToGenerateIndex(ctx android.ModuleContext, desc string, classesJar BuiltTool("merge_csv"). Flag("--zip_input"). Flag("--key_field signature"). + FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties"). FlagWithOutput("--output=", indexCSV). Inputs(classesJars) rule.Build(desc, desc) -- cgit v1.2.3-59-g8ed1b