Soong: Add mk2bp conversion for prebuilt_font.

There are a couple of makefiles that have etc with $(TARGET_OUT)/fonts
and $(TARGET_OUT_PRODUCT)/fonts  as the local module path. Added the
conversion in androidmk for target.

bug: b/123403785
Test: Wrote and ran unit test cases, did a test conversion on
        * platform/external/google-fonts/dancing-script/Android.mk
        * internal/external/google-fonts/arbutus-fonts/Android.mk
Change-Id: Id67e10f80b32b27c5027cd274a7944801dad0880
This commit is contained in:
Patrice Arruda 2019-05-15 18:21:32 -07:00
parent e40da8cff6
commit d1f45c8967
2 changed files with 41 additions and 2 deletions

View File

@ -1116,6 +1116,45 @@ prebuilt_usr_share_host {
src: "foo.txt",
}
`,
},
{
desc: "prebuilt_font",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := font.ttf
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
include $(BUILD_PREBUILT)
`,
expected: `
prebuilt_font {
name: "font.ttf",
src: "font.ttf",
}
`,
},
{
desc: "prebuilt_font",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := font.ttf
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/fonts
include $(BUILD_PREBUILT)
`,
expected: `
prebuilt_font {
name: "font.ttf",
src: "font.ttf",
product_specific: true,
}
`,
},
{

View File

@ -501,9 +501,9 @@ func (f etcPrebuiltModuleUpdate) update(m *parser.Module, path string) bool {
var localModuleUpdate = map[string][]etcPrebuiltModuleUpdate{
"HOST_OUT": {{prefix: "/etc", modType: "prebuilt_etc_host"}, {prefix: "/usr/share", modType: "prebuilt_usr_share_host"}},
"PRODUCT_OUT": {{prefix: "/system/etc"}, {prefix: "/vendor/etc", flags: []string{"proprietary"}}},
"TARGET_OUT": {{prefix: "/etc"}, {prefix: "/usr/share", modType: "prebuilt_usr_share"}},
"TARGET_OUT": {{prefix: "/etc"}, {prefix: "/usr/share", modType: "prebuilt_usr_share"}, {prefix: "/fonts", modType: "prebuilt_font"}},
"TARGET_OUT_ETC": {{prefix: ""}},
"TARGET_OUT_PRODUCT": {{prefix: "/etc", flags: []string{"product_specific"}}},
"TARGET_OUT_PRODUCT": {{prefix: "/etc", flags: []string{"product_specific"}}, {prefix: "/fonts", modType: "prebuilt_font", flags: []string{"product_specific"}}},
"TARGET_OUT_PRODUCT_ETC": {{prefix: "", flags: []string{"product_specific"}}},
"TARGET_OUT_ODM": {{prefix: "/etc", flags: []string{"device_specific"}}},
"TARGET_OUT_PRODUCT_SERVICES": {{prefix: "/etc", flags: []string{"product_services_specific"}}},