Implement fdo_profile module type
Introducing fdo_profile module type to reimplement the afdo support in cc moduels. This change allows the feature to be compatible with Bazel migration. How it works: PreDepsMutators: * BeginMutator: If non-static cc modules sets afdo prop, search and add corresponding fdo_profile module as a dep with fdoProfileTag * fdoProfileMutator: * If in fdo_profile module, set FdoProfileProvider with full path to profile * If in cc module, read FdoProfileProvider from dep with fdoProfileTag and set FdoProfileInfo.Path to FdoProfilePath field PostDepsMutators: * afdoDepsMutator: If a module has FdoProfilePath set, walk to its static deps and set itself to the deps' AfdoRdeps * afdoMutator: If a static dep has AfdoRDeps set, create afdo variant. Ignore-AOSP-First: Other CLs in the same topic are internal-only Test: go test Bug: b/267229065 Change-Id: I687d798a02d9743c92804fea36fb4ae3a7a0e5e3 Merged-In: I687d798a02d9743c92804fea36fb4ae3a7a0e5e3
This commit is contained in:
@@ -1418,6 +1418,21 @@ func (c *deviceConfig) PgoAdditionalProfileDirs() []string {
|
||||
return c.config.productVariables.PgoAdditionalProfileDirs
|
||||
}
|
||||
|
||||
// AfdoProfile returns fully qualified path associated to the given module name
|
||||
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. "+
|
||||
"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 nil, nil
|
||||
}
|
||||
|
||||
func (c *deviceConfig) VendorSepolicyDirs() []string {
|
||||
return c.config.productVariables.BoardVendorSepolicyDirs
|
||||
}
|
||||
|
Reference in New Issue
Block a user