Merge changes I9f8df94f,I2d7f5c56,I0ebb7381,Ieefcfc1a am: a6bf56d4be

am: 236ac108f5

Change-Id: Ia0777130add15aceb17739f5dcb613ca4e1bf172
This commit is contained in:
Colin Cross
2019-06-10 10:00:33 -07:00
committed by android-build-merger
15 changed files with 576 additions and 612 deletions

View File

@@ -86,7 +86,7 @@ func getApiLevelsMap(config Config) map[string]int {
// * Numeric API levels are simply converted.
// * "minimum" and "current" are not currently handled since the former is
// NDK specific and the latter has inconsistent meaning.
func ApiStrToNum(ctx BaseContext, apiLevel string) (int, error) {
func ApiStrToNum(ctx BaseModuleContext, apiLevel string) (int, error) {
num, ok := getApiLevelsMap(ctx.Config())[apiLevel]
if ok {
return num, nil

View File

@@ -1129,7 +1129,7 @@ func InitArchModule(m Module) {
var variantReplacer = strings.NewReplacer("-", "_", ".", "_")
func (a *ModuleBase) appendProperties(ctx BottomUpMutatorContext,
func (m *ModuleBase) appendProperties(ctx BottomUpMutatorContext,
dst interface{}, src reflect.Value, field, srcPrefix string) reflect.Value {
src = src.FieldByName(field)
@@ -1167,16 +1167,16 @@ func (a *ModuleBase) appendProperties(ctx BottomUpMutatorContext,
}
// Rewrite the module's properties structs to contain arch-specific values.
func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
arch := a.Arch()
os := a.Os()
func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
arch := m.Arch()
os := m.Os()
for i := range a.generalProperties {
genProps := a.generalProperties[i]
if a.archProperties[i] == nil {
for i := range m.generalProperties {
genProps := m.generalProperties[i]
if m.archProperties[i] == nil {
continue
}
for _, archProperties := range a.archProperties[i] {
for _, archProperties := range m.archProperties[i] {
archPropValues := reflect.ValueOf(archProperties).Elem()
archProp := archPropValues.FieldByName("Arch")
@@ -1197,7 +1197,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
if arch.ArchType != Common {
field := proptools.FieldNameForProperty(t.Name)
prefix := "arch." + t.Name
archStruct := a.appendProperties(ctx, genProps, archProp, field, prefix)
archStruct := m.appendProperties(ctx, genProps, archProp, field, prefix)
// Handle arch-variant-specific properties in the form:
// arch: {
@@ -1209,7 +1209,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
if v != "" {
field := proptools.FieldNameForProperty(v)
prefix := "arch." + t.Name + "." + v
a.appendProperties(ctx, genProps, archStruct, field, prefix)
m.appendProperties(ctx, genProps, archStruct, field, prefix)
}
// Handle cpu-variant-specific properties in the form:
@@ -1223,7 +1223,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
if c != "" {
field := proptools.FieldNameForProperty(c)
prefix := "arch." + t.Name + "." + c
a.appendProperties(ctx, genProps, archStruct, field, prefix)
m.appendProperties(ctx, genProps, archStruct, field, prefix)
}
}
@@ -1236,7 +1236,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
for _, feature := range arch.ArchFeatures {
field := proptools.FieldNameForProperty(feature)
prefix := "arch." + t.Name + "." + feature
a.appendProperties(ctx, genProps, archStruct, field, prefix)
m.appendProperties(ctx, genProps, archStruct, field, prefix)
}
// Handle multilib-specific properties in the form:
@@ -1247,7 +1247,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
// },
field = proptools.FieldNameForProperty(t.Multilib)
prefix = "multilib." + t.Multilib
a.appendProperties(ctx, genProps, multilibProp, field, prefix)
m.appendProperties(ctx, genProps, multilibProp, field, prefix)
}
// Handle host-specific properties in the form:
@@ -1259,7 +1259,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
if os.Class == Host || os.Class == HostCross {
field = "Host"
prefix = "target.host"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
// Handle target OS generalities of the form:
@@ -1274,24 +1274,24 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
if os.Linux() {
field = "Linux"
prefix = "target.linux"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
if arch.ArchType != Common {
field = "Linux_" + arch.ArchType.Name
prefix = "target.linux_" + arch.ArchType.Name
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
}
if os.Bionic() {
field = "Bionic"
prefix = "target.bionic"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
if arch.ArchType != Common {
field = "Bionic_" + t.Name
prefix = "target.bionic_" + t.Name
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
}
@@ -1321,18 +1321,18 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
// },
field = os.Field
prefix = "target." + os.Name
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
if arch.ArchType != Common {
field = os.Field + "_" + t.Name
prefix = "target." + os.Name + "_" + t.Name
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
if (os.Class == Host || os.Class == HostCross) && os != Windows {
field := "Not_windows"
prefix := "target.not_windows"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
// Handle 64-bit device properties in the form:
@@ -1352,11 +1352,11 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
if ctx.Config().Android64() {
field := "Android64"
prefix := "target.android64"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
} else {
field := "Android32"
prefix := "target.android32"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
if (arch.ArchType == X86 && (hasArmAbi(arch) ||
@@ -1365,7 +1365,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
hasX86AndroidArch(ctx.Config().Targets[Android])) {
field := "Arm_on_x86"
prefix := "target.arm_on_x86"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
if (arch.ArchType == X86_64 && (hasArmAbi(arch) ||
hasArmAndroidArch(ctx.Config().Targets[Android]))) ||
@@ -1373,7 +1373,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
hasX8664AndroidArch(ctx.Config().Targets[Android])) {
field := "Arm_on_x86_64"
prefix := "target.arm_on_x86_64"
a.appendProperties(ctx, genProps, targetProp, field, prefix)
m.appendProperties(ctx, genProps, targetProp, field, prefix)
}
}
}

View File

@@ -27,7 +27,7 @@ import (
// been applied.
type LoadHookContext interface {
// TODO: a new context that includes Config() but not Target(), etc.?
BaseContext
BaseModuleContext
AppendProperties(...interface{})
PrependProperties(...interface{})
CreateModule(blueprint.ModuleFactory, ...interface{})
@@ -36,7 +36,7 @@ type LoadHookContext interface {
// Arch hooks are run after the module has been split into architecture variants, and can be used
// to add architecture-specific properties.
type ArchHookContext interface {
BaseContext
BaseModuleContext
AppendProperties(...interface{})
PrependProperties(...interface{})
}
@@ -129,18 +129,18 @@ func registerLoadHookMutator(ctx RegisterMutatorsContext) {
func LoadHookMutator(ctx TopDownMutatorContext) {
if m, ok := ctx.Module().(Module); ok {
// Cast through *androidTopDownMutatorContext because AppendProperties is implemented
// on *androidTopDownMutatorContext but not exposed through TopDownMutatorContext
var loadHookCtx LoadHookContext = ctx.(*androidTopDownMutatorContext)
// Cast through *topDownMutatorContext because AppendProperties is implemented
// on *topDownMutatorContext but not exposed through TopDownMutatorContext
var loadHookCtx LoadHookContext = ctx.(*topDownMutatorContext)
m.base().hooks.runLoadHooks(loadHookCtx, m.base())
}
}
func archHookMutator(ctx TopDownMutatorContext) {
if m, ok := ctx.Module().(Module); ok {
// Cast through *androidTopDownMutatorContext because AppendProperties is implemented
// on *androidTopDownMutatorContext but not exposed through TopDownMutatorContext
var archHookCtx ArchHookContext = ctx.(*androidTopDownMutatorContext)
// Cast through *topDownMutatorContext because AppendProperties is implemented
// on *topDownMutatorContext but not exposed through TopDownMutatorContext
var archHookCtx ArchHookContext = ctx.(*topDownMutatorContext)
m.base().hooks.runArchHooks(archHookCtx, m.base())
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -66,8 +66,8 @@ type registerMutatorsContext struct {
}
type RegisterMutatorsContext interface {
TopDown(name string, m AndroidTopDownMutator) MutatorHandle
BottomUp(name string, m AndroidBottomUpMutator) MutatorHandle
TopDown(name string, m TopDownMutator) MutatorHandle
BottomUp(name string, m BottomUpMutator) MutatorHandle
}
type RegisterMutatorFunc func(RegisterMutatorsContext)
@@ -110,52 +110,27 @@ func PostDepsMutators(f RegisterMutatorFunc) {
postDeps = append(postDeps, f)
}
type AndroidTopDownMutator func(TopDownMutatorContext)
type TopDownMutator func(TopDownMutatorContext)
type TopDownMutatorContext interface {
BaseModuleContext
androidBaseContext
OtherModuleExists(name string) bool
Rename(name string)
Module() Module
OtherModuleName(m blueprint.Module) string
OtherModuleDir(m blueprint.Module) string
OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{})
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
CreateModule(blueprint.ModuleFactory, ...interface{})
GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module
GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag)
VisitDirectDeps(visit func(Module))
VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module))
VisitDirectDepsIf(pred func(Module) bool, visit func(Module))
VisitDepsDepthFirst(visit func(Module))
VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
WalkDeps(visit func(Module, Module) bool)
// GetWalkPath is supposed to be called in visit function passed in WalkDeps()
// and returns a top-down dependency path from a start module to current child module.
GetWalkPath() []Module
}
type androidTopDownMutatorContext struct {
blueprint.TopDownMutatorContext
androidBaseContextImpl
walkPath []Module
type topDownMutatorContext struct {
bp blueprint.TopDownMutatorContext
baseModuleContext
}
type AndroidBottomUpMutator func(BottomUpMutatorContext)
type BottomUpMutator func(BottomUpMutatorContext)
type BottomUpMutatorContext interface {
BaseModuleContext
androidBaseContext
OtherModuleExists(name string) bool
Rename(name string)
Module() blueprint.Module
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string)
AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string)
@@ -168,17 +143,17 @@ type BottomUpMutatorContext interface {
ReplaceDependencies(string)
}
type androidBottomUpMutatorContext struct {
blueprint.BottomUpMutatorContext
androidBaseContextImpl
type bottomUpMutatorContext struct {
bp blueprint.BottomUpMutatorContext
baseModuleContext
}
func (x *registerMutatorsContext) BottomUp(name string, m AndroidBottomUpMutator) MutatorHandle {
func (x *registerMutatorsContext) BottomUp(name string, m BottomUpMutator) MutatorHandle {
f := func(ctx blueprint.BottomUpMutatorContext) {
if a, ok := ctx.Module().(Module); ok {
actx := &androidBottomUpMutatorContext{
BottomUpMutatorContext: ctx,
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
actx := &bottomUpMutatorContext{
bp: ctx,
baseModuleContext: a.base().baseModuleContextFactory(ctx),
}
m(actx)
}
@@ -188,12 +163,12 @@ func (x *registerMutatorsContext) BottomUp(name string, m AndroidBottomUpMutator
return mutator
}
func (x *registerMutatorsContext) TopDown(name string, m AndroidTopDownMutator) MutatorHandle {
func (x *registerMutatorsContext) TopDown(name string, m TopDownMutator) MutatorHandle {
f := func(ctx blueprint.TopDownMutatorContext) {
if a, ok := ctx.Module().(Module); ok {
actx := &androidTopDownMutatorContext{
TopDownMutatorContext: ctx,
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
actx := &topDownMutatorContext{
bp: ctx,
baseModuleContext: a.base().baseModuleContextFactory(ctx),
}
m(actx)
}
@@ -218,106 +193,13 @@ func depsMutator(ctx BottomUpMutatorContext) {
}
}
func (a *androidTopDownMutatorContext) Config() Config {
return a.config
}
func (a *androidBottomUpMutatorContext) Config() Config {
return a.config
}
func (a *androidTopDownMutatorContext) Module() Module {
module, _ := a.TopDownMutatorContext.Module().(Module)
return module
}
func (a *androidTopDownMutatorContext) VisitDirectDeps(visit func(Module)) {
a.TopDownMutatorContext.VisitDirectDeps(func(module blueprint.Module) {
if aModule, _ := module.(Module); aModule != nil {
visit(aModule)
}
})
}
func (a *androidTopDownMutatorContext) VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module)) {
a.TopDownMutatorContext.VisitDirectDeps(func(module blueprint.Module) {
if aModule, _ := module.(Module); aModule != nil {
if a.TopDownMutatorContext.OtherModuleDependencyTag(aModule) == tag {
visit(aModule)
}
}
})
}
func (a *androidTopDownMutatorContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
a.TopDownMutatorContext.VisitDirectDepsIf(
// pred
func(module blueprint.Module) bool {
if aModule, _ := module.(Module); aModule != nil {
return pred(aModule)
} else {
return false
}
},
// visit
func(module blueprint.Module) {
visit(module.(Module))
})
}
func (a *androidTopDownMutatorContext) VisitDepsDepthFirst(visit func(Module)) {
a.TopDownMutatorContext.VisitDepsDepthFirst(func(module blueprint.Module) {
if aModule, _ := module.(Module); aModule != nil {
visit(aModule)
}
})
}
func (a *androidTopDownMutatorContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
a.TopDownMutatorContext.VisitDepsDepthFirstIf(
// pred
func(module blueprint.Module) bool {
if aModule, _ := module.(Module); aModule != nil {
return pred(aModule)
} else {
return false
}
},
// visit
func(module blueprint.Module) {
visit(module.(Module))
})
}
func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool) {
a.walkPath = []Module{a.Module()}
a.TopDownMutatorContext.WalkDeps(func(child, parent blueprint.Module) bool {
childAndroidModule, _ := child.(Module)
parentAndroidModule, _ := parent.(Module)
if childAndroidModule != nil && parentAndroidModule != nil {
// record walkPath before visit
for a.walkPath[len(a.walkPath)-1] != parentAndroidModule {
a.walkPath = a.walkPath[0 : len(a.walkPath)-1]
}
a.walkPath = append(a.walkPath, childAndroidModule)
return visit(childAndroidModule, parentAndroidModule)
} else {
return false
}
})
}
func (a *androidTopDownMutatorContext) GetWalkPath() []Module {
return a.walkPath
}
func (a *androidTopDownMutatorContext) AppendProperties(props ...interface{}) {
func (t *topDownMutatorContext) AppendProperties(props ...interface{}) {
for _, p := range props {
err := proptools.AppendMatchingProperties(a.Module().base().customizableProperties,
err := proptools.AppendMatchingProperties(t.Module().base().customizableProperties,
p, nil)
if err != nil {
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
a.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
} else {
panic(err)
}
@@ -325,16 +207,74 @@ func (a *androidTopDownMutatorContext) AppendProperties(props ...interface{}) {
}
}
func (a *androidTopDownMutatorContext) PrependProperties(props ...interface{}) {
func (t *topDownMutatorContext) PrependProperties(props ...interface{}) {
for _, p := range props {
err := proptools.PrependMatchingProperties(a.Module().base().customizableProperties,
err := proptools.PrependMatchingProperties(t.Module().base().customizableProperties,
p, nil)
if err != nil {
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
a.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
} else {
panic(err)
}
}
}
}
// android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that
// has an overridden version in android.BaseModuleContext has to be manually forwarded to BaseModuleContext to avoid
// ambiguous method errors, or it has to store a blueprint.TopDownMutatorContext non-embedded, in which case every
// non-overridden method has to be forwarded. There are fewer non-overridden methods, so use the latter. The following
// methods forward to the identical blueprint versions for topDownMutatorContext and bottomUpMutatorContext.
func (t *topDownMutatorContext) Rename(name string) {
t.bp.Rename(name)
}
func (t *topDownMutatorContext) CreateModule(factory blueprint.ModuleFactory, props ...interface{}) {
t.bp.CreateModule(factory, props...)
}
func (b *bottomUpMutatorContext) Rename(name string) {
b.bp.Rename(name)
}
func (b *bottomUpMutatorContext) AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) {
b.bp.AddDependency(module, tag, name...)
}
func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) {
b.bp.AddReverseDependency(module, tag, name)
}
func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []blueprint.Module {
return b.bp.CreateVariations(variations...)
}
func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []blueprint.Module {
return b.bp.CreateLocalVariations(variations...)
}
func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) {
b.bp.SetDependencyVariation(variation)
}
func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag,
names ...string) {
b.bp.AddVariationDependencies(variations, tag, names...)
}
func (b *bottomUpMutatorContext) AddFarVariationDependencies(variations []blueprint.Variation,
tag blueprint.DependencyTag, names ...string) {
b.bp.AddFarVariationDependencies(variations, tag, names...)
}
func (b *bottomUpMutatorContext) AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) {
b.bp.AddInterVariantDependency(tag, from, to)
}
func (b *bottomUpMutatorContext) ReplaceDependencies(name string) {
b.bp.ReplaceDependencies(name)
}

View File

@@ -41,9 +41,7 @@ var _ PathContext = SingletonContext(nil)
var _ PathContext = ModuleContext(nil)
type ModuleInstallPathContext interface {
PathContext
androidBaseContext
BaseModuleContext
InstallInData() bool
InstallInSanitizerDir() bool
@@ -369,7 +367,7 @@ func expandOneSrcPath(ctx ModuleContext, s string, expandedExcludes []string) (P
// each string. If incDirs is false, strip paths with a trailing '/' from the list.
// It intended for use in globs that only list files that exist, so it allows '$' in
// filenames.
func pathsForModuleSrcFromFullPath(ctx ModuleContext, paths []string, incDirs bool) Paths {
func pathsForModuleSrcFromFullPath(ctx BaseModuleContext, paths []string, incDirs bool) Paths {
prefix := filepath.Join(ctx.Config().srcDir, ctx.ModuleDir()) + "/"
if prefix == "./" {
prefix = ""

View File

@@ -200,7 +200,7 @@ func p(in interface{}) string {
}
type moduleInstallPathContextImpl struct {
androidBaseContextImpl
baseModuleContext
inData bool
inSanitizerDir bool
@@ -212,7 +212,7 @@ func (moduleInstallPathContextImpl) Fs() pathtools.FileSystem {
}
func (m moduleInstallPathContextImpl) Config() Config {
return m.androidBaseContextImpl.config
return m.baseModuleContext.config
}
func (moduleInstallPathContextImpl) AddNinjaFileDeps(deps ...string) {}
@@ -244,7 +244,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "host binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: hostTarget,
},
},
@@ -255,7 +255,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "system binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
},
},
@@ -265,7 +265,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "vendor binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: socSpecificModule,
},
@@ -276,7 +276,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "odm binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: deviceSpecificModule,
},
@@ -287,7 +287,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "product binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productSpecificModule,
},
@@ -298,7 +298,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "product_services binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productServicesSpecificModule,
},
@@ -310,7 +310,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "system native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
},
inData: true,
@@ -321,7 +321,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "vendor native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: socSpecificModule,
},
@@ -333,7 +333,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "odm native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: deviceSpecificModule,
},
@@ -345,7 +345,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "product native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productSpecificModule,
},
@@ -358,7 +358,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "product_services native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productServicesSpecificModule,
},
@@ -371,7 +371,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized system binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
},
inSanitizerDir: true,
@@ -382,7 +382,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized vendor binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: socSpecificModule,
},
@@ -394,7 +394,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized odm binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: deviceSpecificModule,
},
@@ -406,7 +406,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized product binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productSpecificModule,
},
@@ -419,7 +419,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized product_services binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productServicesSpecificModule,
},
@@ -432,7 +432,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized system native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
},
inData: true,
@@ -444,7 +444,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized vendor native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: socSpecificModule,
},
@@ -457,7 +457,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized odm native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: deviceSpecificModule,
},
@@ -470,7 +470,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized product native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productSpecificModule,
},
@@ -483,7 +483,7 @@ func TestPathForModuleInstall(t *testing.T) {
{
name: "sanitized product_services native test binary",
ctx: &moduleInstallPathContextImpl{
androidBaseContextImpl: androidBaseContextImpl{
baseModuleContext: baseModuleContext{
target: deviceTarget,
kind: productServicesSpecificModule,
},
@@ -497,7 +497,7 @@ func TestPathForModuleInstall(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
tc.ctx.androidBaseContextImpl.config = testConfig
tc.ctx.baseModuleContext.config = testConfig
output := PathForModuleInstall(tc.ctx, tc.in...)
if output.basePath.path != tc.out {
t.Errorf("unexpected path:\n got: %q\nwant: %q\n",

View File

@@ -402,12 +402,12 @@ func variableMutator(mctx BottomUpMutatorContext) {
}
}
func (a *ModuleBase) setVariableProperties(ctx BottomUpMutatorContext,
func (m *ModuleBase) setVariableProperties(ctx BottomUpMutatorContext,
prefix string, productVariablePropertyValue reflect.Value, variableValue interface{}) {
printfIntoProperties(ctx, prefix, productVariablePropertyValue, variableValue)
err := proptools.AppendMatchingProperties(a.generalProperties,
err := proptools.AppendMatchingProperties(m.generalProperties,
productVariablePropertyValue.Addr().Interface(), nil)
if err != nil {
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {

View File

@@ -552,7 +552,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
func (a *apexBundle) getCertString(ctx android.BaseContext) string {
func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string {
certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(ctx.ModuleName())
if overridden {
return ":" + certificate

View File

@@ -278,7 +278,7 @@ type ModuleContext interface {
}
type BaseModuleContext interface {
android.BaseContext
android.BaseModuleContext
ModuleContextIntf
}
@@ -641,7 +641,7 @@ func installToBootstrap(name string, config android.Config) bool {
}
type baseModuleContext struct {
android.BaseContext
android.BaseModuleContext
moduleContextImpl
}
@@ -1040,7 +1040,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
}
}
func (c *Module) toolchain(ctx android.BaseContext) config.Toolchain {
func (c *Module) toolchain(ctx android.BaseModuleContext) config.Toolchain {
if c.cachedToolchain == nil {
c.cachedToolchain = config.FindToolchain(ctx.Os(), ctx.Arch())
}
@@ -1161,7 +1161,7 @@ func (c *Module) deps(ctx DepsContext) Deps {
func (c *Module) beginMutator(actx android.BottomUpMutatorContext) {
ctx := &baseModuleContext{
BaseContext: actx,
BaseModuleContext: actx,
moduleContextImpl: moduleContextImpl{
mod: c,
},

View File

@@ -121,7 +121,7 @@ func intMax(a int, b int) int {
}
}
func normalizeNdkApiLevel(ctx android.BaseContext, apiLevel string,
func normalizeNdkApiLevel(ctx android.BaseModuleContext, apiLevel string,
arch android.Arch) (string, error) {
if apiLevel == "current" {
@@ -167,7 +167,7 @@ func getFirstGeneratedVersion(firstSupportedVersion string, platformVersion int)
return strconv.Atoi(firstSupportedVersion)
}
func shouldUseVersionScript(ctx android.BaseContext, stub *stubDecorator) (bool, error) {
func shouldUseVersionScript(ctx android.BaseModuleContext, stub *stubDecorator) (bool, error) {
// unversioned_until is normally empty, in which case we should use the version script.
if String(stub.properties.Unversioned_until) == "" {
return true, nil

View File

@@ -482,7 +482,7 @@ func collectAppDeps(ctx android.ModuleContext) ([]jniLib, []Certificate) {
return jniLibs, certificates
}
func (a *AndroidApp) getCertString(ctx android.BaseContext) string {
func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string {
certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(ctx.ModuleName())
if overridden {
return ":" + certificate

View File

@@ -380,8 +380,8 @@ type Dependency interface {
}
type SdkLibraryDependency interface {
SdkHeaderJars(ctx android.BaseContext, sdkVersion string) android.Paths
SdkImplementationJars(ctx android.BaseContext, sdkVersion string) android.Paths
SdkHeaderJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths
SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths
}
type SrcDependency interface {
@@ -448,11 +448,11 @@ type jniLib struct {
target android.Target
}
func (j *Module) shouldInstrument(ctx android.BaseContext) bool {
func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool {
return j.properties.Instrument && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT")
}
func (j *Module) shouldInstrumentStatic(ctx android.BaseContext) bool {
func (j *Module) shouldInstrumentStatic(ctx android.BaseModuleContext) bool {
return j.shouldInstrument(ctx) &&
(ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_STATIC") ||
ctx.Config().UnbundledBuild())

View File

@@ -46,7 +46,7 @@ type sdkContext interface {
targetSdkVersion() string
}
func sdkVersionOrDefault(ctx android.BaseContext, v string) string {
func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
switch v {
case "", "current", "system_current", "test_current", "core_current":
return ctx.Config().DefaultAppTargetSdk()
@@ -57,7 +57,7 @@ func sdkVersionOrDefault(ctx android.BaseContext, v string) string {
// Returns a sdk version as a number. For modules targeting an unreleased SDK (meaning it does not yet have a number)
// it returns android.FutureApiLevel (10000).
func sdkVersionToNumber(ctx android.BaseContext, v string) (int, error) {
func sdkVersionToNumber(ctx android.BaseModuleContext, v string) (int, error) {
switch v {
case "", "current", "test_current", "system_current", "core_current":
return ctx.Config().DefaultAppTargetSdkInt(), nil
@@ -71,7 +71,7 @@ func sdkVersionToNumber(ctx android.BaseContext, v string) (int, error) {
}
}
func sdkVersionToNumberAsString(ctx android.BaseContext, v string) (string, error) {
func sdkVersionToNumberAsString(ctx android.BaseModuleContext, v string) (string, error) {
n, err := sdkVersionToNumber(ctx, v)
if err != nil {
return "", err
@@ -79,7 +79,7 @@ func sdkVersionToNumberAsString(ctx android.BaseContext, v string) (string, erro
return strconv.Itoa(n), nil
}
func decodeSdkDep(ctx android.BaseContext, sdkContext sdkContext) sdkDep {
func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
v := sdkContext.sdkVersion()
// For PDK builds, use the latest SDK version instead of "current"
if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {

View File

@@ -591,7 +591,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) {
mctx.CreateModule(android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory), &etcProps)
}
func (module *SdkLibrary) PrebuiltJars(ctx android.BaseContext, sdkVersion string) android.Paths {
func (module *SdkLibrary) PrebuiltJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths {
var api, v string
if sdkVersion == "" {
api = "system"
@@ -615,7 +615,7 @@ func (module *SdkLibrary) PrebuiltJars(ctx android.BaseContext, sdkVersion strin
}
// to satisfy SdkLibraryDependency interface
func (module *SdkLibrary) SdkHeaderJars(ctx android.BaseContext, sdkVersion string) android.Paths {
func (module *SdkLibrary) SdkHeaderJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths {
// This module is just a wrapper for the stubs.
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
return module.PrebuiltJars(ctx, sdkVersion)
@@ -631,7 +631,7 @@ func (module *SdkLibrary) SdkHeaderJars(ctx android.BaseContext, sdkVersion stri
}
// to satisfy SdkLibraryDependency interface
func (module *SdkLibrary) SdkImplementationJars(ctx android.BaseContext, sdkVersion string) android.Paths {
func (module *SdkLibrary) SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths {
// This module is just a wrapper for the stubs.
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
return module.PrebuiltJars(ctx, sdkVersion)
@@ -840,13 +840,13 @@ func (module *sdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
}
// to satisfy SdkLibraryDependency interface
func (module *sdkLibraryImport) SdkHeaderJars(ctx android.BaseContext, sdkVersion string) android.Paths {
func (module *sdkLibraryImport) SdkHeaderJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths {
// This module is just a wrapper for the prebuilt stubs.
return module.stubsPath
}
// to satisfy SdkLibraryDependency interface
func (module *sdkLibraryImport) SdkImplementationJars(ctx android.BaseContext, sdkVersion string) android.Paths {
func (module *sdkLibraryImport) SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths {
// This module is just a wrapper for the stubs.
return module.stubsPath
}