Merge "Implement host_required
and target_required
properties."
am: b9045cf28c
Change-Id: I1c53b3bd727e2eca85e0272e96572e56a1ac8d66
This commit is contained in:
@@ -38,13 +38,15 @@ type AndroidMkDataProvider interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AndroidMkData struct {
|
type AndroidMkData struct {
|
||||||
Class string
|
Class string
|
||||||
SubName string
|
SubName string
|
||||||
DistFile OptionalPath
|
DistFile OptionalPath
|
||||||
OutputFile OptionalPath
|
OutputFile OptionalPath
|
||||||
Disabled bool
|
Disabled bool
|
||||||
Include string
|
Include string
|
||||||
Required []string
|
Required []string
|
||||||
|
Host_required []string
|
||||||
|
Target_required []string
|
||||||
|
|
||||||
Custom func(w io.Writer, name, prefix, moduleDir string, data AndroidMkData)
|
Custom func(w io.Writer, name, prefix, moduleDir string, data AndroidMkData)
|
||||||
|
|
||||||
@@ -200,6 +202,8 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.Required = append(data.Required, amod.commonProperties.Required...)
|
data.Required = append(data.Required, amod.commonProperties.Required...)
|
||||||
|
data.Host_required = append(data.Host_required, amod.commonProperties.Host_required...)
|
||||||
|
data.Target_required = append(data.Target_required, amod.commonProperties.Target_required...)
|
||||||
|
|
||||||
// Make does not understand LinuxBionic
|
// Make does not understand LinuxBionic
|
||||||
if amod.Os() == LinuxBionic {
|
if amod.Os() == LinuxBionic {
|
||||||
@@ -267,10 +271,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
|
|||||||
fmt.Fprintln(&data.preamble, "LOCAL_MODULE :=", name+data.SubName)
|
fmt.Fprintln(&data.preamble, "LOCAL_MODULE :=", name+data.SubName)
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_CLASS :=", data.Class)
|
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_CLASS :=", data.Class)
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_PREBUILT_MODULE_FILE :=", data.OutputFile.String())
|
fmt.Fprintln(&data.preamble, "LOCAL_PREBUILT_MODULE_FILE :=", data.OutputFile.String())
|
||||||
|
WriteRequiredModulesSettings(&data.preamble, data)
|
||||||
if len(data.Required) > 0 {
|
|
||||||
fmt.Fprintln(&data.preamble, "LOCAL_REQUIRED_MODULES := "+strings.Join(data.Required, " "))
|
|
||||||
}
|
|
||||||
|
|
||||||
archStr := amod.Arch().ArchType.String()
|
archStr := amod.Arch().ArchType.String()
|
||||||
host := false
|
host := false
|
||||||
@@ -360,3 +361,15 @@ func WriteAndroidMkData(w io.Writer, data AndroidMkData) {
|
|||||||
|
|
||||||
fmt.Fprintln(w, "include "+data.Include)
|
fmt.Fprintln(w, "include "+data.Include)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WriteRequiredModulesSettings(w io.Writer, data AndroidMkData) {
|
||||||
|
if len(data.Required) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(data.Required, " "))
|
||||||
|
}
|
||||||
|
if len(data.Host_required) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES :=", strings.Join(data.Host_required, " "))
|
||||||
|
}
|
||||||
|
if len(data.Target_required) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=", strings.Join(data.Target_required, " "))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -133,6 +133,8 @@ type ModuleContext interface {
|
|||||||
InstallInRecovery() bool
|
InstallInRecovery() bool
|
||||||
|
|
||||||
RequiredModuleNames() []string
|
RequiredModuleNames() []string
|
||||||
|
HostRequiredModuleNames() []string
|
||||||
|
TargetRequiredModuleNames() []string
|
||||||
|
|
||||||
// android.ModuleContext methods
|
// android.ModuleContext methods
|
||||||
// These are duplicated instead of embedded so that can eventually be wrapped to take an
|
// These are duplicated instead of embedded so that can eventually be wrapped to take an
|
||||||
@@ -269,6 +271,12 @@ type commonProperties struct {
|
|||||||
// names of other modules to install if this module is installed
|
// names of other modules to install if this module is installed
|
||||||
Required []string `android:"arch_variant"`
|
Required []string `android:"arch_variant"`
|
||||||
|
|
||||||
|
// names of other modules to install on host if this module is installed
|
||||||
|
Host_required []string `android:"arch_variant"`
|
||||||
|
|
||||||
|
// names of other modules to install on target if this module is installed
|
||||||
|
Target_required []string `android:"arch_variant"`
|
||||||
|
|
||||||
// relative path to a file to include in the list of notices for the device
|
// relative path to a file to include in the list of notices for the device
|
||||||
Notice *string `android:"path"`
|
Notice *string `android:"path"`
|
||||||
|
|
||||||
@@ -1459,6 +1467,14 @@ func (ctx *androidModuleContext) RequiredModuleNames() []string {
|
|||||||
return ctx.module.base().commonProperties.Required
|
return ctx.module.base().commonProperties.Required
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctx *androidModuleContext) HostRequiredModuleNames() []string {
|
||||||
|
return ctx.module.base().commonProperties.Host_required
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ctx *androidModuleContext) TargetRequiredModuleNames() []string {
|
||||||
|
return ctx.module.base().commonProperties.Target_required
|
||||||
|
}
|
||||||
|
|
||||||
func (ctx *androidModuleContext) Glob(globPattern string, excludes []string) Paths {
|
func (ctx *androidModuleContext) Glob(globPattern string, excludes []string) Paths {
|
||||||
ret, err := ctx.GlobWithDeps(globPattern, excludes)
|
ret, err := ctx.GlobWithDeps(globPattern, excludes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -17,7 +17,6 @@ package android
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
|
// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
|
||||||
@@ -157,7 +156,7 @@ func (p *PrebuiltEtc) AndroidMk() AndroidMkData {
|
|||||||
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())
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !p.Installable())
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !p.Installable())
|
||||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(data.Required, " "))
|
WriteRequiredModulesSettings(w, data)
|
||||||
if p.additionalDependencies != nil {
|
if p.additionalDependencies != nil {
|
||||||
fmt.Fprint(w, "LOCAL_ADDITIONAL_DEPENDENCIES :=")
|
fmt.Fprint(w, "LOCAL_ADDITIONAL_DEPENDENCIES :=")
|
||||||
for _, path := range *p.additionalDependencies {
|
for _, path := range *p.additionalDependencies {
|
||||||
|
@@ -150,13 +150,17 @@ func TestPrebuiltEtcAndroidMk(t *testing.T) {
|
|||||||
|
|
||||||
data := AndroidMkData{}
|
data := AndroidMkData{}
|
||||||
data.Required = append(data.Required, "modA", "moduleB")
|
data.Required = append(data.Required, "modA", "moduleB")
|
||||||
|
data.Host_required = append(data.Host_required, "hostModA", "hostModB")
|
||||||
|
data.Target_required = append(data.Target_required, "targetModA")
|
||||||
|
|
||||||
expected := map[string]string{
|
expected := map[string]string{
|
||||||
"LOCAL_MODULE": "foo",
|
"LOCAL_MODULE": "foo",
|
||||||
"LOCAL_MODULE_CLASS": "ETC",
|
"LOCAL_MODULE_CLASS": "ETC",
|
||||||
"LOCAL_MODULE_OWNER": "abc",
|
"LOCAL_MODULE_OWNER": "abc",
|
||||||
"LOCAL_INSTALLED_MODULE_STEM": "foo.conf",
|
"LOCAL_INSTALLED_MODULE_STEM": "foo.conf",
|
||||||
"LOCAL_REQUIRED_MODULES": "modA moduleB",
|
"LOCAL_REQUIRED_MODULES": "modA moduleB",
|
||||||
|
"LOCAL_HOST_REQUIRED_MODULES": "hostModA hostModB",
|
||||||
|
"LOCAL_TARGET_REQUIRED_MODULES": "targetModA",
|
||||||
}
|
}
|
||||||
|
|
||||||
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
|
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
|
||||||
|
@@ -85,10 +85,12 @@ type variableProperties struct {
|
|||||||
// are used for dogfooding and performance testing, and should be as similar to user builds
|
// are used for dogfooding and performance testing, and should be as similar to user builds
|
||||||
// as possible.
|
// as possible.
|
||||||
Debuggable struct {
|
Debuggable struct {
|
||||||
Cflags []string
|
Cflags []string
|
||||||
Cppflags []string
|
Cppflags []string
|
||||||
Init_rc []string
|
Init_rc []string
|
||||||
Required []string
|
Required []string
|
||||||
|
Host_required []string
|
||||||
|
Target_required []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// eng is true for -eng builds, and can be used to turn on additionaly heavyweight debugging
|
// eng is true for -eng builds, and can be used to turn on additionaly heavyweight debugging
|
||||||
|
@@ -126,6 +126,8 @@ func init() {
|
|||||||
"LOCAL_CONLYFLAGS": "conlyflags",
|
"LOCAL_CONLYFLAGS": "conlyflags",
|
||||||
"LOCAL_CPPFLAGS": "cppflags",
|
"LOCAL_CPPFLAGS": "cppflags",
|
||||||
"LOCAL_REQUIRED_MODULES": "required",
|
"LOCAL_REQUIRED_MODULES": "required",
|
||||||
|
"LOCAL_HOST_REQUIRED_MODULES": "host_required",
|
||||||
|
"LOCAL_TARGET_REQUIRED_MODULES": "target_required",
|
||||||
"LOCAL_OVERRIDES_MODULES": "overrides",
|
"LOCAL_OVERRIDES_MODULES": "overrides",
|
||||||
"LOCAL_LDLIBS": "host_ldlibs",
|
"LOCAL_LDLIBS": "host_ldlibs",
|
||||||
"LOCAL_CLANG_CFLAGS": "clang_cflags",
|
"LOCAL_CLANG_CFLAGS": "clang_cflags",
|
||||||
|
@@ -38,7 +38,7 @@ func (library *Library) AndroidMkHostDex(w io.Writer, name string, data android.
|
|||||||
}
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String())
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", library.implementationAndResourcesJar.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", library.implementationAndResourcesJar.String())
|
||||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+strings.Join(data.Required, " "))
|
android.WriteRequiredModulesSettings(w, data)
|
||||||
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,9 @@ func init() {
|
|||||||
|
|
||||||
type phony struct {
|
type phony struct {
|
||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
requiredModuleNames []string
|
requiredModuleNames []string
|
||||||
|
hostRequiredModuleNames []string
|
||||||
|
targetRequiredModuleNames []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func PhonyFactory() android.Module {
|
func PhonyFactory() android.Module {
|
||||||
@@ -40,8 +42,12 @@ func PhonyFactory() android.Module {
|
|||||||
|
|
||||||
func (p *phony) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (p *phony) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
p.requiredModuleNames = ctx.RequiredModuleNames()
|
p.requiredModuleNames = ctx.RequiredModuleNames()
|
||||||
if len(p.requiredModuleNames) == 0 {
|
p.hostRequiredModuleNames = ctx.HostRequiredModuleNames()
|
||||||
ctx.PropertyErrorf("required", "phony must not have empty required dependencies in order to be useful(and therefore permitted).")
|
p.targetRequiredModuleNames = ctx.TargetRequiredModuleNames()
|
||||||
|
if len(p.requiredModuleNames) == 0 &&
|
||||||
|
len(p.hostRequiredModuleNames) == 0 && len(p.targetRequiredModuleNames) == 0 {
|
||||||
|
ctx.PropertyErrorf("required", "phony must not have empty required dependencies "+
|
||||||
|
"in order to be useful(and therefore permitted).")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +60,18 @@ func (p *phony) AndroidMk() android.AndroidMkData {
|
|||||||
if p.Host() {
|
if p.Host() {
|
||||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+strings.Join(p.requiredModuleNames, " "))
|
if len(p.requiredModuleNames) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=",
|
||||||
|
strings.Join(p.requiredModuleNames, " "))
|
||||||
|
}
|
||||||
|
if len(p.hostRequiredModuleNames) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES :=",
|
||||||
|
strings.Join(p.hostRequiredModuleNames, " "))
|
||||||
|
}
|
||||||
|
if len(p.targetRequiredModuleNames) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=",
|
||||||
|
strings.Join(p.targetRequiredModuleNames, " "))
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
|
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user