Bp2build for android_app minsdkversion property
Bug: 249265719
Test: go test ./bp2build
Test: insepcted generated build files
Change-Id: I02ed54a9fdcc88d98439e0a61626a0afc1fce639
diff --git a/bp2build/android_app_conversion_test.go b/bp2build/android_app_conversion_test.go
index 03b3d2b..ef3f124 100644
--- a/bp2build/android_app_conversion_test.go
+++ b/bp2build/android_app_conversion_test.go
@@ -344,3 +344,50 @@
}),
}})
}
+
+func TestAndroidAppMinSdkProvided(t *testing.T) {
+ runAndroidAppTestCase(t, Bp2buildTestCase{
+ Description: "Android app with value for min_sdk_version",
+ ModuleTypeUnderTest: "android_app",
+ ModuleTypeUnderTestFactory: java.AndroidAppFactory,
+ Filesystem: map[string]string{},
+ Blueprint: simpleModuleDoNotConvertBp2build("filegroup", "foocert") + `
+android_app {
+ name: "foo",
+ sdk_version: "current",
+ min_sdk_version: "24",
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("android_binary", "foo", AttrNameToString{
+ "manifest": `"AndroidManifest.xml"`,
+ "resource_files": `[]`,
+ "manifest_values": `{
+ "minSdkVersion": "24",
+ }`,
+ }),
+ }})
+}
+
+func TestAndroidAppMinSdkDefaultToSdkVersion(t *testing.T) {
+ runAndroidAppTestCase(t, Bp2buildTestCase{
+ Description: "Android app with value for sdk_version",
+ ModuleTypeUnderTest: "android_app",
+ ModuleTypeUnderTestFactory: java.AndroidAppFactory,
+ Filesystem: map[string]string{},
+ Blueprint: simpleModuleDoNotConvertBp2build("filegroup", "foocert") + `
+android_app {
+ name: "foo",
+ sdk_version: "30",
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("android_binary", "foo", AttrNameToString{
+ "manifest": `"AndroidManifest.xml"`,
+ "resource_files": `[]`,
+ "manifest_values": `{
+ "minSdkVersion": "30",
+ }`,
+ }),
+ }})
+}