Soong: Add mk2bp conversion for prebuilt_firmare.

There are a couple of makefiles that have etc with $(TARGET_OUT)/etc/firmware,
$(TARGET_OUT_VENDOR)/firmare as the local module path. Added the conversion in
androidmk for target.

Bug: b/133711895
Test: Unit test cases.
Change-Id: I74aca18a7eb8aa4dd692cde680fa4e112edcf6d1
This commit is contained in:
Patrice Arruda 2019-06-03 16:47:56 -07:00
parent 06b2c69cfe
commit 1ef3bb5d51
2 changed files with 85 additions and 5 deletions

View file

@ -1176,6 +1176,84 @@ prebuilt_usr_share_host {
src: "foo.txt",
sub_dir: "bar",
}
`,
},
{
desc: "prebuilt_firmware subdir_bar in $(TARGET_OUT_ETC)",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/firmware/bar
LOCAL_SRC_FILES := foo.fw
include $(BUILD_PREBUILT)
`,
expected: `
prebuilt_firmware {
name: "foo",
src: "foo.fw",
sub_dir: "bar",
}
`,
},
{
desc: "prebuilt_firmware subdir_bar in $(TARGET_OUT)",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/firmware/bar
LOCAL_SRC_FILES := foo.fw
include $(BUILD_PREBUILT)
`,
expected: `
prebuilt_firmware {
name: "foo",
src: "foo.fw",
sub_dir: "bar",
}
`,
},
{
desc: "prebuilt_firmware subdir_bar in $(TARGET_OUT_VENDOR)",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/firmware/bar
LOCAL_SRC_FILES := foo.fw
include $(BUILD_PREBUILT)
`,
expected: `
prebuilt_firmware {
name: "foo",
src: "foo.fw",
sub_dir: "bar",
proprietary: true,
}
`,
},
{
desc: "prebuilt_firmware subdir_bar in $(TARGET_OUT)/vendor",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/vendor/firmware/bar
LOCAL_SRC_FILES := foo.fw
include $(BUILD_PREBUILT)
`,
expected: `
prebuilt_firmware {
name: "foo",
src: "foo.fw",
sub_dir: "bar",
proprietary: true,
}
`,
},
{

View file

@ -503,16 +503,18 @@ 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"}, {prefix: "/fonts", modType: "prebuilt_font"}},
"TARGET_OUT_ETC": {{prefix: ""}},
"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: "/usr/share", modType: "prebuilt_usr_share"}, {prefix: "/fonts", modType: "prebuilt_font"},
{prefix: "/etc/firmware", modType: "prebuilt_firmware"}, {prefix: "/vendor/firmware", modType: "prebuilt_firmware", flags: []string{"proprietary"}},
{prefix: "/etc"}},
"TARGET_OUT_ETC": {{prefix: "/firmware", modType: "prebuilt_firmware"}, {prefix: ""}},
"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"}}},
"TARGET_OUT_PRODUCT_SERVICES_ETC": {{prefix: "", flags: []string{"product_services_specific"}}},
"TARGET_OUT_VENDOR": {{prefix: "/etc", flags: []string{"proprietary"}}},
"TARGET_OUT_VENDOR": {{prefix: "/etc", flags: []string{"proprietary"}}, {prefix: "/firmware", modType: "prebuilt_firmware", flags: []string{"proprietary"}}},
"TARGET_OUT_VENDOR_ETC": {{prefix: "", flags: []string{"proprietary"}}},
"TARGET_RECOVERY_ROOT_OUT": {{prefix: "/system/etc", flags: []string{"recovery"}}},
}