Bp2build for android_app minsdkversion property

Bug: 249265719
Test: go test ./bp2build
Test: insepcted generated build files
Change-Id: I02ed54a9fdcc88d98439e0a61626a0afc1fce639
This commit is contained in:
Alix
2023-01-31 19:38:41 +00:00
parent 9ac38d7e4e
commit e5085ebbc1
3 changed files with 67 additions and 0 deletions

View File

@@ -344,3 +344,50 @@ android_app {
}),
}})
}
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",
}`,
}),
}})
}