diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/androidmk.go | 3 | ||||
-rw-r--r-- | android/module.go | 14 | ||||
-rw-r--r-- | android/module_context.go | 6 | ||||
-rw-r--r-- | android/soongconfig/modules.go | 13 | ||||
-rw-r--r-- | android/testing.go | 4 |
5 files changed, 25 insertions, 15 deletions
diff --git a/android/androidmk.go b/android/androidmk.go index 66f42f97c..9699ce5b8 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -499,6 +499,7 @@ type fillInEntriesContext interface { Config() Config moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) ModuleType(module blueprint.Module) string + OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) } func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) { @@ -514,7 +515,7 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint if a.Include == "" { a.Include = "$(BUILD_PREBUILT)" } - a.Required = append(a.Required, amod.RequiredModuleNames()...) + a.Required = append(a.Required, amod.RequiredModuleNames(ctx)...) a.Host_required = append(a.Host_required, amod.HostRequiredModuleNames()...) a.Target_required = append(a.Target_required, amod.TargetRequiredModuleNames()...) diff --git a/android/module.go b/android/module.go index dc585d295..d629aa5a6 100644 --- a/android/module.go +++ b/android/module.go @@ -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) } diff --git a/android/module_context.go b/android/module_context.go index 591e270f0..e2677a4f6 100644 --- a/android/module_context.go +++ b/android/module_context.go @@ -183,7 +183,7 @@ type ModuleContext interface { InstallInVendor() bool InstallForceOS() (*OsType, *ArchType) - RequiredModuleNames() []string + RequiredModuleNames(ctx ConfigAndErrorContext) []string HostRequiredModuleNames() []string TargetRequiredModuleNames() []string @@ -755,8 +755,8 @@ func (m *moduleContext) ExpandOptionalSource(srcFile *string, _ string) Optional return OptionalPath{} } -func (m *moduleContext) RequiredModuleNames() []string { - return m.module.RequiredModuleNames() +func (m *moduleContext) RequiredModuleNames(ctx ConfigAndErrorContext) []string { + return m.module.RequiredModuleNames(ctx) } func (m *moduleContext) HostRequiredModuleNames() []string { diff --git a/android/soongconfig/modules.go b/android/soongconfig/modules.go index 87af774fd..f6046d00c 100644 --- a/android/soongconfig/modules.go +++ b/android/soongconfig/modules.go @@ -824,11 +824,16 @@ func (s *listVariable) printfIntoPropertyRecursive(fieldName []string, propStruc } field.Set(newField) case reflect.Struct: - fieldName = append(fieldName, propStruct.Type().Field(i).Name) - if err := s.printfIntoPropertyRecursive(fieldName, field, configValues); err != nil { - return err + if proptools.IsConfigurable(field.Type()) { + fieldName = append(fieldName, propStruct.Type().Field(i).Name) + return fmt.Errorf("soong_config_variables.%s.%s: list variables are not supported on configurable properties", s.variable, strings.Join(fieldName, ".")) + } else { + fieldName = append(fieldName, propStruct.Type().Field(i).Name) + if err := s.printfIntoPropertyRecursive(fieldName, field, configValues); err != nil { + return err + } + fieldName = fieldName[:len(fieldName)-1] } - fieldName = fieldName[:len(fieldName)-1] default: fieldName = append(fieldName, propStruct.Type().Field(i).Name) return fmt.Errorf("soong_config_variables.%s.%s: unsupported property type %q", s.variable, strings.Join(fieldName, "."), kind) diff --git a/android/testing.go b/android/testing.go index 6fb2997cb..8dd467dce 100644 --- a/android/testing.go +++ b/android/testing.go @@ -224,6 +224,10 @@ func (ctx *TestContext) OtherModuleProviderAdaptor() OtherModuleProviderContext }) } +func (ctx *TestContext) OtherModulePropertyErrorf(module Module, property string, fmt_ string, args ...interface{}) { + panic(fmt.Sprintf(fmt_, args...)) +} + // registeredComponentOrder defines the order in which a sortableComponent type is registered at // runtime and provides support for reordering the components registered for a test in the same // way. |