Make CreateVariations return []android.Module

Test: soong tests
Change-Id: I9bc40642c4902392eb8193bf73e32b7f1c18c14e
This commit is contained in:
Colin Cross 2019-11-18 15:28:57 -08:00
parent 874da80729
commit 43b92e0d0f
2 changed files with 14 additions and 12 deletions

View File

@ -17,8 +17,6 @@ package android
import (
"sort"
"sync"
"github.com/google/blueprint"
)
// ApexModule is the interface that a module type is expected to implement if
@ -69,7 +67,7 @@ type ApexModule interface {
// Mutate this module into one or more variants each of which is built
// for an APEX marked via BuildForApex().
CreateApexVariations(mctx BottomUpMutatorContext) []blueprint.Module
CreateApexVariations(mctx BottomUpMutatorContext) []Module
// Sets the name of the apex variant of this module. Called inside
// CreateApexVariations.
@ -176,7 +174,7 @@ func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
}
}
func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []blueprint.Module {
func (m *ApexModuleBase) CreateApexVariations(mctx BottomUpMutatorContext) []Module {
if len(m.apexVariations) > 0 {
m.checkApexAvailableProperty(mctx)
sort.Strings(m.apexVariations)

View File

@ -143,8 +143,8 @@ type BottomUpMutatorContext interface {
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string)
AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string)
CreateVariations(...string) []blueprint.Module
CreateLocalVariations(...string) []blueprint.Module
CreateVariations(...string) []Module
CreateLocalVariations(...string) []Module
SetDependencyVariation(string)
SetDefaultDependencyVariation(*string)
AddVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string)
@ -285,28 +285,32 @@ func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, t
b.bp.AddReverseDependency(module, tag, name)
}
func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []blueprint.Module {
func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []Module {
modules := b.bp.CreateVariations(variations...)
aModules := make([]Module, len(modules))
for i := range variations {
base := modules[i].(Module).base()
aModules[i] = modules[i].(Module)
base := aModules[i].base()
base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName())
base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i])
}
return modules
return aModules
}
func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []blueprint.Module {
func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []Module {
modules := b.bp.CreateLocalVariations(variations...)
aModules := make([]Module, len(modules))
for i := range variations {
base := modules[i].(Module).base()
aModules[i] = modules[i].(Module)
base := aModules[i].base()
base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName())
base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i])
}
return modules
return aModules
}
func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) {