From 7c72137338c606a1dcea0aa8578be938a15f1b8b Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Thu, 25 Aug 2022 13:51:21 -0400 Subject: [PATCH] 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 --- bp2build/java_library_conversion_test.go | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go index f5a59382c..b57cf355b 100644 --- a/bp2build/java_library_conversion_test.go +++ b/bp2build/java_library_conversion_test.go @@ -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) + }) +}