bp2build converts java_version property to javacopts attribute

This CL also converts `external/rappor` (which already set `java_version` to `1.7`) to be bazelable to testify the changes.

Results from `b build //external/rappor && cat bazel-bin/external/rappor/librappor.jar-0.params`: https://paste.googleplex.com/5518725462622208.

Test: go test ./bp2build/...
Bug: 227618664
Change-Id: I8d370d4639f70fba51e6de6ceb7bcb5ace9ccd91
This commit is contained in:
Vinh Tran
2022-04-22 19:09:58 -04:00
parent 184a6b87e5
commit 3ac6daf47c
8 changed files with 40 additions and 4 deletions

View File

@@ -158,6 +158,22 @@ java_plugin {
})
}
func TestJavaLibraryJavaVersion(t *testing.T) {
runJavaLibraryTestCase(t, bp2buildTestCase{
blueprint: `java_library {
name: "java-lib-1",
srcs: ["a.java"],
java_version: "11",
}`,
expectedBazelTargets: []string{
makeBazelTarget("java_library", "java-lib-1", attrNameToString{
"srcs": `["a.java"]`,
"javacopts": `["-source 11 -target 11"]`,
}),
},
})
}
func TestJavaLibraryErrorproneJavacflagsEnabledManually(t *testing.T) {
runJavaLibraryTestCase(t, bp2buildTestCase{
blueprint: `java_library {