non-adjacent AIDL filegroup bp2build test java

Add test to ensure that filegroups from other packages are correctly
added as dependencies for java_library. Test copied from aosp/2183478.

Test: go test ./bp2build
Change-Id: Ie39b7182f544fa196870fb7311817e6b6e68817b
This commit is contained in:
Sam Delmerico
2022-08-25 13:51:21 -04:00
parent 1fa2672be9
commit 7c72137338

View File

@@ -501,3 +501,36 @@ java_library {
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
})
}
func TestJavaLibraryAidlNonAdjacentAidlFilegroup(t *testing.T) {
runJavaLibraryTestCaseWithRegistrationCtxFunc(t, Bp2buildTestCase{
Description: "java_library with non adjacent aidl filegroup",
ModuleTypeUnderTest: "java_library",
ModuleTypeUnderTestFactory: java.LibraryFactory,
Filesystem: map[string]string{
"path/to/A/Android.bp": `
filegroup {
name: "A_aidl",
srcs: ["aidl/A.aidl"],
path: "aidl",
}`,
},
Blueprint: `
java_library {
name: "foo",
srcs: [
":A_aidl",
],
}`,
ExpectedBazelTargets: []string{
makeBazelTarget("java_aidl_library", "foo_java_aidl_library", AttrNameToString{
"deps": `["//path/to/A:A_aidl"]`,
}),
makeBazelTarget("java_library", "foo", AttrNameToString{
"exports": `[":foo_java_aidl_library"]`,
}),
},
}, func(ctx android.RegistrationContext) {
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
})
}