Arch-specific source for prebuilt_apex
Arch-specific source can be specified for prebuilt_apex as follows.
arch: {
arm64: {
src: "myapex-arm64.apex",
},
},
A note on the implementation. The Src property was not tagged as
`android:"arch_variant"` as usual. Instead, multiple Src properties are
explicitly declared like
struct Arch {
struct Arm {
struct Src *string
}
...
}
Corresponding Src property is manually selected according to the
MultiTargets()[0].
This is because prebuilt_apex is mutated only for android_common, in
order to have the same arch variant with the apex module type.
Therefore, we can't rely on the arch_variant tag.
Bug: 127789981
Test: m (apex_test amended)
Change-Id: I77dbe626171d8975f549bdb4af3c487232cf05f7
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 2d9cca6..1e8d5b4 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -171,7 +171,8 @@
"custom_notice": nil,
"testkey2.avbpubkey": nil,
"testkey2.pem": nil,
- "myapex.apex": nil,
+ "myapex-arm64.apex": nil,
+ "myapex-arm.apex": nil,
})
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
android.FailIfErrored(t, errs)
@@ -1243,7 +1244,14 @@
ctx := testApex(t, `
prebuilt_apex {
name: "myapex",
- src: "myapex.apex",
+ arch: {
+ arm64: {
+ src: "myapex-arm64.apex",
+ },
+ arm: {
+ src: "myapex-arm.apex",
+ },
+ },
key: "myapex.key"
}
@@ -1257,6 +1265,11 @@
prebuilt := ctx.ModuleForTests("myapex", "android_common").Module().(*Prebuilt)
+ expectedInput := "myapex-arm64.apex"
+ if prebuilt.inputApex.String() != expectedInput {
+ t.Errorf("inputApex invalid. expected: %q, actual: %q", expectedInput, prebuilt.inputApex.String())
+ }
+
// Check if the key module is added as a required module.
buf := &bytes.Buffer{}
prebuilt.AndroidMk().Extra[0](buf, nil)