Merge "Add prebuilt_etc_host module type."
am: e3c98e7ba4
Change-Id: I118f96617265a39bb49988e386066a511d6ed411
This commit is contained in:
commit
b4a9a3a23c
2 changed files with 29 additions and 1 deletions
|
@ -25,6 +25,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
|
RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
|
||||||
|
RegisterModuleType("prebuilt_etc_host", prebuiltEtcHostFactory)
|
||||||
|
|
||||||
PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
||||||
|
@ -149,6 +150,9 @@ func (p *PrebuiltEtc) AndroidMk() AndroidMkData {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", *p.commonProperties.Owner)
|
fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", *p.commonProperties.Owner)
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := optional")
|
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := optional")
|
||||||
|
if p.Host() {
|
||||||
|
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", p.outputFilePath.String())
|
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", p.outputFilePath.String())
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
|
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
|
||||||
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", p.outputFilePath.Base())
|
fmt.Fprintln(w, "LOCAL_INSTALLED_MODULE_STEM :=", p.outputFilePath.Base())
|
||||||
|
@ -178,6 +182,14 @@ func PrebuiltEtcFactory() Module {
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func prebuiltEtcHostFactory() Module {
|
||||||
|
module := &PrebuiltEtc{}
|
||||||
|
InitPrebuiltEtcModule(module)
|
||||||
|
// This module is host-only
|
||||||
|
InitAndroidArchModule(module, HostSupported, MultilibCommon)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// coreMode is the variant for modules to be installed to system.
|
// coreMode is the variant for modules to be installed to system.
|
||||||
coreMode = "core"
|
coreMode = "core"
|
||||||
|
@ -190,7 +202,7 @@ const (
|
||||||
// system or recovery.
|
// system or recovery.
|
||||||
func prebuiltEtcMutator(mctx BottomUpMutatorContext) {
|
func prebuiltEtcMutator(mctx BottomUpMutatorContext) {
|
||||||
m, ok := mctx.Module().(*PrebuiltEtc)
|
m, ok := mctx.Module().(*PrebuiltEtc)
|
||||||
if !ok {
|
if !ok || m.Host() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ func testPrebuiltEtc(t *testing.T, bp string) *TestContext {
|
||||||
defer tearDown(buildDir)
|
defer tearDown(buildDir)
|
||||||
ctx := NewTestArchContext()
|
ctx := NewTestArchContext()
|
||||||
ctx.RegisterModuleType("prebuilt_etc", ModuleFactoryAdaptor(PrebuiltEtcFactory))
|
ctx.RegisterModuleType("prebuilt_etc", ModuleFactoryAdaptor(PrebuiltEtcFactory))
|
||||||
|
ctx.RegisterModuleType("prebuilt_etc_host", ModuleFactoryAdaptor(prebuiltEtcHostFactory))
|
||||||
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
|
||||||
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
ctx.BottomUp("prebuilt_etc", prebuiltEtcMutator).Parallel()
|
||||||
})
|
})
|
||||||
|
@ -177,3 +178,18 @@ func TestPrebuiltEtcAndroidMk(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrebuiltEtcHost(t *testing.T) {
|
||||||
|
ctx := testPrebuiltEtc(t, `
|
||||||
|
prebuilt_etc_host {
|
||||||
|
name: "foo.conf",
|
||||||
|
src: "foo.conf",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
buildOS := BuildOs.String()
|
||||||
|
p := ctx.ModuleForTests("foo.conf", buildOS+"_common").Module().(*PrebuiltEtc)
|
||||||
|
if !p.Host() {
|
||||||
|
t.Errorf("host bit is not set for a prebuilt_etc_host module.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue