Refactor bp2build tests

Moves to specifying attributes as a map, such at it is possible to add
additional attributes conditionally. This is in particular useful once
supporting the `enabled` property which will add
`target_compatible_with`

Test: go test soong tests
Change-Id: Iade8eed1ce3acb1d1712a9ee3119d9ae59675624
This commit is contained in:
Liz Kammer
2021-11-08 12:56:31 -05:00
parent c0d9f8bd5e
commit 78cfdaa597
19 changed files with 1443 additions and 1751 deletions

View File

@@ -113,29 +113,30 @@ apex {
],
}
`,
expectedBazelTargets: []string{`apex(
name = "com.android.apogee",
android_manifest = "ApogeeAndroidManifest.xml",
binaries = [
expectedBazelTargets: []string{
makeBazelTarget("apex", "com.android.apogee", attrNameToString{
"android_manifest": `"ApogeeAndroidManifest.xml"`,
"binaries": `[
"binary_1",
"binary_2",
],
certificate = ":com.android.apogee.certificate",
file_contexts = ":com.android.apogee-file_contexts",
installable = False,
key = ":com.android.apogee.key",
manifest = "apogee_manifest.json",
min_sdk_version = "29",
native_shared_libs = [
]`,
"certificate": `":com.android.apogee.certificate"`,
"file_contexts": `":com.android.apogee-file_contexts"`,
"installable": "False",
"key": `":com.android.apogee.key"`,
"manifest": `"apogee_manifest.json"`,
"min_sdk_version": `"29"`,
"native_shared_libs": `[
":native_shared_lib_1",
":native_shared_lib_2",
],
prebuilts = [
]`,
"prebuilts": `[
":pretend_prebuilt_1",
":pretend_prebuilt_2",
],
updatable = False,
)`}})
]`,
"updatable": "False",
}),
}})
}
func TestApexBundleDefaultPropertyValues(t *testing.T) {
@@ -151,10 +152,10 @@ apex {
manifest: "apogee_manifest.json",
}
`,
expectedBazelTargets: []string{`apex(
name = "com.android.apogee",
manifest = "apogee_manifest.json",
)`}})
expectedBazelTargets: []string{makeBazelTarget("apex", "com.android.apogee", attrNameToString{
"manifest": `"apogee_manifest.json"`,
}),
}})
}
func TestApexBundleHasBazelModuleProps(t *testing.T) {
@@ -171,8 +172,8 @@ apex {
bazel_module: { bp2build_available: true },
}
`,
expectedBazelTargets: []string{`apex(
name = "apogee",
manifest = "manifest.json",
)`}})
expectedBazelTargets: []string{makeBazelTarget("apex", "apogee", attrNameToString{
"manifest": `"manifest.json"`,
}),
}})
}