Merge "Soong: Add support on installing fonts in /fonts system image."
This commit is contained in:
@@ -23,6 +23,7 @@ func init() {
|
|||||||
RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
|
RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
|
||||||
RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
|
RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
|
||||||
RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
|
||||||
|
RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
|
||||||
|
|
||||||
PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
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
|
||||||
|
}
|
||||||
|
@@ -30,6 +30,7 @@ func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
|
|||||||
ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory))
|
ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory))
|
||||||
ctx.RegisterModuleType("prebuilt_usr_share", ModuleFactoryAdaptor(PrebuiltUserShareFactory))
|
ctx.RegisterModuleType("prebuilt_usr_share", ModuleFactoryAdaptor(PrebuiltUserShareFactory))
|
||||||
ctx.RegisterModuleType("prebuilt_usr_share_host", ModuleFactoryAdaptor(PrebuiltUserShareHostFactory))
|
ctx.RegisterModuleType("prebuilt_usr_share_host", ModuleFactoryAdaptor(PrebuiltUserShareHostFactory))
|
||||||
|
ctx.RegisterModuleType("prebuilt_font", ModuleFactoryAdaptor(PrebuiltFontFactory))
|
||||||
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
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())
|
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())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user