aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrice Arruda2019-05-14 10:20:45 -0500
committerPatrice Arruda2019-05-15 14:35:29 -0500
commit61583eb72a200576cc08afde3bc0bcdd9a831653 (patch)
tree956e47fb1ea26e3c99addc32ed9694b4fdbcdf78
parent192e3aa6a86c486c976cdd8587d5700aeb304241 (diff)
downloadplatform-build-soong-61583eb72a200576cc08afde3bc0bcdd9a831653.tar.gz
platform-build-soong-61583eb72a200576cc08afde3bc0bcdd9a831653.tar.xz
platform-build-soong-61583eb72a200576cc08afde3bc0bcdd9a831653.zip
Soong: Add support on installing fonts in /fonts system image.
A new module named prebuilt_font allows a set of fonts to be installed in the /fonts system image. Bug: b/123403785 Test: Wrote and ran unit test cases. Change-Id: Icd468abe3d70a528b28a8d8f216407484e9966a7
-rw-r--r--android/prebuilt_etc.go10
-rw-r--r--android/prebuilt_etc_test.go16
2 files changed, 26 insertions, 0 deletions
diff --git a/android/prebuilt_etc.go b/android/prebuilt_etc.go
index bec24c77..b13ce2a9 100644
--- a/android/prebuilt_etc.go
+++ b/android/prebuilt_etc.go
@@ -23,6 +23,7 @@ func init() {
23 RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) 23 RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
24 RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) 24 RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
25 RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) 25 RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
26 RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
26 27
27 PreDepsMutators(func(ctx RegisterMutatorsContext) { 28 PreDepsMutators(func(ctx RegisterMutatorsContext) {
28 ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel() 29 ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
@@ -240,3 +241,12 @@ func prebuiltEtcMutator(mctx BottomUpMutatorContext) {
240 } 241 }
241 } 242 }
242} 243}
244
245// prebuilt_font installs a font in <partition>/fonts directory.
246func PrebuiltFontFactory() Module {
247 module := &PrebuiltEtc{installDirBase: "fonts"}
248 InitPrebuiltEtcModule(module)
249 // This module is device-only
250 InitAndroidArchModule(module, DeviceSupported, MultilibFirst)
251 return module
252}
diff --git a/android/prebuilt_etc_test.go b/android/prebuilt_etc_test.go
index 08700ae5..a5c44809 100644
--- a/android/prebuilt_etc_test.go
+++ b/android/prebuilt_etc_test.go
@@ -30,6 +30,7 @@ func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
30 ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory)) 30 ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(PrebuiltEtcHostFactory))
31 ctx.RegisterModuleType("prebuilt_usr_share", ModuleFactoryAdaptor(PrebuiltUserShareFactory)) 31 ctx.RegisterModuleType("prebuilt_usr_share", ModuleFactoryAdaptor(PrebuiltUserShareFactory))
32 ctx.RegisterModuleType("prebuilt_usr_share_host", ModuleFactoryAdaptor(PrebuiltUserShareHostFactory)) 32 ctx.RegisterModuleType("prebuilt_usr_share_host", ModuleFactoryAdaptor(PrebuiltUserShareHostFactory))
33 ctx.RegisterModuleType("prebuilt_font", ModuleFactoryAdaptor(PrebuiltFontFactory))
33 ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { 34 ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
34 ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel() 35 ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
35 }) 36 })
@@ -219,3 +220,18 @@ func TestPrebuiltUserShareHostInstallDirPath(t *testing.T) {
219 t.Errorf("expected %q, got %q", expected, p.installDirPath.RelPathString()) 220 t.Errorf("expected %q, got %q", expected, p.installDirPath.RelPathString())
220 } 221 }
221} 222}
223
224func TestPrebuiltFontInstallDirPath(t *testing.T) {
225 ctx, _ := testPrebuiltEtc(t, `
226 prebuilt_font {
227 name: "foo.conf",
228 src: "foo.conf",
229 }
230 `)
231
232 p := ctx.ModuleForTests("foo.conf", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
233 expected := "target/product/test_device/system/fonts"
234 if p.installDirPath.RelPathString() != expected {
235 t.Errorf("expected %q, got %q", expected, p.installDirPath.RelPathString())
236 }
237}