aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2019-05-15 18:53:28 -0500
committerGerrit Code Review2019-05-15 18:53:28 -0500
commite40da8cff61c2bd5d70c4d9f2f517e29f4d296ba (patch)
treee7f64f3de63ee98a3122cf09f5f9eb29409fa00c
parent62ca44a36b3be02bd2becf7a92075918587d2b25 (diff)
parent61583eb72a200576cc08afde3bc0bcdd9a831653 (diff)
downloadplatform-build-soong-e40da8cff61c2bd5d70c4d9f2f517e29f4d296ba.tar.gz
platform-build-soong-e40da8cff61c2bd5d70c4d9f2f517e29f4d296ba.tar.xz
platform-build-soong-e40da8cff61c2bd5d70c4d9f2f517e29f4d296ba.zip
Merge "Soong: Add support on installing fonts in /fonts system image."
-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}