Change type of Image_name from string to *string
Bug: 177892522 Test: m nothing Change-Id: Id72b6079f11c28df6248e71998fb97851cfc5be9
This commit is contained in:
@@ -44,7 +44,7 @@ type bootImageProperties struct {
|
|||||||
// The name of the image this represents.
|
// The name of the image this represents.
|
||||||
//
|
//
|
||||||
// Must be one of "art" or "boot".
|
// Must be one of "art" or "boot".
|
||||||
Image_name string
|
Image_name *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type BootImageModule struct {
|
type BootImageModule struct {
|
||||||
@@ -127,14 +127,8 @@ func (b *BootImageModule) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
// GenerateSingletonBuildActions method as it cannot create it for itself.
|
// GenerateSingletonBuildActions method as it cannot create it for itself.
|
||||||
dexpreopt.GetGlobalSoongConfig(ctx)
|
dexpreopt.GetGlobalSoongConfig(ctx)
|
||||||
|
|
||||||
// Get a map of the image configs that are supported.
|
imageConfig := b.getImageConfig(ctx)
|
||||||
imageConfigs := genBootImageConfigs(ctx)
|
|
||||||
|
|
||||||
// Retrieve the config for this image.
|
|
||||||
imageName := b.properties.Image_name
|
|
||||||
imageConfig := imageConfigs[imageName]
|
|
||||||
if imageConfig == nil {
|
if imageConfig == nil {
|
||||||
ctx.PropertyErrorf("image_name", "Unknown image name %q, expected one of %s", imageName, strings.Join(android.SortedStringKeys(imageConfigs), ", "))
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +139,25 @@ func (b *BootImageModule) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
ctx.SetProvider(BootImageInfoProvider, info)
|
ctx.SetProvider(BootImageInfoProvider, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *BootImageModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
|
||||||
|
// Get a map of the image configs that are supported.
|
||||||
|
imageConfigs := genBootImageConfigs(ctx)
|
||||||
|
|
||||||
|
// Retrieve the config for this image.
|
||||||
|
imageNamePtr := b.properties.Image_name
|
||||||
|
if imageNamePtr == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
imageName := *imageNamePtr
|
||||||
|
imageConfig := imageConfigs[imageName]
|
||||||
|
if imageConfig == nil {
|
||||||
|
ctx.PropertyErrorf("image_name", "Unknown image name %q, expected one of %s", imageName, strings.Join(android.SortedStringKeys(imageConfigs), ", "))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return imageConfig
|
||||||
|
}
|
||||||
|
|
||||||
type bootImageMemberType struct {
|
type bootImageMemberType struct {
|
||||||
android.SdkMemberTypeBase
|
android.SdkMemberTypeBase
|
||||||
}
|
}
|
||||||
@@ -169,7 +182,7 @@ func (b *bootImageMemberType) CreateVariantPropertiesStruct() android.SdkMemberP
|
|||||||
type bootImageSdkMemberProperties struct {
|
type bootImageSdkMemberProperties struct {
|
||||||
android.SdkMemberPropertiesBase
|
android.SdkMemberPropertiesBase
|
||||||
|
|
||||||
Image_name string
|
Image_name *string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
|
||||||
@@ -179,8 +192,8 @@ func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMember
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
|
||||||
if b.Image_name != "" {
|
if b.Image_name != nil {
|
||||||
propertySet.AddProperty("image_name", b.Image_name)
|
propertySet.AddProperty("image_name", *b.Image_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user