convert java_import jars with arch variants

Bug: 220168131
Test: go test ./bp2build -run TestJavaImport
Test: b build '...'
Change-Id: Ib485e6905e7be9d199af5295b23131c226fd6e96
This commit is contained in:
Sam Delmerico
2022-02-22 21:41:33 +00:00
parent 76ff96f885
commit 489831660c
3 changed files with 47 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ func runJavaImportTestCase(t *testing.T, tc bp2buildTestCase) {
func registerJavaImportModuleTypes(ctx android.RegistrationContext) {
}
func TestMinimalJavaImport(t *testing.T) {
func TestJavaImportMinimal(t *testing.T) {
runJavaImportTestCase(t, bp2buildTestCase{
description: "Java import - simple example",
moduleTypeUnderTest: "java_import",
@@ -50,3 +50,36 @@ java_import {
}),
}})
}
func TestJavaImportArchVariant(t *testing.T) {
runJavaImportTestCase(t, bp2buildTestCase{
description: "Java import - simple example",
moduleTypeUnderTest: "java_import",
moduleTypeUnderTestFactory: java.ImportFactory,
filesystem: map[string]string{
"import.jar": "",
},
blueprint: `
java_import {
name: "example_import",
target: {
android: {
jars: ["android.jar"],
},
linux_glibc: {
jars: ["linux.jar"],
},
},
bazel_module: { bp2build_available: true },
}
`,
expectedBazelTargets: []string{
makeBazelTarget("java_import", "example_import", attrNameToString{
"jars": `select({
"//build/bazel/platforms/os:android": ["android.jar"],
"//build/bazel/platforms/os:linux": ["linux.jar"],
"//conditions:default": [],
})`,
}),
}})
}