Merge "Don't add dependencies on modules referenced in unused arch variants"
This commit is contained in:
@@ -383,6 +383,7 @@ func InitAndroidModule(m Module) {
|
|||||||
&base.nameProperties,
|
&base.nameProperties,
|
||||||
&base.commonProperties,
|
&base.commonProperties,
|
||||||
&base.variableProperties)
|
&base.variableProperties)
|
||||||
|
base.generalProperties = m.GetProperties()
|
||||||
base.customizableProperties = m.GetProperties()
|
base.customizableProperties = m.GetProperties()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ func pathDepsMutator(ctx BottomUpMutatorContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
props := m.base().customizableProperties
|
props := m.base().generalProperties
|
||||||
|
|
||||||
for _, ps := range props {
|
for _, ps := range props {
|
||||||
pathProperties := pathPropertiesForPropertyStruct(ctx, ps)
|
pathProperties := pathPropertiesForPropertyStruct(ctx, ps)
|
||||||
|
@@ -25,7 +25,7 @@ type pathDepsMutatorTestModule struct {
|
|||||||
ModuleBase
|
ModuleBase
|
||||||
props struct {
|
props struct {
|
||||||
Foo string `android:"path"`
|
Foo string `android:"path"`
|
||||||
Bar []string `android:"path"`
|
Bar []string `android:"path,arch_variant"`
|
||||||
Baz *string `android:"path"`
|
Baz *string `android:"path"`
|
||||||
Qux string
|
Qux string
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ type pathDepsMutatorTestModule struct {
|
|||||||
func pathDepsMutatorTestModuleFactory() Module {
|
func pathDepsMutatorTestModuleFactory() Module {
|
||||||
module := &pathDepsMutatorTestModule{}
|
module := &pathDepsMutatorTestModule{}
|
||||||
module.AddProperties(&module.props)
|
module.AddProperties(&module.props)
|
||||||
InitAndroidModule(module)
|
InitAndroidArchModule(module, DeviceSupported, MultilibBoth)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +64,23 @@ func TestPathDepsMutator(t *testing.T) {
|
|||||||
}`,
|
}`,
|
||||||
deps: []string{"a", "b", "c"},
|
deps: []string{"a", "b", "c"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "arch variant",
|
||||||
|
bp: `
|
||||||
|
test {
|
||||||
|
name: "foo",
|
||||||
|
arch: {
|
||||||
|
arm64: {
|
||||||
|
bar: [":a"],
|
||||||
|
},
|
||||||
|
arm: {
|
||||||
|
bar: [":b"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bar: [":c"],
|
||||||
|
}`,
|
||||||
|
deps: []string{"c", "a"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
buildDir, err := ioutil.TempDir("", "soong_path_properties_test")
|
buildDir, err := ioutil.TempDir("", "soong_path_properties_test")
|
||||||
@@ -74,8 +91,8 @@ func TestPathDepsMutator(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
config := TestConfig(buildDir, nil)
|
config := TestArchConfig(buildDir, nil)
|
||||||
ctx := NewTestContext()
|
ctx := NewTestArchContext()
|
||||||
|
|
||||||
ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathDepsMutatorTestModuleFactory))
|
ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathDepsMutatorTestModuleFactory))
|
||||||
ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory))
|
ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory))
|
||||||
@@ -110,7 +127,7 @@ func TestPathDepsMutator(t *testing.T) {
|
|||||||
_, errs = ctx.PrepareBuildActions(config)
|
_, errs = ctx.PrepareBuildActions(config)
|
||||||
FailIfErrored(t, errs)
|
FailIfErrored(t, errs)
|
||||||
|
|
||||||
m := ctx.ModuleForTests("foo", "").Module().(*pathDepsMutatorTestModule)
|
m := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*pathDepsMutatorTestModule)
|
||||||
|
|
||||||
if g, w := m.sourceDeps, test.deps; !reflect.DeepEqual(g, w) {
|
if g, w := m.sourceDeps, test.deps; !reflect.DeepEqual(g, w) {
|
||||||
t.Errorf("want deps %q, got %q", w, g)
|
t.Errorf("want deps %q, got %q", w, g)
|
||||||
|
Reference in New Issue
Block a user