Merge "Add support for keyboard prebuilt module type" into main

This commit is contained in:
Treehugger Robot 2024-05-02 01:08:04 +00:00 committed by Gerrit Code Review
commit 5197e880d9
2 changed files with 78 additions and 0 deletions

View file

@ -55,6 +55,9 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory)
ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory)
ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory)
ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory)
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
@ -609,6 +612,39 @@ func PrebuiltUserHyphenDataFactory() android.Module {
return module
}
// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in
// <partition>/usr/keylayout/<sub_dir> directory.
func PrebuiltUserKeyLayoutFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "usr/keylayout")
// This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module
}
// prebuilt_usr_keychars is for a prebuilt artifact that is installed in
// <partition>/usr/keychars/<sub_dir> directory.
func PrebuiltUserKeyCharsFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "usr/keychars")
// This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module
}
// prebuilt_usr_idc is for a prebuilt artifact that is installed in
// <partition>/usr/idc/<sub_dir> directory.
func PrebuiltUserIdcFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "usr/idc")
// This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
android.InitDefaultableModule(module)
return module
}
// prebuilt_font installs a font in <partition>/fonts directory.
func PrebuiltFontFactory() android.Module {
module := &PrebuiltEtc{}

View file

@ -287,6 +287,48 @@ func TestPrebuiltPrebuiltUserHyphenDataInstallDirPath(t *testing.T) {
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
}
func TestPrebuiltPrebuiltUserKeyLayoutInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_usr_keylayout {
name: "foo.conf",
src: "foo.conf",
sub_dir: "bar",
}
`)
p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
expected := "out/soong/target/product/test_device/system/usr/keylayout/bar"
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
}
func TestPrebuiltPrebuiltUserKeyCharsInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_usr_keychars {
name: "foo.conf",
src: "foo.conf",
sub_dir: "bar",
}
`)
p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
expected := "out/soong/target/product/test_device/system/usr/keychars/bar"
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
}
func TestPrebuiltPrebuiltUserIdcInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_usr_idc {
name: "foo.conf",
src: "foo.conf",
sub_dir: "bar",
}
`)
p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
expected := "out/soong/target/product/test_device/system/usr/idc/bar"
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
}
func TestPrebuiltFontInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_font {