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
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index f5a5938..b57cf35 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -501,3 +501,36 @@
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)
+ })
+}