Add target.linux_glibc and target.bionic
target.linux_glibc will apply to host builds with glibc, which is identical to the current target.linux. In a future change, target.linux will change to affect all targets using the Linux kernel (android, linux_bionic, and linux_glibc). target.bionic will apply to all OS variants using Bionic. Bug: 31559095 Test: Add target.linux_glibc, target.bionic sections to an Android.bp, build Test: m host Change-Id: I677a67c22fba148fec264132311e355283f9d88d
This commit is contained in:
parent
1596e6ee11
commit
866b563d4c
4 changed files with 75 additions and 8 deletions
|
@ -243,7 +243,11 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b
|
|||
}
|
||||
|
||||
if host {
|
||||
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_HOST_OS :=", amod.Os().String())
|
||||
makeOs := amod.Os().String()
|
||||
if amod.Os() == Linux || amod.Os() == LinuxBionic {
|
||||
makeOs = "linux"
|
||||
}
|
||||
fmt.Fprintln(&data.preamble, "LOCAL_MODULE_HOST_OS :=", makeOs)
|
||||
fmt.Fprintln(&data.preamble, "LOCAL_IS_HOST_MODULE := true")
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ var (
|
|||
commonTargetMap = make(map[string]Target)
|
||||
|
||||
NoOsType OsType
|
||||
Linux = NewOsType("linux", Host, false)
|
||||
Linux = NewOsType("linux_glibc", Host, false)
|
||||
Darwin = NewOsType("darwin", Host, false)
|
||||
LinuxBionic = NewOsType("linux_bionic", Host, true)
|
||||
Windows = NewOsType("windows", HostCross, true)
|
||||
|
@ -242,6 +242,14 @@ func (os OsType) String() string {
|
|||
return os.Name
|
||||
}
|
||||
|
||||
func (os OsType) Bionic() bool {
|
||||
return os == Android || os == LinuxBionic
|
||||
}
|
||||
|
||||
func (os OsType) Linux() bool {
|
||||
return os == Android || os == Linux || os == LinuxBionic
|
||||
}
|
||||
|
||||
func NewOsType(name string, class OsClass, defDisabled bool) OsType {
|
||||
os := OsType{
|
||||
Name: name,
|
||||
|
@ -459,6 +467,8 @@ func createArchType(props reflect.Type) reflect.Type {
|
|||
"Host",
|
||||
"Android64",
|
||||
"Android32",
|
||||
"Bionic",
|
||||
"Linux",
|
||||
"Not_windows",
|
||||
"Arm_on_x86",
|
||||
"Arm_on_x86_64",
|
||||
|
@ -468,6 +478,19 @@ func createArchType(props reflect.Type) reflect.Type {
|
|||
|
||||
for _, archType := range osArchTypeMap[os] {
|
||||
targets = append(targets, os.Field+"_"+archType.Name)
|
||||
|
||||
if os == Linux { // TODO(dwillemsen): os.Linux()
|
||||
target := "Linux_" + archType.Name
|
||||
if !inList(target, targets) {
|
||||
targets = append(targets, target)
|
||||
}
|
||||
}
|
||||
if os.Bionic() {
|
||||
target := "Bionic_" + archType.Name
|
||||
if !inList(target, targets) {
|
||||
targets = append(targets, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -663,18 +686,47 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||
}
|
||||
|
||||
// Handle target OS generalities of the form:
|
||||
// target: {
|
||||
// bionic: {
|
||||
// key: value,
|
||||
// },
|
||||
// bionic_x86: {
|
||||
// key: value,
|
||||
// },
|
||||
// }
|
||||
if os == Linux { // TODO(dwillemsen): os.Linux()
|
||||
field = "Linux"
|
||||
prefix = "target.linux"
|
||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||
|
||||
field = "Linux_" + t.Name
|
||||
prefix = "target.linux_" + t.Name
|
||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||
}
|
||||
|
||||
if os.Bionic() {
|
||||
field = "Bionic"
|
||||
prefix = "target.bionic"
|
||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||
|
||||
field = "Bionic_" + t.Name
|
||||
prefix = "target.bionic_" + t.Name
|
||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||
}
|
||||
|
||||
// Handle target OS properties in the form:
|
||||
// target: {
|
||||
// linux: {
|
||||
// linux_glibc: {
|
||||
// key: value,
|
||||
// },
|
||||
// not_windows: {
|
||||
// key: value,
|
||||
// },
|
||||
// linux_x86: {
|
||||
// linux_glibc_x86: {
|
||||
// key: value,
|
||||
// },
|
||||
// linux_arm: {
|
||||
// linux_glibc_arm: {
|
||||
// key: value,
|
||||
// },
|
||||
// android {
|
||||
|
@ -687,7 +739,6 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||
// key: value,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
field = os.Field
|
||||
prefix = "target." + os.Name
|
||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||
|
|
|
@ -714,7 +714,15 @@ func PathForModuleInstall(ctx ModuleInstallPathContext, pathComponents ...string
|
|||
}
|
||||
outPaths = []string{"target", "product", ctx.AConfig().DeviceName(), partition}
|
||||
} else {
|
||||
outPaths = []string{"host", ctx.Os().String() + "-x86"}
|
||||
switch ctx.Os() {
|
||||
case Linux:
|
||||
outPaths = []string{"host", "linux-x86"}
|
||||
case LinuxBionic:
|
||||
// TODO: should this be a separate top level, or shared with linux-x86?
|
||||
outPaths = []string{"host", "linux_bionic-x86"}
|
||||
default:
|
||||
outPaths = []string{"host", ctx.Os().String() + "-x86"}
|
||||
}
|
||||
}
|
||||
if ctx.Debug() {
|
||||
outPaths = append([]string{"debug"}, outPaths...)
|
||||
|
|
|
@ -155,7 +155,11 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
|
|||
}
|
||||
|
||||
if host {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", ctx.Target().Os.String())
|
||||
makeOs := ctx.Target().Os.String()
|
||||
if ctx.Target().Os == android.Linux || ctx.Target().Os == android.LinuxBionic {
|
||||
makeOs = "linux"
|
||||
}
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", makeOs)
|
||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||
} else if ctx.vndk() {
|
||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
||||
|
|
Loading…
Reference in a new issue