Merge changes from topic "variational-required" am: d7b95f94a1 am: e3c9611b24

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739833

Change-Id: I00420ba0a1409254125935e8c1a4c3610fa44536
This commit is contained in:
Yi-Yo Chiang 2021-07-30 18:35:25 +00:00 committed by Automerger Merge Worker
commit e2027b2526
2 changed files with 33 additions and 3 deletions

View file

@ -486,9 +486,9 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
if a.Include == "" {
a.Include = "$(BUILD_PREBUILT)"
}
a.Required = append(a.Required, amod.commonProperties.Required...)
a.Host_required = append(a.Host_required, amod.commonProperties.Host_required...)
a.Target_required = append(a.Target_required, amod.commonProperties.Target_required...)
a.Required = append(a.Required, mod.(Module).RequiredModuleNames()...)
a.Host_required = append(a.Host_required, mod.(Module).HostRequiredModuleNames()...)
a.Target_required = append(a.Target_required, mod.(Module).TargetRequiredModuleNames()...)
for _, distString := range a.GetDistForGoals(mod) {
fmt.Fprintf(&a.header, distString)

View file

@ -354,6 +354,24 @@ type BaseProperties struct {
// can depend on libraries that are not exported by the APEXes and use private symbols
// from the exported libraries.
Test_for []string `android:"arch_variant"`
Target struct {
Platform struct {
// List of modules required by the core variant.
Required []string `android:"arch_variant"`
// List of modules not required by the core variant.
Exclude_required []string `android:"arch_variant"`
} `android:"arch_variant"`
Recovery struct {
// List of modules required by the recovery variant.
Required []string `android:"arch_variant"`
// List of modules not required by the recovery variant.
Exclude_required []string `android:"arch_variant"`
} `android:"arch_variant"`
} `android:"arch_variant"`
}
type VendorProperties struct {
@ -865,6 +883,18 @@ func (c *Module) HiddenFromMake() bool {
return c.Properties.HideFromMake
}
func (c *Module) RequiredModuleNames() []string {
required := android.CopyOf(c.ModuleBase.RequiredModuleNames())
if c.ImageVariation().Variation == android.CoreVariation {
required = append(required, c.Properties.Target.Platform.Required...)
required = removeListFromList(required, c.Properties.Target.Platform.Exclude_required)
} else if c.InRecovery() {
required = append(required, c.Properties.Target.Recovery.Required...)
required = removeListFromList(required, c.Properties.Target.Recovery.Exclude_required)
}
return android.FirstUniqueStrings(required)
}
func (c *Module) Toc() android.OptionalPath {
if c.linker != nil {
if library, ok := c.linker.(libraryInterface); ok {