Convert AFDO mutators to TransitionMutator

Convert afdoDepsMutator and afdoMutator to a TransitionMutator as a
step towards variants-on-demand.

Bug: 319288033
Test: afdo_test.go
Change-Id: Ib05845455ccf43a07b3915a0d7b0a95896062f13
This commit is contained in:
Colin Cross
2024-01-23 16:38:06 -08:00
parent 33e0c81093
commit a6b407fbf5
5 changed files with 87 additions and 117 deletions

View File

@@ -1462,18 +1462,18 @@ func (c *deviceConfig) PgoAdditionalProfileDirs() []string {
}
// AfdoProfile returns fully qualified path associated to the given module name
func (c *deviceConfig) AfdoProfile(name string) (*string, error) {
func (c *deviceConfig) AfdoProfile(name string) (string, error) {
for _, afdoProfile := range c.config.productVariables.AfdoProfiles {
split := strings.Split(afdoProfile, ":")
if len(split) != 3 {
return nil, fmt.Errorf("AFDO_PROFILES has invalid value: %s. "+
return "", fmt.Errorf("AFDO_PROFILES has invalid value: %s. "+
"The expected format is <module>:<fully-qualified-path-to-fdo_profile>", afdoProfile)
}
if split[0] == name {
return proptools.StringPtr(strings.Join([]string{split[1], split[2]}, ":")), nil
return strings.Join([]string{split[1], split[2]}, ":"), nil
}
}
return nil, nil
return "", nil
}
func (c *deviceConfig) VendorSepolicyDirs() []string {