Loading android/prebuilt_etc.go +10 −0 Original line number Diff line number Diff line Loading @@ -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() Loading Loading @@ -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 } android/prebuilt_etc_test.go +16 −0 Original line number Diff line number Diff line Loading @@ -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() }) Loading Loading @@ -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()) } } Loading
android/prebuilt_etc.go +10 −0 Original line number Diff line number Diff line Loading @@ -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() Loading Loading @@ -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 }
android/prebuilt_etc_test.go +16 −0 Original line number Diff line number Diff line Loading @@ -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() }) Loading Loading @@ -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()) } }