bp2build for java_library with .kt srcs or common_srcs
java_library modules with .kt srcs or common_srcs will be converted into
module type kt_jvm_library
Test: m bp2build, manually inspected build files for allowlisted modules
Bug: 258688914
Change-Id: I8293a11c8247b4b76358d0991f82c6b61b58adc3
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index 74e2dbd..00056f8 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -649,3 +649,46 @@
}),
}})
}
+
+func TestJavaLibraryKotlinSrcs(t *testing.T) {
+ runJavaLibraryTestCase(t, Bp2buildTestCase{
+ Description: "java_library with kotlin srcs",
+ Blueprint: `java_library {
+ name: "java-lib-1",
+ srcs: ["a.java", "b.java", "c.kt"],
+ bazel_module: { bp2build_available: true },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("kt_jvm_library", "java-lib-1", AttrNameToString{
+ "srcs": `[
+ "a.java",
+ "b.java",
+ "c.kt",
+ ]`,
+ }),
+ },
+ })
+}
+
+func TestJavaLibraryKotlinCommonSrcs(t *testing.T) {
+ runJavaLibraryTestCase(t, Bp2buildTestCase{
+ Description: "java_library with kotlin common_srcs",
+ Blueprint: `java_library {
+ name: "java-lib-1",
+ srcs: ["a.java", "b.java"],
+ common_srcs: ["c.kt"],
+ bazel_module: { bp2build_available: true },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("kt_jvm_library", "java-lib-1", AttrNameToString{
+ "srcs": `[
+ "a.java",
+ "b.java",
+ ]`,
+ "common_srcs": `["c.kt"]`,
+ }),
+ },
+ })
+}