Remove duplicates in monolithic hidden API files am: 82b3fcf123
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1587496 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I7b6bbc33ff1bae69ca09dafafa4c65690451b5b9
This commit is contained in:
commit
f36d0e21c3
|
@ -124,7 +124,8 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationNa
|
|||
// on the boot jars list because the runtime only enforces access to the hidden API for the
|
||||
// bootclassloader. If information is gathered for modules not on the list then that will cause
|
||||
// failures in the CtsHiddenApiBlocklist... tests.
|
||||
h.active = inList(configurationName, ctx.Config().BootJars())
|
||||
module := ctx.Module()
|
||||
h.active = isModuleInBootClassPath(ctx, module)
|
||||
if !h.active {
|
||||
// The rest of the properties will be ignored if active is false.
|
||||
return
|
||||
|
@ -135,7 +136,6 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationNa
|
|||
|
||||
// A prebuilt module is only primary if it is preferred and conversely a source module is only
|
||||
// primary if it has not been replaced by a prebuilt module.
|
||||
module := ctx.Module()
|
||||
if pi, ok := module.(android.PrebuiltInterface); ok {
|
||||
if p := pi.Prebuilt(); p != nil {
|
||||
primary = p.UsePrebuilt()
|
||||
|
@ -153,6 +153,15 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationNa
|
|||
h.primary = primary
|
||||
}
|
||||
|
||||
func isModuleInBootClassPath(ctx android.BaseModuleContext, module android.Module) bool {
|
||||
// Get the configured non-updatable and updatable boot jars.
|
||||
nonUpdatableBootJars := ctx.Config().NonUpdatableBootJars()
|
||||
updatableBootJars := ctx.Config().UpdatableBootJars()
|
||||
active := isModuleInConfiguredList(ctx, module, nonUpdatableBootJars) ||
|
||||
isModuleInConfiguredList(ctx, module, updatableBootJars)
|
||||
return active
|
||||
}
|
||||
|
||||
// hiddenAPIExtractAndEncode is called by any module that could contribute to the hiddenapi
|
||||
// processing.
|
||||
//
|
||||
|
|
|
@ -217,10 +217,6 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
|||
|
||||
var bootDexJars android.Paths
|
||||
|
||||
// Get the configured non-updatable and updatable boot jars.
|
||||
nonUpdatableBootJars := ctx.Config().NonUpdatableBootJars()
|
||||
updatableBootJars := ctx.Config().UpdatableBootJars()
|
||||
|
||||
ctx.VisitAllModules(func(module android.Module) {
|
||||
// Collect dex jar paths for the modules listed above.
|
||||
if j, ok := module.(UsesLibraryDependency); ok {
|
||||
|
@ -235,11 +231,6 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
|||
// Collect dex jar paths for modules that had hiddenapi encode called on them.
|
||||
if h, ok := module.(hiddenAPIIntf); ok {
|
||||
if jar := h.bootDexJar(); jar != nil {
|
||||
if !isModuleInConfiguredList(ctx, module, nonUpdatableBootJars) &&
|
||||
!isModuleInConfiguredList(ctx, module, updatableBootJars) {
|
||||
return
|
||||
}
|
||||
|
||||
bootDexJars = append(bootDexJars, jar)
|
||||
}
|
||||
}
|
||||
|
@ -291,8 +282,8 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
|||
// there too.
|
||||
//
|
||||
// TODO(b/179354495): Avoid having to perform this type of check or if necessary dedup it.
|
||||
func isModuleInConfiguredList(ctx android.SingletonContext, module android.Module, configuredBootJars android.ConfiguredJarList) bool {
|
||||
name := ctx.ModuleName(module)
|
||||
func isModuleInConfiguredList(ctx android.BaseModuleContext, module android.Module, configuredBootJars android.ConfiguredJarList) bool {
|
||||
name := ctx.OtherModuleName(module)
|
||||
|
||||
// Strip a prebuilt_ prefix so that this can match a prebuilt module that has not been renamed.
|
||||
name = android.RemoveOptionalPrebuiltPrefix(name)
|
||||
|
@ -305,11 +296,11 @@ func isModuleInConfiguredList(ctx android.SingletonContext, module android.Modul
|
|||
|
||||
// It is an error if the module is not an ApexModule.
|
||||
if _, ok := module.(android.ApexModule); !ok {
|
||||
ctx.Errorf("module %q configured in boot jars does not support being added to an apex", module)
|
||||
ctx.ModuleErrorf("is configured in boot jars but does not support being added to an apex")
|
||||
return false
|
||||
}
|
||||
|
||||
apexInfo := ctx.ModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
||||
apexInfo := ctx.OtherModuleProvider(module, android.ApexInfoProvider).(android.ApexInfo)
|
||||
|
||||
// Now match the apex part of the boot image configuration.
|
||||
requiredApex := configuredBootJars.Apex(index)
|
||||
|
|
Loading…
Reference in New Issue