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
This commit is contained in:
Mathew Inwood 2018-06-22 15:28:11 +01:00
parent bdf16ec5b2
commit 76c3de1cea
1 changed files with 12 additions and 0 deletions

View File

@ -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)