diff options
Diffstat (limited to 'sdk/update.go')
-rw-r--r-- | sdk/update.go | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/sdk/update.go b/sdk/update.go index e61ae0d0a..c5adddafb 100644 --- a/sdk/update.go +++ b/sdk/update.go @@ -268,13 +268,19 @@ func (s *sdk) groupMemberVariantsByMemberThenType(ctx android.ModuleContext, mem member = &sdkMember{memberType: memberType, name: name} byName[name] = member byType[memberType] = append(byType[memberType], member) + } else if member.memberType != memberType { + // validate whether this is the same member type or and overriding member type + if memberType.Overrides(member.memberType) { + member.memberType = memberType + } else if !member.memberType.Overrides(memberType) { + ctx.ModuleErrorf("Incompatible member types %q %q", member.memberType, memberType) + } } // Only append new variants to the list. This is needed because a member can be both // exported by the sdk and also be a transitive sdk member. member.variants = appendUniqueVariants(member.variants, variant) } - var members []*sdkMember for _, memberListProperty := range s.memberTypeListProperties() { membersOfType := byType[memberListProperty.memberType] @@ -1783,7 +1789,9 @@ func newArchSpecificInfo(ctx android.SdkMemberContext, archId archId, osType and // added. archInfo.Properties = variantPropertiesFactory() - if len(archVariants) == 1 { + // if there are multiple supported link variants, we want to nest based on linkage even if there + // is only one variant, otherwise, if there is only one variant we can populate based on the arch + if len(archVariants) == 1 && len(ctx.MemberType().SupportedLinkages()) <= 1 { archInfo.Properties.PopulateFromVariant(ctx, archVariants[0]) } else { // Group the variants by image type. @@ -1910,11 +1918,13 @@ func newImageVariantSpecificInfo(ctx android.SdkMemberContext, imageVariant stri // Create the properties into which the image variant specific properties will be added. imageInfo.Properties = variantPropertiesFactory() - if len(imageVariants) == 1 { + // if there are multiple supported link variants, we want to nest even if there is only one + // variant, otherwise, if there is only one variant we can populate based on the image + if len(imageVariants) == 1 && len(ctx.MemberType().SupportedLinkages()) <= 1 { imageInfo.Properties.PopulateFromVariant(ctx, imageVariants[0]) } else { // There is more than one variant for this image variant which must be differentiated by link - // type. + // type. Or there are multiple supported linkages and we need to nest based on link type. for _, linkVariant := range imageVariants { linkType := getLinkType(linkVariant) if linkType == "" { @@ -1958,10 +1968,22 @@ func (imageInfo *imageVariantSpecificInfo) addToPropertySet(ctx *memberContext, addSdkMemberPropertiesToSet(ctx, imageInfo.Properties, propertySet) + usedLinkages := make(map[string]bool, len(imageInfo.linkInfos)) for _, linkInfo := range imageInfo.linkInfos { + usedLinkages[linkInfo.linkType] = true linkInfo.addToPropertySet(ctx, propertySet) } + // If not all supported linkages had existing variants, we need to disable the unsupported variant + if len(imageInfo.linkInfos) < len(ctx.MemberType().SupportedLinkages()) { + for _, l := range ctx.MemberType().SupportedLinkages() { + if _, ok := usedLinkages[l]; !ok { + otherLinkagePropertySet := propertySet.AddPropertySet(l) + otherLinkagePropertySet.AddProperty("enabled", false) + } + } + } + // If this is for a non-core image variant then make sure that the property set does not contain // any properties as providing non-core image variant specific properties for prebuilts is not // currently supported. |