Merge changes Ic32f02a6,Ibe358542
* changes: Export classesJars initialized in hiddenAPIExtractInformation Generalize the platformBootclasspathDepsMutator
This commit is contained in:
@@ -24,6 +24,33 @@ import (
|
|||||||
|
|
||||||
// Contains code that is common to both platform_bootclasspath and bootclasspath_fragment.
|
// Contains code that is common to both platform_bootclasspath and bootclasspath_fragment.
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registerBootclasspathBuildComponents(android.InitRegistrationContext)
|
||||||
|
}
|
||||||
|
|
||||||
|
func registerBootclasspathBuildComponents(ctx android.RegistrationContext) {
|
||||||
|
ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
|
ctx.BottomUp("bootclasspath_deps", bootclasspathDepsMutator)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// BootclasspathDepsMutator is the interface that a module must implement if it wants to add
|
||||||
|
// dependencies onto APEX specific variants of bootclasspath fragments or bootclasspath contents.
|
||||||
|
type BootclasspathDepsMutator interface {
|
||||||
|
// BootclasspathDepsMutator implementations should add dependencies using
|
||||||
|
// addDependencyOntoApexModulePair and addDependencyOntoApexVariants.
|
||||||
|
BootclasspathDepsMutator(ctx android.BottomUpMutatorContext)
|
||||||
|
}
|
||||||
|
|
||||||
|
// bootclasspathDepsMutator is called during the final deps phase after all APEX variants have
|
||||||
|
// been created so can add dependencies onto specific APEX variants of modules.
|
||||||
|
func bootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
m := ctx.Module()
|
||||||
|
if p, ok := m.(BootclasspathDepsMutator); ok {
|
||||||
|
p.BootclasspathDepsMutator(ctx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// addDependencyOntoApexVariants adds dependencies onto the appropriate apex specific variants of
|
// addDependencyOntoApexVariants adds dependencies onto the appropriate apex specific variants of
|
||||||
// the module as specified in the ApexVariantReference list.
|
// the module as specified in the ApexVariantReference list.
|
||||||
func addDependencyOntoApexVariants(ctx android.BottomUpMutatorContext, propertyName string, refs []ApexVariantReference, tag blueprint.DependencyTag) {
|
func addDependencyOntoApexVariants(ctx android.BottomUpMutatorContext, propertyName string, refs []ApexVariantReference, tag blueprint.DependencyTag) {
|
||||||
|
@@ -84,6 +84,11 @@ type hiddenAPI struct {
|
|||||||
// created by the unsupported app usage annotation processor during compilation of the class
|
// created by the unsupported app usage annotation processor during compilation of the class
|
||||||
// implementation jar.
|
// implementation jar.
|
||||||
indexCSVPath android.Path
|
indexCSVPath android.Path
|
||||||
|
|
||||||
|
// The paths to the classes jars that contain classes and class members annotated with
|
||||||
|
// the UnsupportedAppUsage annotation that need to be extracted as part of the hidden API
|
||||||
|
// processing.
|
||||||
|
classesJarPaths android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *hiddenAPI) flagsCSV() android.Path {
|
func (h *hiddenAPI) flagsCSV() android.Path {
|
||||||
@@ -102,11 +107,16 @@ func (h *hiddenAPI) indexCSV() android.Path {
|
|||||||
return h.indexCSVPath
|
return h.indexCSVPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *hiddenAPI) classesJars() android.Paths {
|
||||||
|
return h.classesJarPaths
|
||||||
|
}
|
||||||
|
|
||||||
type hiddenAPIIntf interface {
|
type hiddenAPIIntf interface {
|
||||||
bootDexJar() android.Path
|
bootDexJar() android.Path
|
||||||
flagsCSV() android.Path
|
flagsCSV() android.Path
|
||||||
indexCSV() android.Path
|
indexCSV() android.Path
|
||||||
metadataCSV() android.Path
|
metadataCSV() android.Path
|
||||||
|
classesJars() android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
|
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
|
||||||
@@ -244,6 +254,7 @@ func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJa
|
|||||||
javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
|
||||||
classesJars = append(classesJars, javaInfo.ImplementationJars...)
|
classesJars = append(classesJars, javaInfo.ImplementationJars...)
|
||||||
})
|
})
|
||||||
|
h.classesJarPaths = classesJars
|
||||||
|
|
||||||
stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
|
stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
|
||||||
|
|
||||||
|
@@ -27,10 +27,6 @@ func init() {
|
|||||||
|
|
||||||
func registerPlatformBootclasspathBuildComponents(ctx android.RegistrationContext) {
|
func registerPlatformBootclasspathBuildComponents(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("platform_bootclasspath", platformBootclasspathFactory)
|
ctx.RegisterModuleType("platform_bootclasspath", platformBootclasspathFactory)
|
||||||
|
|
||||||
ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
|
||||||
ctx.BottomUp("platform_bootclasspath_deps", platformBootclasspathDepsMutator)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The tag used for the dependency between the platform bootclasspath and any configured boot jars.
|
// The tag used for the dependency between the platform bootclasspath and any configured boot jars.
|
||||||
@@ -126,25 +122,22 @@ func (b *platformBootclasspathModule) hiddenAPIDepsMutator(ctx android.BottomUpM
|
|||||||
hiddenAPIAddStubLibDependencies(ctx, sdkKindToStubLibModules)
|
hiddenAPIAddStubLibDependencies(ctx, sdkKindToStubLibModules)
|
||||||
}
|
}
|
||||||
|
|
||||||
func platformBootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {
|
func (b *platformBootclasspathModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
m := ctx.Module()
|
// Add dependencies on all the modules configured in the "art" boot image.
|
||||||
if p, ok := m.(*platformBootclasspathModule); ok {
|
artImageConfig := genBootImageConfigs(ctx)[artBootImageName]
|
||||||
// Add dependencies on all the modules configured in the "art" boot image.
|
addDependenciesOntoBootImageModules(ctx, artImageConfig.modules)
|
||||||
artImageConfig := genBootImageConfigs(ctx)[artBootImageName]
|
|
||||||
addDependenciesOntoBootImageModules(ctx, artImageConfig.modules)
|
|
||||||
|
|
||||||
// Add dependencies on all the modules configured in the "boot" boot image. That does not
|
// Add dependencies on all the modules configured in the "boot" boot image. That does not
|
||||||
// include modules configured in the "art" boot image.
|
// include modules configured in the "art" boot image.
|
||||||
bootImageConfig := p.getImageConfig(ctx)
|
bootImageConfig := b.getImageConfig(ctx)
|
||||||
addDependenciesOntoBootImageModules(ctx, bootImageConfig.modules)
|
addDependenciesOntoBootImageModules(ctx, bootImageConfig.modules)
|
||||||
|
|
||||||
// Add dependencies on all the updatable modules.
|
// Add dependencies on all the updatable modules.
|
||||||
updatableModules := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars
|
updatableModules := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars
|
||||||
addDependenciesOntoBootImageModules(ctx, updatableModules)
|
addDependenciesOntoBootImageModules(ctx, updatableModules)
|
||||||
|
|
||||||
// Add dependencies on all the fragments.
|
// Add dependencies on all the fragments.
|
||||||
p.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx)
|
b.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func addDependenciesOntoBootImageModules(ctx android.BottomUpMutatorContext, modules android.ConfiguredJarList) {
|
func addDependenciesOntoBootImageModules(ctx android.BottomUpMutatorContext, modules android.ConfiguredJarList) {
|
||||||
|
@@ -232,6 +232,7 @@ func registerRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
|||||||
RegisterAppBuildComponents(ctx)
|
RegisterAppBuildComponents(ctx)
|
||||||
RegisterAppImportBuildComponents(ctx)
|
RegisterAppImportBuildComponents(ctx)
|
||||||
RegisterAppSetBuildComponents(ctx)
|
RegisterAppSetBuildComponents(ctx)
|
||||||
|
registerBootclasspathBuildComponents(ctx)
|
||||||
RegisterBootImageBuildComponents(ctx)
|
RegisterBootImageBuildComponents(ctx)
|
||||||
RegisterDexpreoptBootJarsComponents(ctx)
|
RegisterDexpreoptBootJarsComponents(ctx)
|
||||||
RegisterDocsBuildComponents(ctx)
|
RegisterDocsBuildComponents(ctx)
|
||||||
|
Reference in New Issue
Block a user