bootclasspath_fragment: Add contents to snapshot

Bug: 177892522
Test: m nothing
Change-Id: I54fe0537b758a0e3dacd34b139ef3eb21b8841fd
This commit is contained in:
Paul Duffin
2021-04-19 13:23:06 +01:00
parent 0b28a8d356
commit a57835e8e5
5 changed files with 186 additions and 6 deletions

View File

@@ -319,19 +319,33 @@ func (b *bootImageMemberType) CreateVariantPropertiesStruct() android.SdkMemberP
type bootImageSdkMemberProperties struct {
android.SdkMemberPropertiesBase
// The image name
Image_name *string
// Contents of the bootclasspath fragment
Contents []string
}
func (b *bootImageSdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
module := variant.(*BootImageModule)
b.Image_name = module.properties.Image_name
if b.Image_name == nil {
// Only one of image_name or contents can be specified. However, if image_name is set then the
// contents property is updated to match the configuration used to create the corresponding
// boot image. Therefore, contents property is only copied if the image name is not specified.
b.Contents = module.properties.Contents
}
}
func (b *bootImageSdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
if b.Image_name != nil {
propertySet.AddProperty("image_name", *b.Image_name)
}
if len(b.Contents) > 0 {
propertySet.AddPropertyWithTag("contents", b.Contents, ctx.SnapshotBuilder().SdkMemberReferencePropertyTag(true))
}
}
var _ android.SdkMemberType = (*bootImageMemberType)(nil)

View File

@@ -200,6 +200,9 @@ func FixtureConfigureBootJars(bootJars ...string) android.FixturePreparer {
}),
dexpreopt.FixtureSetBootJars(bootJars...),
dexpreopt.FixtureSetArtBootJars(artBootJars...),
// Add a fake dex2oatd module.
dexpreopt.PrepareForTestWithFakeDex2oatd,
)
}
@@ -212,6 +215,9 @@ func FixtureConfigureUpdatableBootJars(bootJars ...string) android.FixturePrepar
variables.UpdatableBootJars = android.CreateTestConfiguredJarList(bootJars)
}),
dexpreopt.FixtureSetUpdatableBootJars(bootJars...),
// Add a fake dex2oatd module.
dexpreopt.PrepareForTestWithFakeDex2oatd,
)
}