apex_key bp2build: disambiguate module and src deps.
(and remove unused keyName field.) The private_key and public_key props of an apex_key can point to either a module or a string. If it's a module, then respect it. If it's a string, there's additional product variable lookup to find the apex_key files in product_vars's DefaultAppCertificate parent dir. This is similar to android_app_certificate. Test: presubmits Change-Id: Ib258da14cb0c2df8b5f817fcbc46afebcf225db8
This commit is contained in:
@@ -27,11 +27,12 @@ func runApexKeyTestCase(t *testing.T, tc Bp2buildTestCase) {
|
||||
}
|
||||
|
||||
func registerApexKeyModuleTypes(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||
}
|
||||
|
||||
func TestApexKeySimple(t *testing.T) {
|
||||
func TestApexKeySimple_KeysAreSrcFiles(t *testing.T) {
|
||||
runApexKeyTestCase(t, Bp2buildTestCase{
|
||||
Description: "apex key - simple example",
|
||||
Description: "apex key - keys are src files, use key_name attributes",
|
||||
ModuleTypeUnderTest: "apex_key",
|
||||
ModuleTypeUnderTestFactory: apex.ApexKeyFactory,
|
||||
Filesystem: map[string]string{},
|
||||
@@ -43,8 +44,29 @@ apex_key {
|
||||
}
|
||||
`,
|
||||
ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{
|
||||
"private_key": `"com.android.apogee.pem"`,
|
||||
"public_key": `"com.android.apogee.avbpubkey"`,
|
||||
"private_key_name": `"com.android.apogee.pem"`,
|
||||
"public_key_name": `"com.android.apogee.avbpubkey"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
||||
func TestApexKey_KeysAreModules(t *testing.T) {
|
||||
runApexKeyTestCase(t, Bp2buildTestCase{
|
||||
Description: "apex key - keys are modules, use key attributes",
|
||||
ModuleTypeUnderTest: "apex_key",
|
||||
ModuleTypeUnderTestFactory: apex.ApexKeyFactory,
|
||||
Filesystem: map[string]string{},
|
||||
Blueprint: `
|
||||
apex_key {
|
||||
name: "com.android.apogee.key",
|
||||
public_key: ":com.android.apogee.avbpubkey",
|
||||
private_key: ":com.android.apogee.pem",
|
||||
}
|
||||
` + simpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.avbpubkey") +
|
||||
simpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.pem"),
|
||||
ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{
|
||||
"private_key": `":com.android.apogee.pem"`,
|
||||
"public_key": `":com.android.apogee.avbpubkey"`,
|
||||
}),
|
||||
}})
|
||||
}
|
||||
|
Reference in New Issue
Block a user