Make new module creation API more flexible
Previously passing additional information to the implementations of AddPrebuiltModule() or the SdkMemberProperties interface would have required making changes to the API. This change added an SdkMemberContext object into which additional information can easily be added without requiring changes to existing implementations. The BuildSnapshot() method was not modified because it is deprecated and will be removed in a follow up change. It also switches the API from passing variants as android.SdkAware to android.Module. That is for a couple of reasons: 1) SdkAware is designed for managing the relationship between the module and the SDK, not for generating the output snapshot. As such there is nothing in SdkAware that is needed for generating the output snapshot. 2) Accepting android.Module instead makes it easier to use the underlying code for generating the snapshot module as well as the individual member modules. This is in preparation for a number of improvements and bug fixes in both the snapshot creation code and implementations to address found while trying to built the platform against ART prebuilts. Bug: 151937654 Test: m nothing Change-Id: Iac10f1200c0f283aa35402167eec8f9aeb65a38e
This commit is contained in:
@@ -357,7 +357,7 @@ type SdkMemberType interface {
|
||||
// structure and calls AddToPropertySet(...) on the properties struct to add the member
|
||||
// specific properties in the correct place in the structure.
|
||||
//
|
||||
AddPrebuiltModule(sdkModuleContext ModuleContext, builder SnapshotBuilder, member SdkMember) BpModule
|
||||
AddPrebuiltModule(ctx SdkMemberContext, member SdkMember) BpModule
|
||||
|
||||
// Create a structure into which variant specific properties can be added.
|
||||
CreateVariantPropertiesStruct() SdkMemberProperties
|
||||
@@ -386,7 +386,7 @@ func (b *SdkMemberTypeBase) BuildSnapshot(sdkModuleContext ModuleContext, builde
|
||||
panic("override AddPrebuiltModule")
|
||||
}
|
||||
|
||||
func (b *SdkMemberTypeBase) AddPrebuiltModule(sdkModuleContext ModuleContext, builder SnapshotBuilder, member SdkMember) BpModule {
|
||||
func (b *SdkMemberTypeBase) AddPrebuiltModule(ctx SdkMemberContext, member SdkMember) BpModule {
|
||||
// Returning nil causes the legacy BuildSnapshot method to be used.
|
||||
return nil
|
||||
}
|
||||
@@ -501,9 +501,19 @@ type SdkMemberProperties interface {
|
||||
// Access the base structure.
|
||||
Base() *SdkMemberPropertiesBase
|
||||
|
||||
// Populate the structure with information from the variant.
|
||||
PopulateFromVariant(variant SdkAware)
|
||||
// Populate this structure with information from the variant.
|
||||
PopulateFromVariant(ctx SdkMemberContext, variant Module)
|
||||
|
||||
// Add the information from the structure to the property set.
|
||||
AddToPropertySet(sdkModuleContext ModuleContext, builder SnapshotBuilder, propertySet BpPropertySet)
|
||||
// Add the information from this structure to the property set.
|
||||
AddToPropertySet(ctx SdkMemberContext, propertySet BpPropertySet)
|
||||
}
|
||||
|
||||
// Provides access to information common to a specific member.
|
||||
type SdkMemberContext interface {
|
||||
|
||||
// The module context of the sdk common os variant which is creating the snapshot.
|
||||
SdkModuleContext() ModuleContext
|
||||
|
||||
// The builder of the snapshot.
|
||||
SnapshotBuilder() SnapshotBuilder
|
||||
}
|
||||
|
Reference in New Issue
Block a user