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
This commit is contained in:
Alix
2022-11-14 21:38:07 +00:00
parent 877336cc3a
commit 8062f4dee7
6 changed files with 99 additions and 17 deletions

View File

@@ -649,3 +649,46 @@ android_library {
}),
}})
}
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"]`,
}),
},
})
}