Merge "Improve documentation of CompileMultiTargets and related properties"

This commit is contained in:
Paul Duffin
2020-03-03 19:59:49 +00:00
committed by Gerrit Code Review
2 changed files with 45 additions and 8 deletions

View File

@@ -1778,6 +1778,8 @@ func filterMultilibTargets(targets []Target, multilib string) []Target {
return ret return ret
} }
// Return the set of Os specific common architecture targets for each Os in a list of
// targets.
func getCommonTargets(targets []Target) []Target { func getCommonTargets(targets []Target) []Target {
var ret []Target var ret []Target
set := make(map[string]bool) set := make(map[string]bool)

View File

@@ -132,6 +132,9 @@ type BaseModuleContext interface {
Target() Target Target() Target
TargetPrimary() bool TargetPrimary() bool
// The additional arch specific targets (e.g. 32/64 bit) that this module variant is
// responsible for creating.
MultiTargets() []Target MultiTargets() []Target
Arch() Arch Arch() Arch
Os() OsType Os() OsType
@@ -364,6 +367,10 @@ type commonProperties struct {
} }
} }
// If set to true then the archMutator will create variants for each arch specific target
// (e.g. 32/64) that the module is required to produce. If set to false then it will only
// create a variant for the architecture and will list the additional arch specific targets
// that the variant needs to produce in the CompileMultiTargets property.
UseTargetVariants bool `blueprint:"mutated"` UseTargetVariants bool `blueprint:"mutated"`
Default_multilib string `blueprint:"mutated"` Default_multilib string `blueprint:"mutated"`
@@ -442,10 +449,34 @@ type commonProperties struct {
Suffix *string `android:"arch_variant"` Suffix *string `android:"arch_variant"`
} `android:"arch_variant"` } `android:"arch_variant"`
// Set by TargetMutator // The OsType of artifacts that this module variant is responsible for creating.
//
// Set by osMutator
CompileOS OsType `blueprint:"mutated"` CompileOS OsType `blueprint:"mutated"`
// The Target of artifacts that this module variant is responsible for creating.
//
// Set by archMutator
CompileTarget Target `blueprint:"mutated"` CompileTarget Target `blueprint:"mutated"`
// The additional arch specific targets (e.g. 32/64 bit) that this module variant is
// responsible for creating.
//
// By default this is nil as, where necessary, separate variants are created for the
// different multilib types supported and that information is encapsulated in the
// CompileTarget so the module variant simply needs to create artifacts for that.
//
// However, if UseTargetVariants is set to false (e.g. by
// InitAndroidMultiTargetsArchModule) then no separate variants are created for the
// multilib targets. Instead a single variant is created for the architecture and
// this contains the multilib specific targets that this variant should create.
//
// Set by archMutator
CompileMultiTargets []Target `blueprint:"mutated"` CompileMultiTargets []Target `blueprint:"mutated"`
// True if the module variant's CompileTarget is the primary target
//
// Set by archMutator
CompilePrimary bool `blueprint:"mutated"` CompilePrimary bool `blueprint:"mutated"`
// Set by InitAndroidModule // Set by InitAndroidModule
@@ -1329,7 +1360,9 @@ type baseModuleContext struct {
strictVisitDeps bool // If true, enforce that all dependencies are enabled strictVisitDeps bool // If true, enforce that all dependencies are enabled
} }
func (b *baseModuleContext) OtherModuleName(m blueprint.Module) string { return b.bp.OtherModuleName(m) } func (b *baseModuleContext) OtherModuleName(m blueprint.Module) string {
return b.bp.OtherModuleName(m)
}
func (b *baseModuleContext) OtherModuleDir(m blueprint.Module) string { return b.bp.OtherModuleDir(m) } func (b *baseModuleContext) OtherModuleDir(m blueprint.Module) string { return b.bp.OtherModuleDir(m) }
func (b *baseModuleContext) OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{}) { func (b *baseModuleContext) OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{}) {
b.bp.OtherModuleErrorf(m, fmt, args...) b.bp.OtherModuleErrorf(m, fmt, args...)
@@ -1338,7 +1371,9 @@ func (b *baseModuleContext) OtherModuleDependencyTag(m blueprint.Module) bluepri
return b.bp.OtherModuleDependencyTag(m) return b.bp.OtherModuleDependencyTag(m)
} }
func (b *baseModuleContext) OtherModuleExists(name string) bool { return b.bp.OtherModuleExists(name) } func (b *baseModuleContext) OtherModuleExists(name string) bool { return b.bp.OtherModuleExists(name) }
func (b *baseModuleContext) OtherModuleType(m blueprint.Module) string { return b.bp.OtherModuleType(m) } func (b *baseModuleContext) OtherModuleType(m blueprint.Module) string {
return b.bp.OtherModuleType(m)
}
func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module { func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module {
return b.bp.GetDirectDepWithTag(name, tag) return b.bp.GetDirectDepWithTag(name, tag)