Make overrides work in Soong
This change adds `overrides` property to all module types. It is used to prevent another module (or modules) from being installed or packaged. Bug: 330141242 Test: go test ./... Change-Id: I4f05c603f0c5dbb699d00327882c7498472b59de
This commit is contained in:
@@ -28,6 +28,7 @@ type componentTestModule struct {
|
||||
props struct {
|
||||
Deps []string
|
||||
Skip_install *bool
|
||||
Overrides []string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,3 +651,64 @@ func TestPrefer32Deps(t *testing.T) {
|
||||
runPackagingTest(t, config, bp, tc.expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOverrides(t *testing.T) {
|
||||
bpTemplate := `
|
||||
component {
|
||||
name: "foo",
|
||||
deps: ["bar"],
|
||||
}
|
||||
|
||||
component {
|
||||
name: "bar",
|
||||
}
|
||||
|
||||
component {
|
||||
name: "bar_override",
|
||||
overrides: ["bar"],
|
||||
}
|
||||
|
||||
component {
|
||||
name: "baz",
|
||||
deps: ["bar_override"],
|
||||
}
|
||||
|
||||
package_module {
|
||||
name: "package",
|
||||
deps: %DEPS%,
|
||||
}
|
||||
`
|
||||
testcases := []struct {
|
||||
deps []string
|
||||
expected []string
|
||||
}{
|
||||
{
|
||||
deps: []string{"foo"},
|
||||
expected: []string{"lib64/foo", "lib64/bar"},
|
||||
},
|
||||
{
|
||||
deps: []string{"foo", "bar_override"},
|
||||
expected: []string{"lib64/foo", "lib64/bar_override"},
|
||||
},
|
||||
{
|
||||
deps: []string{"foo", "bar", "bar_override"},
|
||||
expected: []string{"lib64/foo", "lib64/bar_override"},
|
||||
},
|
||||
{
|
||||
deps: []string{"bar", "bar_override"},
|
||||
expected: []string{"lib64/bar_override"},
|
||||
},
|
||||
{
|
||||
deps: []string{"foo", "baz"},
|
||||
expected: []string{"lib64/foo", "lib64/baz", "lib64/bar_override"},
|
||||
},
|
||||
}
|
||||
for _, tc := range testcases {
|
||||
config := testConfig{
|
||||
multiTarget: true,
|
||||
depsCollectFirstTargetOnly: false,
|
||||
}
|
||||
bp := strings.Replace(bpTemplate, "%DEPS%", `["`+strings.Join(tc.deps, `", "`)+`"]`, -1)
|
||||
runPackagingTest(t, config, bp, tc.expected)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user