Reimplement afdo support for rust

Ignore-AOSP-First: The parent CL is internal
Bug: 267229065
Test: go test
Change-Id: Ia14679285b92f3f14ff269392a61f978c71311b2
Merged-In: Ia14679285b92f3f14ff269392a61f978c71311b2
This commit is contained in:
Vinh Tran
2023-03-09 22:07:19 -05:00
parent 44cb78c988
commit cde1016aff
7 changed files with 102 additions and 69 deletions

View File

@@ -50,7 +50,7 @@ var FdoProfileProvider = blueprint.NewMutatorProvider(FdoProfileInfo{}, "fdo_pro
// module types that can depend on an fdo_profile module
type FdoProfileMutatorInterface interface {
// FdoProfileMutator eithers set or get FdoProfileProvider
FdoProfileMutator(ctx android.BottomUpMutatorContext)
fdoProfileMutator(ctx android.BottomUpMutatorContext)
}
var _ FdoProfileMutatorInterface = (*fdoProfile)(nil)
@@ -60,7 +60,7 @@ 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) fdoProfileMutator(ctx android.BottomUpMutatorContext) {
if fp.properties.Profile != nil {
path := android.PathForModuleSrc(ctx, *fp.properties.Profile)
ctx.SetProvider(FdoProfileProvider, FdoProfileInfo{
@@ -69,11 +69,11 @@ func (fp *fdoProfile) FdoProfileMutator(ctx android.BottomUpMutatorContext) {
}
}
// fdoProfileMutator calls the generic FdoProfileMutator function of FdoProfileMutator
// 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)
f.fdoProfileMutator(ctx)
}
}