Loading android/defaults.go +5 −4 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ type defaultsDependencyTag struct { var DefaultsDepTag defaultsDependencyTag type defaultsProperties struct { Defaults []string Defaults proptools.Configurable[[]string] } type DefaultableModuleBase struct { Loading Loading @@ -278,13 +278,14 @@ func RegisterDefaultsPreArchMutators(ctx RegisterMutatorsContext) { func defaultsDepsMutator(ctx BottomUpMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok { ctx.AddDependency(ctx.Module(), DefaultsDepTag, defaultable.defaults().Defaults...) ctx.AddDependency(ctx.Module(), DefaultsDepTag, defaultable.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)...) } } func defaultsMutator(ctx TopDownMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok { if len(defaultable.defaults().Defaults) > 0 { defaults := defaultable.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil) if len(defaults) > 0 { var defaultsList []Defaults seen := make(map[Defaults]bool) Loading @@ -294,7 +295,7 @@ func defaultsMutator(ctx TopDownMutatorContext) { if !seen[defaults] { seen[defaults] = true defaultsList = append(defaultsList, defaults) return len(defaults.defaults().Defaults) > 0 return len(defaults.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)) > 0 } } else { ctx.PropertyErrorf("defaults", "module %s is not an defaults module", Loading android/module_test.go +0 −2 Original line number Diff line number Diff line Loading @@ -722,7 +722,6 @@ test { propInfo{Name: "Arch.X86_64.A", Type: "string", Value: "x86_64 a"}, propInfo{Name: "B", Type: "bool", Value: "true"}, propInfo{Name: "C", Type: "string slice", Values: []string{"default_c", "c"}}, propInfo{Name: "Defaults", Type: "string slice", Values: []string{"foo_defaults"}}, propInfo{Name: "Embedded_prop", Type: "string", Value: "a"}, propInfo{Name: "Name", Type: "string", Value: "foo"}, propInfo{Name: "Nested.E", Type: "string", Value: "nested e"}, Loading @@ -746,7 +745,6 @@ test { foo := result.ModuleForTests("foo", "").Module().base() AssertDeepEquals(t, "foo ", tc.expectedProps, foo.propertiesWithValues()) }) } } Loading Loading
android/defaults.go +5 −4 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ type defaultsDependencyTag struct { var DefaultsDepTag defaultsDependencyTag type defaultsProperties struct { Defaults []string Defaults proptools.Configurable[[]string] } type DefaultableModuleBase struct { Loading Loading @@ -278,13 +278,14 @@ func RegisterDefaultsPreArchMutators(ctx RegisterMutatorsContext) { func defaultsDepsMutator(ctx BottomUpMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok { ctx.AddDependency(ctx.Module(), DefaultsDepTag, defaultable.defaults().Defaults...) ctx.AddDependency(ctx.Module(), DefaultsDepTag, defaultable.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)...) } } func defaultsMutator(ctx TopDownMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok { if len(defaultable.defaults().Defaults) > 0 { defaults := defaultable.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil) if len(defaults) > 0 { var defaultsList []Defaults seen := make(map[Defaults]bool) Loading @@ -294,7 +295,7 @@ func defaultsMutator(ctx TopDownMutatorContext) { if !seen[defaults] { seen[defaults] = true defaultsList = append(defaultsList, defaults) return len(defaults.defaults().Defaults) > 0 return len(defaults.defaults().Defaults.GetOrDefault(ctx.Module().ConfigurableEvaluator(ctx), nil)) > 0 } } else { ctx.PropertyErrorf("defaults", "module %s is not an defaults module", Loading
android/module_test.go +0 −2 Original line number Diff line number Diff line Loading @@ -722,7 +722,6 @@ test { propInfo{Name: "Arch.X86_64.A", Type: "string", Value: "x86_64 a"}, propInfo{Name: "B", Type: "bool", Value: "true"}, propInfo{Name: "C", Type: "string slice", Values: []string{"default_c", "c"}}, propInfo{Name: "Defaults", Type: "string slice", Values: []string{"foo_defaults"}}, propInfo{Name: "Embedded_prop", Type: "string", Value: "a"}, propInfo{Name: "Name", Type: "string", Value: "foo"}, propInfo{Name: "Nested.E", Type: "string", Value: "nested e"}, Loading @@ -746,7 +745,6 @@ test { foo := result.ModuleForTests("foo", "").Module().base() AssertDeepEquals(t, "foo ", tc.expectedProps, foo.propertiesWithValues()) }) } } Loading