Remove fdoProfileMutator
Add the dependency on the fdo_profile module in afdoTransitionMutator and read the provider in GenerateAndroidBuildActions. This relands Ied8fd7b52d5694a3691652318e87b8fe14dda126 with a fix to use the correct LTO ldflag when an afdo variant doesn't have a profile. Bug: 319288033 Bug: 324141705 Test: afdo_test.go Change-Id: I024ca316cfb565b5fb0251793f05a54ce16cc1cb
This commit is contained in:
@@ -43,23 +43,10 @@ type FdoProfileInfo struct {
|
||||
}
|
||||
|
||||
// FdoProfileProvider is used to provide path to an fdo profile
|
||||
var FdoProfileProvider = blueprint.NewMutatorProvider[FdoProfileInfo]("fdo_profile")
|
||||
|
||||
// FdoProfileMutatorInterface is the interface implemented by fdo_profile module type
|
||||
// module types that can depend on an fdo_profile module
|
||||
type FdoProfileMutatorInterface interface {
|
||||
// FdoProfileMutator eithers set or get FdoProfileProvider
|
||||
fdoProfileMutator(ctx android.BottomUpMutatorContext)
|
||||
}
|
||||
|
||||
var _ FdoProfileMutatorInterface = (*fdoProfile)(nil)
|
||||
var FdoProfileProvider = blueprint.NewProvider[FdoProfileInfo]()
|
||||
|
||||
// GenerateAndroidBuildActions of fdo_profile does not have any build actions
|
||||
func (fp *fdoProfile) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
|
||||
|
||||
// FdoProfileMutator sets FdoProfileProvider to fdo_profile module
|
||||
// or sets afdo.Properties.FdoProfilePath to path in FdoProfileProvider of the depended fdo_profile
|
||||
func (fp *fdoProfile) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
|
||||
func (fp *fdoProfile) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
if fp.properties.Profile != nil {
|
||||
path := android.PathForModuleSrc(ctx, *fp.properties.Profile)
|
||||
android.SetProvider(ctx, FdoProfileProvider, FdoProfileInfo{
|
||||
@@ -68,14 +55,6 @@ func (fp *fdoProfile) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
// fdoProfileMutator calls the generic fdoProfileMutator function of fdoProfileMutator
|
||||
// which is implemented by cc and cc.FdoProfile
|
||||
func fdoProfileMutator(ctx android.BottomUpMutatorContext) {
|
||||
if f, ok := ctx.Module().(FdoProfileMutatorInterface); ok {
|
||||
f.fdoProfileMutator(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
func FdoProfileFactory() android.Module {
|
||||
m := &fdoProfile{}
|
||||
m.AddProperties(&m.properties)
|
||||
|
Reference in New Issue
Block a user