Make required a configurable property
So that users can use select statements with it. Fixes: 347605145 Bug: 342006386 Test: m nothing --no-skip-soong-tests Change-Id: Ica0ca6d1725b000b3748c0293e5a9f9b38ed87f9
This commit is contained in:
@@ -113,7 +113,7 @@ type Module interface {
|
||||
// Get information about the properties that can contain visibility rules.
|
||||
visibilityProperties() []visibilityProperty
|
||||
|
||||
RequiredModuleNames() []string
|
||||
RequiredModuleNames(ctx ConfigAndErrorContext) []string
|
||||
HostRequiredModuleNames() []string
|
||||
TargetRequiredModuleNames() []string
|
||||
|
||||
@@ -422,7 +422,7 @@ type commonProperties struct {
|
||||
Vintf_fragments []string `android:"path"`
|
||||
|
||||
// names of other modules to install if this module is installed
|
||||
Required []string `android:"arch_variant"`
|
||||
Required proptools.Configurable[[]string] `android:"arch_variant"`
|
||||
|
||||
// names of other modules to install on host if this module is installed
|
||||
Host_required []string `android:"arch_variant"`
|
||||
@@ -1101,7 +1101,7 @@ func addRequiredDeps(ctx BottomUpMutatorContext) {
|
||||
hostTargets = append(hostTargets, ctx.Config().BuildOSCommonTarget)
|
||||
|
||||
if ctx.Device() {
|
||||
for _, depName := range ctx.Module().RequiredModuleNames() {
|
||||
for _, depName := range ctx.Module().RequiredModuleNames(ctx) {
|
||||
for _, target := range deviceTargets {
|
||||
addDep(target, depName)
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ func addRequiredDeps(ctx BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
if ctx.Host() {
|
||||
for _, depName := range ctx.Module().RequiredModuleNames() {
|
||||
for _, depName := range ctx.Module().RequiredModuleNames(ctx) {
|
||||
for _, target := range hostTargets {
|
||||
// When a host module requires another host module, don't make a
|
||||
// dependency if they have different OSes (i.e. hostcross).
|
||||
@@ -1619,8 +1619,8 @@ func (m *ModuleBase) InRecovery() bool {
|
||||
return m.base().commonProperties.ImageVariation == RecoveryVariation
|
||||
}
|
||||
|
||||
func (m *ModuleBase) RequiredModuleNames() []string {
|
||||
return m.base().commonProperties.Required
|
||||
func (m *ModuleBase) RequiredModuleNames(ctx ConfigAndErrorContext) []string {
|
||||
return m.base().commonProperties.Required.GetOrDefault(m.ConfigurableEvaluator(ctx), nil)
|
||||
}
|
||||
|
||||
func (m *ModuleBase) HostRequiredModuleNames() []string {
|
||||
@@ -1992,7 +1992,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
TargetDependencies: targetRequired,
|
||||
HostDependencies: hostRequired,
|
||||
Data: data,
|
||||
Required: m.RequiredModuleNames(),
|
||||
Required: m.RequiredModuleNames(ctx),
|
||||
}
|
||||
SetProvider(ctx, ModuleInfoJSONProvider, m.moduleInfoJSON)
|
||||
}
|
||||
|
Reference in New Issue
Block a user