Populate hiddenAPI structure even when not active am: 001e606e5c
am: 251bb0cfaf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707568 Change-Id: Ie16eb49bc6a0f51da5f143f0ce8dbb1cc8d7b8b8
This commit is contained in:
@@ -208,12 +208,13 @@ func isModuleInBootClassPath(ctx android.BaseModuleContext, module android.Modul
|
|||||||
func (h *hiddenAPI) hiddenAPIExtractAndEncode(ctx android.ModuleContext, dexJar android.OutputPath,
|
func (h *hiddenAPI) hiddenAPIExtractAndEncode(ctx android.ModuleContext, dexJar android.OutputPath,
|
||||||
implementationJar android.Path, uncompressDex bool) android.OutputPath {
|
implementationJar android.Path, uncompressDex bool) android.OutputPath {
|
||||||
|
|
||||||
|
// Call before checking if this is active as it will update the hiddenAPI structure.
|
||||||
|
h.hiddenAPIExtractInformation(ctx, dexJar, implementationJar)
|
||||||
|
|
||||||
if !h.active {
|
if !h.active {
|
||||||
return dexJar
|
return dexJar
|
||||||
}
|
}
|
||||||
|
|
||||||
h.hiddenAPIExtractInformation(ctx, dexJar, implementationJar)
|
|
||||||
|
|
||||||
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", h.configurationName+".jar").OutputPath
|
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", h.configurationName+".jar").OutputPath
|
||||||
|
|
||||||
// Create a copy of the dex jar which has been encoded with hiddenapi flags.
|
// Create a copy of the dex jar which has been encoded with hiddenapi flags.
|
||||||
@@ -231,6 +232,20 @@ func (h *hiddenAPI) hiddenAPIExtractAndEncode(ctx android.ModuleContext, dexJar
|
|||||||
// It also makes the dex jar available for use when generating the
|
// It also makes the dex jar available for use when generating the
|
||||||
// hiddenAPISingletonPathsStruct.stubFlags.
|
// hiddenAPISingletonPathsStruct.stubFlags.
|
||||||
func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJar, classesJar android.Path) {
|
func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJar, classesJar android.Path) {
|
||||||
|
|
||||||
|
// Save the classes jars even if this is not active as they may be used by modular hidden API
|
||||||
|
// processing.
|
||||||
|
classesJars := android.Paths{classesJar}
|
||||||
|
ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) {
|
||||||
|
javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
||||||
|
classesJars = append(classesJars, javaInfo.ImplementationJars...)
|
||||||
|
})
|
||||||
|
h.classesJarPaths = classesJars
|
||||||
|
|
||||||
|
// Save the unencoded dex jar so it can be used when generating the
|
||||||
|
// hiddenAPISingletonPathsStruct.stubFlags file.
|
||||||
|
h.bootDexJarPath = dexJar
|
||||||
|
|
||||||
if !h.active {
|
if !h.active {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -242,13 +257,6 @@ func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
classesJars := android.Paths{classesJar}
|
|
||||||
ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) {
|
|
||||||
javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
|
||||||
classesJars = append(classesJars, javaInfo.ImplementationJars...)
|
|
||||||
})
|
|
||||||
h.classesJarPaths = classesJars
|
|
||||||
|
|
||||||
stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
|
stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
|
||||||
|
|
||||||
flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv")
|
flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv")
|
||||||
@@ -289,10 +297,6 @@ func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJa
|
|||||||
Inputs(classesJars)
|
Inputs(classesJars)
|
||||||
rule.Build("merged-hiddenapi-index", "Merged Hidden API index")
|
rule.Build("merged-hiddenapi-index", "Merged Hidden API index")
|
||||||
h.indexCSVPath = indexCSV
|
h.indexCSVPath = indexCSV
|
||||||
|
|
||||||
// Save the unencoded dex jar so it can be used when generating the
|
|
||||||
// hiddenAPISingletonPathsStruct.stubFlags file.
|
|
||||||
h.bootDexJarPath = dexJar
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{
|
var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{
|
||||||
|
Reference in New Issue
Block a user