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: Iae677eff61a851b65a7192a47f2dc17c1abb4160
This commit is contained in:
Colin Cross
2016-06-01 17:09:44 -07:00
parent 0fda89f4a8
commit 54c7112c43
19 changed files with 362 additions and 476 deletions

View File

@@ -54,8 +54,8 @@ type config struct {
ConfigFileName string
ProductVariablesFileName string
DeviceArches []Arch
HostArches map[HostType][]Arch
Targets map[OsClass][]Target
BuildOsVariant string
srcDir string // the path of the root source directory
buildDir string // the path of the build output directory
@@ -175,20 +175,21 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
config.inMake = true
}
hostArches, deviceArches, err := decodeArchProductVariables(config.ProductVariables)
targets, err := decodeTargetProductVariables(config)
if err != nil {
return Config{}, err
}
if Bool(config.Mega_device) {
deviceArches, err = decodeMegaDevice()
deviceTargets, err := decodeMegaDevice()
if err != nil {
return Config{}, err
}
targets[Device] = deviceTargets
}
config.HostArches = hostArches
config.DeviceArches = deviceArches
config.Targets = targets
config.BuildOsVariant = targets[Host][0].String()
return config, nil
}
@@ -325,3 +326,13 @@ func (c *config) SanitizeDevice() []string {
}
return *c.ProductVariables.SanitizeDevice
}
func (c *config) Android64() bool {
for _, t := range c.Targets[Device] {
if t.Arch.ArchType.Multilib == "lib64" {
return true
}
}
return false
}