Merge "Soong: Add support on installing fonts in /fonts system image."

am: e40da8cff6

Change-Id: Ic7813c326fbff4418e1dbc4282879e11327dbc0b
This commit is contained in:
Patrice Arruda 2019-05-15 17:46:48 -07:00 committed by android-build-merger
commit b87703697d
2 changed files with 26 additions and 0 deletions

View file

@ -23,6 +23,7 @@ func init() {
RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
PreDepsMutators(func(ctx RegisterMutatorsContext) {
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
@ -240,3 +241,12 @@ func prebuiltEtcMutator(mctx BottomUpMutatorContext) {
}
}
}
// prebuilt_font installs a font in <partition>/fonts directory.
func PrebuiltFontFactory() Module {
module := &PrebuiltEtc{installDirBase: "fonts"}
InitPrebuiltEtcModule(module)
// This module is device-only
InitAndroidArchModule(module, DeviceSupported, MultilibFirst)
return module
}

View file

@ -30,6 +30,7 @@ func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory))
ctx.RegisterModuleType("prebuilt_usr_share", ModuleFactoryAdaptor(PrebuiltUserShareFactory))
ctx.RegisterModuleType("prebuilt_usr_share_host", ModuleFactoryAdaptor(PrebuiltUserShareHostFactory))
ctx.RegisterModuleType("prebuilt_font", ModuleFactoryAdaptor(PrebuiltFontFactory))
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
})
@ -219,3 +220,18 @@ func TestPrebuiltUserShareHostInstallDirPath(t *testing.T) {
t.Errorf("expected %q, got %q", expected, p.installDirPath.RelPathString())
}
}
func TestPrebuiltFontInstallDirPath(t *testing.T) {
ctx, _ := testPrebuiltEtc(t, `
prebuilt_font {
name: "foo.conf",
src: "foo.conf",
}
`)
p := ctx.ModuleForTests("foo.conf", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
expected := "target/product/test_device/system/fonts"
if p.installDirPath.RelPathString() != expected {
t.Errorf("expected %q, got %q", expected, p.installDirPath.RelPathString())
}
}