Simplify arch target handling
Soong's multi-architecture building has grown complex, with the combination of HostOrDevice+HostType+Arch necessary to determine how to build a variant of a module, and three separate mutators to split each into its variations. Combine HostOrDevice+HostType into Os, which will be Linux, Darwin, Windows, or Android. Store Os+Arch as a single Target. Change-Id: I92f2e2dac53617d595a35cc285d2bd348baa0fbd
This commit is contained in:
@@ -149,27 +149,21 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b
|
||||
name += "_" + data.SubName
|
||||
}
|
||||
|
||||
hostCross := false
|
||||
if amod.Host() && amod.HostType() != CurrentHostType() {
|
||||
hostCross = true
|
||||
}
|
||||
|
||||
if data.Custom != nil {
|
||||
prefix := ""
|
||||
if amod.Host() {
|
||||
if hostCross {
|
||||
prefix = "HOST_CROSS_"
|
||||
} else {
|
||||
prefix = "HOST_"
|
||||
}
|
||||
if amod.Arch().ArchType != ctx.Config().(Config).HostArches[amod.HostType()][0].ArchType {
|
||||
prefix = "2ND_" + prefix
|
||||
}
|
||||
} else {
|
||||
switch amod.Os().Class {
|
||||
case Host:
|
||||
prefix = "HOST_"
|
||||
case HostCross:
|
||||
prefix = "HOST_CROSS_"
|
||||
case Device:
|
||||
prefix = "TARGET_"
|
||||
if amod.Arch().ArchType != ctx.Config().(Config).DeviceArches[0].ArchType {
|
||||
prefix = "2ND_" + prefix
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
config := ctx.Config().(Config)
|
||||
if amod.Arch().ArchType != config.Targets[amod.Os().Class][0].Arch.ArchType {
|
||||
prefix = "2ND_" + prefix
|
||||
}
|
||||
|
||||
return data.Custom(w, name, prefix)
|
||||
@@ -191,15 +185,15 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b
|
||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", data.OutputFile.String())
|
||||
|
||||
archStr := amod.Arch().ArchType.String()
|
||||
if amod.Host() {
|
||||
if hostCross {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr)
|
||||
} else {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr)
|
||||
}
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", amod.HostType().String())
|
||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||
} else {
|
||||
host := false
|
||||
switch amod.Os().Class {
|
||||
case Host:
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr)
|
||||
host = true
|
||||
case HostCross:
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr)
|
||||
host = true
|
||||
case Device:
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
|
||||
|
||||
if len(amod.commonProperties.Logtags) > 0 {
|
||||
@@ -207,6 +201,11 @@ func translateAndroidMkModule(ctx blueprint.SingletonContext, w io.Writer, mod b
|
||||
}
|
||||
}
|
||||
|
||||
if host {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", amod.Os().String())
|
||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||
}
|
||||
|
||||
for _, extra := range data.Extra {
|
||||
err = extra(w, data.OutputFile.Path())
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user