Make sdk member type related types and vars type specific

Previously, some of the sdk member type related types and variables
included the words "member type" whereas others only used the word
"member" and did not include "type". This changes makes them all
include the word "type" to differentiate them from other types related
to sdk members.

Bug: 195754365
Test: m nothing
Change-Id: I913daaa1d436fd5dc857c2af0ffdee6471dcc6ed
This commit is contained in:
Paul Duffin 2021-07-14 12:05:16 +01:00
parent 296701e35b
commit 62782de15c
3 changed files with 39 additions and 37 deletions

View file

@ -401,26 +401,26 @@ type SdkMemberTypeDependencyTag interface {
ExportMember() bool
}
var _ SdkMemberTypeDependencyTag = (*sdkMemberDependencyTag)(nil)
var _ ReplaceSourceWithPrebuilt = (*sdkMemberDependencyTag)(nil)
var _ SdkMemberTypeDependencyTag = (*sdkMemberTypeDependencyTag)(nil)
var _ ReplaceSourceWithPrebuilt = (*sdkMemberTypeDependencyTag)(nil)
type sdkMemberDependencyTag struct {
type sdkMemberTypeDependencyTag struct {
blueprint.BaseDependencyTag
memberType SdkMemberType
export bool
}
func (t *sdkMemberDependencyTag) SdkMemberType(_ Module) SdkMemberType {
func (t *sdkMemberTypeDependencyTag) SdkMemberType(_ Module) SdkMemberType {
return t.memberType
}
func (t *sdkMemberDependencyTag) ExportMember() bool {
func (t *sdkMemberTypeDependencyTag) ExportMember() bool {
return t.export
}
// Prevent dependencies from the sdk/module_exports onto their members from being
// replaced with a preferred prebuilt.
func (t *sdkMemberDependencyTag) ReplaceSourceWithPrebuilt() bool {
func (t *sdkMemberTypeDependencyTag) ReplaceSourceWithPrebuilt() bool {
return false
}
@ -428,7 +428,7 @@ func (t *sdkMemberDependencyTag) ReplaceSourceWithPrebuilt() bool {
// dependencies added by the tag to be added to the sdk as the specified SdkMemberType and exported
// (or not) as specified by the export parameter.
func DependencyTagForSdkMemberType(memberType SdkMemberType, export bool) SdkMemberTypeDependencyTag {
return &sdkMemberDependencyTag{memberType: memberType, export: export}
return &sdkMemberTypeDependencyTag{memberType: memberType, export: export}
}
// Interface that must be implemented for every type that can be a member of an
@ -610,8 +610,10 @@ func (r *SdkMemberTypesRegistry) UniqueOnceKey() OnceKey {
return NewCustomOnceKey(r)
}
// The set of registered SdkMemberTypes, one for sdk module and one for module_exports.
// The set of registered SdkMemberTypes for module_exports modules.
var ModuleExportsMemberTypes = &SdkMemberTypesRegistry{}
// The set of registered SdkMemberTypes for sdk modules.
var SdkMemberTypes = &SdkMemberTypesRegistry{}
// Register an SdkMemberType object to allow them to be used in the sdk and sdk_snapshot module

View file

@ -50,7 +50,7 @@ type sdk struct {
// The dynamically generated information about the registered SdkMemberType
dynamicSdkMemberTypes *dynamicSdkMemberTypes
// The dynamically created instance of the properties struct containing the sdk member
// The dynamically created instance of the properties struct containing the sdk member type
// list properties, e.g. java_libs.
dynamicMemberTypeListProperties interface{}
@ -95,9 +95,9 @@ type sdkProperties struct {
Prebuilt_visibility []string
}
// Contains information about the sdk properties that list sdk members, e.g.
// Contains information about the sdk properties that list sdk members by type, e.g.
// Java_header_libs.
type sdkMemberListProperty struct {
type sdkMemberTypeListProperty struct {
// getter for the list of member names
getter func(properties interface{}) []string
@ -112,7 +112,7 @@ type sdkMemberListProperty struct {
dependencyTag android.SdkMemberTypeDependencyTag
}
func (p *sdkMemberListProperty) propertyName() string {
func (p *sdkMemberTypeListProperty) propertyName() string {
return p.memberType.SdkPropertyName()
}
@ -129,12 +129,12 @@ type dynamicSdkMemberTypes struct {
propertiesStructType reflect.Type
// Information about each of the member type specific list properties.
memberListProperties []*sdkMemberListProperty
memberTypeListProperties []*sdkMemberTypeListProperty
memberTypeToProperty map[android.SdkMemberType]*sdkMemberListProperty
memberTypeToProperty map[android.SdkMemberType]*sdkMemberTypeListProperty
}
func (d *dynamicSdkMemberTypes) createMemberListProperties() interface{} {
func (d *dynamicSdkMemberTypes) createMemberTypeListProperties() interface{} {
return reflect.New(d.propertiesStructType).Interface()
}
@ -164,11 +164,11 @@ func getDynamicSdkMemberTypes(registry *android.SdkMemberTypesRegistry) *dynamic
//
func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynamicSdkMemberTypes {
var listProperties []*sdkMemberListProperty
memberTypeToProperty := map[android.SdkMemberType]*sdkMemberListProperty{}
var listProperties []*sdkMemberTypeListProperty
memberTypeToProperty := map[android.SdkMemberType]*sdkMemberTypeListProperty{}
var fields []reflect.StructField
// Iterate over the member types creating StructField and sdkMemberListProperty objects.
// Iterate over the member types creating StructField and sdkMemberTypeListProperty objects.
nextFieldIndex := 0
for _, memberType := range sdkMemberTypes {
@ -213,8 +213,8 @@ func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynami
}
}
// Create an sdkMemberListProperty for the member type.
memberListProperty := &sdkMemberListProperty{
// Create an sdkMemberTypeListProperty for the member type.
memberListProperty := &sdkMemberTypeListProperty{
getter: getter,
setter: setter,
memberType: memberType,
@ -231,9 +231,9 @@ func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynami
propertiesStructType := reflect.StructOf(fields)
return &dynamicSdkMemberTypes{
memberListProperties: listProperties,
memberTypeToProperty: memberTypeToProperty,
propertiesStructType: propertiesStructType,
memberTypeListProperties: listProperties,
memberTypeToProperty: memberTypeToProperty,
propertiesStructType: propertiesStructType,
}
}
@ -247,16 +247,16 @@ func newSdkModule(moduleExports bool) *sdk {
s := &sdk{}
s.properties.Module_exports = moduleExports
// Get the dynamic sdk member type data for the currently registered sdk member types.
var registry *android.SdkMemberTypesRegistry
var typeRegistry *android.SdkMemberTypesRegistry
if moduleExports {
registry = android.ModuleExportsMemberTypes
typeRegistry = android.ModuleExportsMemberTypes
} else {
registry = android.SdkMemberTypes
typeRegistry = android.SdkMemberTypes
}
s.dynamicSdkMemberTypes = getDynamicSdkMemberTypes(registry)
s.dynamicSdkMemberTypes = getDynamicSdkMemberTypes(typeRegistry)
// Create an instance of the dynamically created struct that contains all the
// properties for the member type specific list properties.
s.dynamicMemberTypeListProperties = s.dynamicSdkMemberTypes.createMemberListProperties()
s.dynamicMemberTypeListProperties = s.dynamicSdkMemberTypes.createMemberTypeListProperties()
s.AddProperties(&s.properties, s.dynamicMemberTypeListProperties)
// Make sure that the prebuilt visibility property is verified for errors.
@ -280,11 +280,11 @@ func SnapshotModuleFactory() android.Module {
return s
}
func (s *sdk) memberListProperties() []*sdkMemberListProperty {
return s.dynamicSdkMemberTypes.memberListProperties
func (s *sdk) memberTypeListProperties() []*sdkMemberTypeListProperty {
return s.dynamicSdkMemberTypes.memberTypeListProperties
}
func (s *sdk) memberListProperty(memberType android.SdkMemberType) *sdkMemberListProperty {
func (s *sdk) memberTypeListProperty(memberType android.SdkMemberType) *sdkMemberTypeListProperty {
return s.dynamicSdkMemberTypes.memberTypeToProperty[memberType]
}
@ -424,7 +424,7 @@ func memberMutator(mctx android.BottomUpMutatorContext) {
// Add dependencies from enabled and non CommonOS variants to the sdk member variants.
if s.Enabled() && !s.IsCommonOSVariant() {
ctx := s.newDependencyContext(mctx)
for _, memberListProperty := range s.memberListProperties() {
for _, memberListProperty := range s.memberTypeListProperties() {
if memberListProperty.getter == nil {
continue
}

View file

@ -251,7 +251,7 @@ func (s *sdk) groupMemberVariantsByMemberThenType(ctx android.ModuleContext, mem
}
var members []*sdkMember
for _, memberListProperty := range s.memberListProperties() {
for _, memberListProperty := range s.memberTypeListProperties() {
membersOfType := byType[memberListProperty.memberType]
members = append(members, membersOfType...)
}
@ -667,7 +667,7 @@ func (s *sdk) collateSnapshotModuleInfo(ctx android.BaseModuleContext, sdkVarian
staticProperties := &snapshotModuleStaticProperties{
Compile_multilib: sdkVariant.multilibUsages.String(),
}
dynamicProperties := s.dynamicSdkMemberTypes.createMemberListProperties()
dynamicProperties := s.dynamicSdkMemberTypes.createMemberTypeListProperties()
combinedProperties := &combinedSnapshotModuleProperties{
sdkVariant: sdkVariant,
@ -687,7 +687,7 @@ func (s *sdk) collateSnapshotModuleInfo(ctx android.BaseModuleContext, sdkVarian
}
combined := sdkVariantToCombinedProperties[memberVariantDep.sdkVariant]
memberListProperty := s.memberListProperty(memberVariantDep.memberType)
memberListProperty := s.memberTypeListProperty(memberVariantDep.memberType)
memberName := ctx.OtherModuleName(memberVariantDep.variant)
if memberListProperty.getter == nil {
@ -717,7 +717,7 @@ func (s *sdk) optimizeSnapshotModuleProperties(ctx android.ModuleContext, list [
}
// Extract the common members, removing them from the original properties.
commonDynamicProperties := s.dynamicSdkMemberTypes.createMemberListProperties()
commonDynamicProperties := s.dynamicSdkMemberTypes.createMemberTypeListProperties()
extractor := newCommonValueExtractor(commonDynamicProperties)
extractCommonProperties(ctx, extractor, commonDynamicProperties, propertyContainers)
@ -750,7 +750,7 @@ func (s *sdk) addSnapshotPropertiesToPropertySet(builder *snapshotBuilder, prope
}
dynamicMemberTypeListProperties := combined.dynamicProperties
for _, memberListProperty := range s.memberListProperties() {
for _, memberListProperty := range s.memberTypeListProperties() {
if memberListProperty.getter == nil {
continue
}