Split ArchMutatorContext out of BaseMutatorContext
Split the context methods that are useful on anything visiting a
module that has arch variants into a separate ArchMutatorContext
for reuse by TranstitionMutators.
Bug: 319288033
Test: builds
Change-Id: Ifdc21983c6c79f22965a49f169812a8cc3ad975b
diff --git a/android/base_module_context.go b/android/base_module_context.go
index 3dfe123..af262ab 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -26,6 +26,7 @@
// instead of a blueprint.Module, plus some extra methods that return Android-specific information
// about the current module.
type BaseModuleContext interface {
+ ArchModuleContext
EarlyModuleContext
blueprintBaseModuleContext() blueprint.BaseModuleContext
@@ -204,29 +205,12 @@
// getMissingDependencies returns the list of missing dependencies.
// Calling this function prevents adding new dependencies.
getMissingDependencies() []string
-
- Target() Target
- TargetPrimary() bool
-
- // The additional arch specific targets (e.g. 32/64 bit) that this module variant is
- // responsible for creating.
- MultiTargets() []Target
- Arch() Arch
- Os() OsType
- Host() bool
- Device() bool
- Darwin() bool
- Windows() bool
- PrimaryArch() bool
}
type baseModuleContext struct {
bp blueprint.BaseModuleContext
earlyModuleContext
- os OsType
- target Target
- multiTargets []Target
- targetPrimary bool
+ archModuleContext
walkPath []Module
tagPath []blueprint.DependencyTag
@@ -561,46 +545,3 @@
}
return sb.String()
}
-
-func (b *baseModuleContext) Target() Target {
- return b.target
-}
-
-func (b *baseModuleContext) TargetPrimary() bool {
- return b.targetPrimary
-}
-
-func (b *baseModuleContext) MultiTargets() []Target {
- return b.multiTargets
-}
-
-func (b *baseModuleContext) Arch() Arch {
- return b.target.Arch
-}
-
-func (b *baseModuleContext) Os() OsType {
- return b.os
-}
-
-func (b *baseModuleContext) Host() bool {
- return b.os.Class == Host
-}
-
-func (b *baseModuleContext) Device() bool {
- return b.os.Class == Device
-}
-
-func (b *baseModuleContext) Darwin() bool {
- return b.os == Darwin
-}
-
-func (b *baseModuleContext) Windows() bool {
- return b.os == Windows
-}
-
-func (b *baseModuleContext) PrimaryArch() bool {
- if len(b.config.Targets[b.target.Os]) <= 1 {
- return true
- }
- return b.target.Arch.ArchType == b.config.Targets[b.target.Os][0].Arch.ArchType
-}