Always drop deps from android_library with no srcs
android_library does not accept deps when there are no srcs because
there is no compilation happening. The libs of android_library module
are unnecessary as deps on the android_library since they aren't
being propagated to any dependencies.
So we can drop deps here.
Test: the updated test case and CI
Bug: 302290600
Change-Id: Ib43a1c273a5f3b3e0aa6f29f4e8569ad3487e451
diff --git a/bp2build/aar_conversion_test.go b/bp2build/aar_conversion_test.go
index 0ca5c4e..57c38db 100644
--- a/bp2build/aar_conversion_test.go
+++ b/bp2build/aar_conversion_test.go
@@ -86,7 +86,7 @@
func TestConvertAndroidLibraryWithNoSources(t *testing.T) {
t.Helper()
RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{
- Description: "Android Library - modules with deps must have sources",
+ Description: "Android Library - modules will deps when there are no sources",
ModuleTypeUnderTest: "android_library",
ModuleTypeUnderTestFactory: java.AndroidLibraryFactory,
Filesystem: map[string]string{
@@ -102,7 +102,18 @@
sdk_version: "current",
}
`,
- ExpectedBazelTargets: []string{},
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget(
+ "android_library",
+ "TestLib",
+ AttrNameToString{
+ "manifest": `"AndroidManifest.xml"`,
+ "resource_files": `["res/res.png"]`,
+ "sdk_version": `"current"`, // use as default
+ },
+ ),
+ MakeNeverlinkDuplicateTarget("android_library", "TestLib"),
+ },
})
}