apex: AndroidMk writes common properties
AndroidMkEntries handles bunch of common properties(e.g. LOCAL_INIT_RC,
LOCAL_VINTF_FRAGMENTS, etc).
However apex defines its own Custom() writer, so those properties should
be handled manually.
For example, when an apex defines "init_rc" properties, the value should
be passed to Make via LOCAL_INIT_RC.
Bug: 159211312
Test: m
Change-Id: I65e7a456486c9f5fe70c91b78ff181425035fcf2
diff --git a/apex/apex_test.go b/apex/apex_test.go
index f1638c3..3cd7d1b 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2161,6 +2161,35 @@
`)
}
+func TestAndroidMkWritesCommonProperties(t *testing.T) {
+ ctx, config := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ vintf_fragments: ["fragment.xml"],
+ init_rc: ["init.rc"],
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ cc_binary {
+ name: "mybin",
+ }
+ `)
+
+ apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
+ data := android.AndroidMkDataForTest(t, config, "", apexBundle)
+ name := apexBundle.BaseModuleName()
+ prefix := "TARGET_"
+ var builder strings.Builder
+ data.Custom(&builder, name, prefix, "", data)
+ androidMk := builder.String()
+ ensureContains(t, androidMk, "LOCAL_VINTF_FRAGMENTS := fragment.xml\n")
+ ensureContains(t, androidMk, "LOCAL_INIT_RC := init.rc\n")
+}
+
func TestStaticLinking(t *testing.T) {
ctx, _ := testApex(t, `
apex {