From 76c3de1ceaefee3a3a167e790e76fa89d60dd32e Mon Sep 17 00:00:00 2001 From: Mathew Inwood Date: Fri, 22 Jun 2018 15:28:11 +0100 Subject: [PATCH] Add support for -apiMapping parameter in DocLava. This is used to output a mapping of class member signature to source position, which in turn is used for automated addition of annotations in frameworks code. Metalava support does not exist (yet), and may not be needed, since the addition of these annotations in a one-time thing. This change can be reverted once this is complete. See go/hidden-api-annotations for more context. Test: m Bug: 110868826 Change-Id: I90e409f6ea02b16eb9e03d92382f9bb46a8fdab5 --- java/droiddoc.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/java/droiddoc.go b/java/droiddoc.go index dbceed86e..6cb8d3c14 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -226,6 +226,10 @@ type DroiddocProperties struct { // the generated removed Dex API filename by Doclava. Removed_dex_api_filename *string + // mapping of dex signatures to source file and line number. This is a temporary property and + // will be deleted; you probably shouldn't be using it. + Dex_mapping_filename *string + // the generated exact API filename by Doclava. Exact_api_filename *string @@ -283,6 +287,7 @@ type Droiddoc struct { removedApiFile android.WritablePath removedDexApiFile android.WritablePath exactApiFile android.WritablePath + apiMappingFile android.WritablePath checkCurrentApiTimestamp android.WritablePath updateCurrentApiTimestamp android.WritablePath @@ -831,6 +836,13 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) { implicitOutputs = append(implicitOutputs, d.exactApiFile) } + if String(d.properties.Dex_mapping_filename) != "" { + d.apiMappingFile = android.PathForModuleOut(ctx, String(d.properties.Dex_mapping_filename)) + args = args + " -apiMapping " + d.apiMappingFile.String() + // Omitted: metalava support + implicitOutputs = append(implicitOutputs, d.apiMappingFile) + } + implicits = append(implicits, d.Javadoc.srcJars...) implicitOutputs = append(implicitOutputs, d.Javadoc.docZip)