Make new module creation API more flexible am: 3a4eb50829 am: 2e7885ea18

Change-Id: I250e0cfdfdcdc632f58b2b24149c17f5721535f9
This commit is contained in:
Paul Duffin
2020-03-23 11:21:52 +00:00
committed by Automerger Merge Worker
5 changed files with 77 additions and 49 deletions

View File

@@ -63,9 +63,8 @@ func (mt *binarySdkMemberType) IsInstance(module android.Module) bool {
return false
}
func (mt *binarySdkMemberType) AddPrebuiltModule(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) android.BpModule {
pbm := builder.AddPrebuiltModule(member, "cc_prebuilt_binary")
return pbm
func (mt *binarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "cc_prebuilt_binary")
}
func (mt *binarySdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
@@ -107,7 +106,7 @@ type nativeBinaryInfoProperties struct {
SystemSharedLibs []string
}
func (p *nativeBinaryInfoProperties) PopulateFromVariant(variant android.SdkAware) {
func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
ccModule := variant.(*Module)
p.archType = ccModule.Target().Arch.ArchType.String()
@@ -122,11 +121,12 @@ func (p *nativeBinaryInfoProperties) PopulateFromVariant(variant android.SdkAwar
}
}
func (p *nativeBinaryInfoProperties) AddToPropertySet(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, propertySet android.BpPropertySet) {
func (p *nativeBinaryInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
if p.Compile_multilib != "" {
propertySet.AddProperty("compile_multilib", p.Compile_multilib)
}
builder := ctx.SnapshotBuilder()
if p.outputFile != nil {
propertySet.AddProperty("srcs", []string{nativeBinaryPathFor(*p)})

View File

@@ -110,8 +110,8 @@ func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
return false
}
func (mt *librarySdkMemberType) AddPrebuiltModule(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) android.BpModule {
pbm := builder.AddPrebuiltModule(member, mt.prebuiltModuleType)
func (mt *librarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
pbm := ctx.SnapshotBuilder().AddPrebuiltModule(member, mt.prebuiltModuleType)
ccModule := member.Variants()[0].(*Module)
@@ -336,7 +336,7 @@ type nativeLibInfoProperties struct {
outputFile android.Path
}
func (p *nativeLibInfoProperties) PopulateFromVariant(variant android.SdkAware) {
func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
ccModule := variant.(*Module)
// If the library has some link types then it produces an output binary file, otherwise it
@@ -369,6 +369,6 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(variant android.SdkAware)
p.exportedGeneratedHeaders = ccModule.ExportedGeneratedHeaders()
}
func (p *nativeLibInfoProperties) AddToPropertySet(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, propertySet android.BpPropertySet) {
addPossiblyArchSpecificProperties(sdkModuleContext, builder, p, propertySet)
func (p *nativeLibInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
addPossiblyArchSpecificProperties(ctx.SdkModuleContext(), ctx.SnapshotBuilder(), p, propertySet)
}