Merge changes I9f8df94f,I2d7f5c56,I0ebb7381,Ieefcfc1a
* changes: Consolidate *MutatorContext and ModuleContext into BaseModuleContext Consolidate baseContext, BaseContext, and BaseModuleContext Rename ModuleBase receivers Remove repetition in android package names
This commit is contained in:
@@ -85,7 +85,7 @@ func getApiLevelsMap(config Config) map[string]int {
|
|||||||
// * Numeric API levels are simply converted.
|
// * Numeric API levels are simply converted.
|
||||||
// * "minimum" and "current" are not currently handled since the former is
|
// * "minimum" and "current" are not currently handled since the former is
|
||||||
// NDK specific and the latter has inconsistent meaning.
|
// 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]
|
num, ok := getApiLevelsMap(ctx.Config())[apiLevel]
|
||||||
if ok {
|
if ok {
|
||||||
return num, nil
|
return num, nil
|
||||||
|
@@ -1129,7 +1129,7 @@ func InitArchModule(m Module) {
|
|||||||
|
|
||||||
var variantReplacer = strings.NewReplacer("-", "_", ".", "_")
|
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 {
|
dst interface{}, src reflect.Value, field, srcPrefix string) reflect.Value {
|
||||||
|
|
||||||
src = src.FieldByName(field)
|
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.
|
// Rewrite the module's properties structs to contain arch-specific values.
|
||||||
func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
||||||
arch := a.Arch()
|
arch := m.Arch()
|
||||||
os := a.Os()
|
os := m.Os()
|
||||||
|
|
||||||
for i := range a.generalProperties {
|
for i := range m.generalProperties {
|
||||||
genProps := a.generalProperties[i]
|
genProps := m.generalProperties[i]
|
||||||
if a.archProperties[i] == nil {
|
if m.archProperties[i] == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, archProperties := range a.archProperties[i] {
|
for _, archProperties := range m.archProperties[i] {
|
||||||
archPropValues := reflect.ValueOf(archProperties).Elem()
|
archPropValues := reflect.ValueOf(archProperties).Elem()
|
||||||
|
|
||||||
archProp := archPropValues.FieldByName("Arch")
|
archProp := archPropValues.FieldByName("Arch")
|
||||||
@@ -1197,7 +1197,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
if arch.ArchType != Common {
|
if arch.ArchType != Common {
|
||||||
field := proptools.FieldNameForProperty(t.Name)
|
field := proptools.FieldNameForProperty(t.Name)
|
||||||
prefix := "arch." + 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:
|
// Handle arch-variant-specific properties in the form:
|
||||||
// arch: {
|
// arch: {
|
||||||
@@ -1209,7 +1209,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
if v != "" {
|
if v != "" {
|
||||||
field := proptools.FieldNameForProperty(v)
|
field := proptools.FieldNameForProperty(v)
|
||||||
prefix := "arch." + t.Name + "." + 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:
|
// Handle cpu-variant-specific properties in the form:
|
||||||
@@ -1223,7 +1223,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
if c != "" {
|
if c != "" {
|
||||||
field := proptools.FieldNameForProperty(c)
|
field := proptools.FieldNameForProperty(c)
|
||||||
prefix := "arch." + t.Name + "." + 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 {
|
for _, feature := range arch.ArchFeatures {
|
||||||
field := proptools.FieldNameForProperty(feature)
|
field := proptools.FieldNameForProperty(feature)
|
||||||
prefix := "arch." + t.Name + "." + 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:
|
// Handle multilib-specific properties in the form:
|
||||||
@@ -1247,7 +1247,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
// },
|
// },
|
||||||
field = proptools.FieldNameForProperty(t.Multilib)
|
field = proptools.FieldNameForProperty(t.Multilib)
|
||||||
prefix = "multilib." + 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:
|
// Handle host-specific properties in the form:
|
||||||
@@ -1259,7 +1259,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
if os.Class == Host || os.Class == HostCross {
|
if os.Class == Host || os.Class == HostCross {
|
||||||
field = "Host"
|
field = "Host"
|
||||||
prefix = "target.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:
|
// Handle target OS generalities of the form:
|
||||||
@@ -1274,24 +1274,24 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
if os.Linux() {
|
if os.Linux() {
|
||||||
field = "Linux"
|
field = "Linux"
|
||||||
prefix = "target.linux"
|
prefix = "target.linux"
|
||||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
m.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||||
|
|
||||||
if arch.ArchType != Common {
|
if arch.ArchType != Common {
|
||||||
field = "Linux_" + arch.ArchType.Name
|
field = "Linux_" + arch.ArchType.Name
|
||||||
prefix = "target.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() {
|
if os.Bionic() {
|
||||||
field = "Bionic"
|
field = "Bionic"
|
||||||
prefix = "target.bionic"
|
prefix = "target.bionic"
|
||||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
m.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||||
|
|
||||||
if arch.ArchType != Common {
|
if arch.ArchType != Common {
|
||||||
field = "Bionic_" + t.Name
|
field = "Bionic_" + t.Name
|
||||||
prefix = "target.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
|
field = os.Field
|
||||||
prefix = "target." + os.Name
|
prefix = "target." + os.Name
|
||||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
m.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||||
|
|
||||||
if arch.ArchType != Common {
|
if arch.ArchType != Common {
|
||||||
field = os.Field + "_" + t.Name
|
field = os.Field + "_" + t.Name
|
||||||
prefix = "target." + os.Name + "_" + 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 {
|
if (os.Class == Host || os.Class == HostCross) && os != Windows {
|
||||||
field := "Not_windows"
|
field := "Not_windows"
|
||||||
prefix := "target.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:
|
// Handle 64-bit device properties in the form:
|
||||||
@@ -1352,11 +1352,11 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
if ctx.Config().Android64() {
|
if ctx.Config().Android64() {
|
||||||
field := "Android64"
|
field := "Android64"
|
||||||
prefix := "target.android64"
|
prefix := "target.android64"
|
||||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
m.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||||
} else {
|
} else {
|
||||||
field := "Android32"
|
field := "Android32"
|
||||||
prefix := "target.android32"
|
prefix := "target.android32"
|
||||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
m.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arch.ArchType == X86 && (hasArmAbi(arch) ||
|
if (arch.ArchType == X86 && (hasArmAbi(arch) ||
|
||||||
@@ -1365,7 +1365,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
hasX86AndroidArch(ctx.Config().Targets[Android])) {
|
hasX86AndroidArch(ctx.Config().Targets[Android])) {
|
||||||
field := "Arm_on_x86"
|
field := "Arm_on_x86"
|
||||||
prefix := "target.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) ||
|
if (arch.ArchType == X86_64 && (hasArmAbi(arch) ||
|
||||||
hasArmAndroidArch(ctx.Config().Targets[Android]))) ||
|
hasArmAndroidArch(ctx.Config().Targets[Android]))) ||
|
||||||
@@ -1373,7 +1373,7 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
hasX8664AndroidArch(ctx.Config().Targets[Android])) {
|
hasX8664AndroidArch(ctx.Config().Targets[Android])) {
|
||||||
field := "Arm_on_x86_64"
|
field := "Arm_on_x86_64"
|
||||||
prefix := "target.arm_on_x86_64"
|
prefix := "target.arm_on_x86_64"
|
||||||
a.appendProperties(ctx, genProps, targetProp, field, prefix)
|
m.appendProperties(ctx, genProps, targetProp, field, prefix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ import (
|
|||||||
// been applied.
|
// been applied.
|
||||||
type LoadHookContext interface {
|
type LoadHookContext interface {
|
||||||
// TODO: a new context that includes Config() but not Target(), etc.?
|
// TODO: a new context that includes Config() but not Target(), etc.?
|
||||||
BaseContext
|
BaseModuleContext
|
||||||
AppendProperties(...interface{})
|
AppendProperties(...interface{})
|
||||||
PrependProperties(...interface{})
|
PrependProperties(...interface{})
|
||||||
CreateModule(blueprint.ModuleFactory, ...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
|
// Arch hooks are run after the module has been split into architecture variants, and can be used
|
||||||
// to add architecture-specific properties.
|
// to add architecture-specific properties.
|
||||||
type ArchHookContext interface {
|
type ArchHookContext interface {
|
||||||
BaseContext
|
BaseModuleContext
|
||||||
AppendProperties(...interface{})
|
AppendProperties(...interface{})
|
||||||
PrependProperties(...interface{})
|
PrependProperties(...interface{})
|
||||||
}
|
}
|
||||||
@@ -129,18 +129,18 @@ func registerLoadHookMutator(ctx RegisterMutatorsContext) {
|
|||||||
|
|
||||||
func LoadHookMutator(ctx TopDownMutatorContext) {
|
func LoadHookMutator(ctx TopDownMutatorContext) {
|
||||||
if m, ok := ctx.Module().(Module); ok {
|
if m, ok := ctx.Module().(Module); ok {
|
||||||
// Cast through *androidTopDownMutatorContext because AppendProperties is implemented
|
// Cast through *topDownMutatorContext because AppendProperties is implemented
|
||||||
// on *androidTopDownMutatorContext but not exposed through TopDownMutatorContext
|
// on *topDownMutatorContext but not exposed through TopDownMutatorContext
|
||||||
var loadHookCtx LoadHookContext = ctx.(*androidTopDownMutatorContext)
|
var loadHookCtx LoadHookContext = ctx.(*topDownMutatorContext)
|
||||||
m.base().hooks.runLoadHooks(loadHookCtx, m.base())
|
m.base().hooks.runLoadHooks(loadHookCtx, m.base())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func archHookMutator(ctx TopDownMutatorContext) {
|
func archHookMutator(ctx TopDownMutatorContext) {
|
||||||
if m, ok := ctx.Module().(Module); ok {
|
if m, ok := ctx.Module().(Module); ok {
|
||||||
// Cast through *androidTopDownMutatorContext because AppendProperties is implemented
|
// Cast through *topDownMutatorContext because AppendProperties is implemented
|
||||||
// on *androidTopDownMutatorContext but not exposed through TopDownMutatorContext
|
// on *topDownMutatorContext but not exposed through TopDownMutatorContext
|
||||||
var archHookCtx ArchHookContext = ctx.(*androidTopDownMutatorContext)
|
var archHookCtx ArchHookContext = ctx.(*topDownMutatorContext)
|
||||||
m.base().hooks.runArchHooks(archHookCtx, m.base())
|
m.base().hooks.runArchHooks(archHookCtx, m.base())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -66,8 +66,8 @@ type registerMutatorsContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RegisterMutatorsContext interface {
|
type RegisterMutatorsContext interface {
|
||||||
TopDown(name string, m AndroidTopDownMutator) MutatorHandle
|
TopDown(name string, m TopDownMutator) MutatorHandle
|
||||||
BottomUp(name string, m AndroidBottomUpMutator) MutatorHandle
|
BottomUp(name string, m BottomUpMutator) MutatorHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegisterMutatorFunc func(RegisterMutatorsContext)
|
type RegisterMutatorFunc func(RegisterMutatorsContext)
|
||||||
@@ -110,52 +110,27 @@ func PostDepsMutators(f RegisterMutatorFunc) {
|
|||||||
postDeps = append(postDeps, f)
|
postDeps = append(postDeps, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
type AndroidTopDownMutator func(TopDownMutatorContext)
|
type TopDownMutator func(TopDownMutatorContext)
|
||||||
|
|
||||||
type TopDownMutatorContext interface {
|
type TopDownMutatorContext interface {
|
||||||
BaseModuleContext
|
BaseModuleContext
|
||||||
androidBaseContext
|
|
||||||
|
|
||||||
OtherModuleExists(name string) bool
|
|
||||||
Rename(name string)
|
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{})
|
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 {
|
type topDownMutatorContext struct {
|
||||||
blueprint.TopDownMutatorContext
|
bp blueprint.TopDownMutatorContext
|
||||||
androidBaseContextImpl
|
baseModuleContext
|
||||||
walkPath []Module
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AndroidBottomUpMutator func(BottomUpMutatorContext)
|
type BottomUpMutator func(BottomUpMutatorContext)
|
||||||
|
|
||||||
type BottomUpMutatorContext interface {
|
type BottomUpMutatorContext interface {
|
||||||
BaseModuleContext
|
BaseModuleContext
|
||||||
androidBaseContext
|
|
||||||
|
|
||||||
OtherModuleExists(name string) bool
|
|
||||||
Rename(name string)
|
Rename(name string)
|
||||||
Module() blueprint.Module
|
|
||||||
|
|
||||||
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string)
|
AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string)
|
||||||
AddReverseDependency(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)
|
ReplaceDependencies(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type androidBottomUpMutatorContext struct {
|
type bottomUpMutatorContext struct {
|
||||||
blueprint.BottomUpMutatorContext
|
bp blueprint.BottomUpMutatorContext
|
||||||
androidBaseContextImpl
|
baseModuleContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *registerMutatorsContext) BottomUp(name string, m AndroidBottomUpMutator) MutatorHandle {
|
func (x *registerMutatorsContext) BottomUp(name string, m BottomUpMutator) MutatorHandle {
|
||||||
f := func(ctx blueprint.BottomUpMutatorContext) {
|
f := func(ctx blueprint.BottomUpMutatorContext) {
|
||||||
if a, ok := ctx.Module().(Module); ok {
|
if a, ok := ctx.Module().(Module); ok {
|
||||||
actx := &androidBottomUpMutatorContext{
|
actx := &bottomUpMutatorContext{
|
||||||
BottomUpMutatorContext: ctx,
|
bp: ctx,
|
||||||
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
|
baseModuleContext: a.base().baseModuleContextFactory(ctx),
|
||||||
}
|
}
|
||||||
m(actx)
|
m(actx)
|
||||||
}
|
}
|
||||||
@@ -188,12 +163,12 @@ func (x *registerMutatorsContext) BottomUp(name string, m AndroidBottomUpMutator
|
|||||||
return mutator
|
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) {
|
f := func(ctx blueprint.TopDownMutatorContext) {
|
||||||
if a, ok := ctx.Module().(Module); ok {
|
if a, ok := ctx.Module().(Module); ok {
|
||||||
actx := &androidTopDownMutatorContext{
|
actx := &topDownMutatorContext{
|
||||||
TopDownMutatorContext: ctx,
|
bp: ctx,
|
||||||
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
|
baseModuleContext: a.base().baseModuleContextFactory(ctx),
|
||||||
}
|
}
|
||||||
m(actx)
|
m(actx)
|
||||||
}
|
}
|
||||||
@@ -218,106 +193,13 @@ func depsMutator(ctx BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidTopDownMutatorContext) Config() Config {
|
func (t *topDownMutatorContext) AppendProperties(props ...interface{}) {
|
||||||
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{}) {
|
|
||||||
for _, p := range props {
|
for _, p := range props {
|
||||||
err := proptools.AppendMatchingProperties(a.Module().base().customizableProperties,
|
err := proptools.AppendMatchingProperties(t.Module().base().customizableProperties,
|
||||||
p, nil)
|
p, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
||||||
a.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
|
t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
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 {
|
for _, p := range props {
|
||||||
err := proptools.PrependMatchingProperties(a.Module().base().customizableProperties,
|
err := proptools.PrependMatchingProperties(t.Module().base().customizableProperties,
|
||||||
p, nil)
|
p, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
||||||
a.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
|
t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
|
||||||
} else {
|
} else {
|
||||||
panic(err)
|
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)
|
||||||
|
}
|
||||||
|
@@ -41,9 +41,7 @@ var _ PathContext = SingletonContext(nil)
|
|||||||
var _ PathContext = ModuleContext(nil)
|
var _ PathContext = ModuleContext(nil)
|
||||||
|
|
||||||
type ModuleInstallPathContext interface {
|
type ModuleInstallPathContext interface {
|
||||||
PathContext
|
BaseModuleContext
|
||||||
|
|
||||||
androidBaseContext
|
|
||||||
|
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
InstallInSanitizerDir() 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.
|
// 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
|
// It intended for use in globs that only list files that exist, so it allows '$' in
|
||||||
// filenames.
|
// 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()) + "/"
|
prefix := filepath.Join(ctx.Config().srcDir, ctx.ModuleDir()) + "/"
|
||||||
if prefix == "./" {
|
if prefix == "./" {
|
||||||
prefix = ""
|
prefix = ""
|
||||||
|
@@ -200,7 +200,7 @@ func p(in interface{}) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type moduleInstallPathContextImpl struct {
|
type moduleInstallPathContextImpl struct {
|
||||||
androidBaseContextImpl
|
baseModuleContext
|
||||||
|
|
||||||
inData bool
|
inData bool
|
||||||
inSanitizerDir bool
|
inSanitizerDir bool
|
||||||
@@ -212,7 +212,7 @@ func (moduleInstallPathContextImpl) Fs() pathtools.FileSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m moduleInstallPathContextImpl) Config() Config {
|
func (m moduleInstallPathContextImpl) Config() Config {
|
||||||
return m.androidBaseContextImpl.config
|
return m.baseModuleContext.config
|
||||||
}
|
}
|
||||||
|
|
||||||
func (moduleInstallPathContextImpl) AddNinjaFileDeps(deps ...string) {}
|
func (moduleInstallPathContextImpl) AddNinjaFileDeps(deps ...string) {}
|
||||||
@@ -244,7 +244,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "host binary",
|
name: "host binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: hostTarget,
|
target: hostTarget,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -255,7 +255,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "system binary",
|
name: "system binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -265,7 +265,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "vendor binary",
|
name: "vendor binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: socSpecificModule,
|
kind: socSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -276,7 +276,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "odm binary",
|
name: "odm binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: deviceSpecificModule,
|
kind: deviceSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -287,7 +287,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "product binary",
|
name: "product binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productSpecificModule,
|
kind: productSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -298,7 +298,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "product_services binary",
|
name: "product_services binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productServicesSpecificModule,
|
kind: productServicesSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -310,7 +310,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "system native test binary",
|
name: "system native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
},
|
},
|
||||||
inData: true,
|
inData: true,
|
||||||
@@ -321,7 +321,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "vendor native test binary",
|
name: "vendor native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: socSpecificModule,
|
kind: socSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -333,7 +333,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "odm native test binary",
|
name: "odm native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: deviceSpecificModule,
|
kind: deviceSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -345,7 +345,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "product native test binary",
|
name: "product native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productSpecificModule,
|
kind: productSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -358,7 +358,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "product_services native test binary",
|
name: "product_services native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productServicesSpecificModule,
|
kind: productServicesSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -371,7 +371,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized system binary",
|
name: "sanitized system binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
},
|
},
|
||||||
inSanitizerDir: true,
|
inSanitizerDir: true,
|
||||||
@@ -382,7 +382,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized vendor binary",
|
name: "sanitized vendor binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: socSpecificModule,
|
kind: socSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -394,7 +394,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized odm binary",
|
name: "sanitized odm binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: deviceSpecificModule,
|
kind: deviceSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -406,7 +406,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized product binary",
|
name: "sanitized product binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productSpecificModule,
|
kind: productSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -419,7 +419,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized product_services binary",
|
name: "sanitized product_services binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productServicesSpecificModule,
|
kind: productServicesSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -432,7 +432,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized system native test binary",
|
name: "sanitized system native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
},
|
},
|
||||||
inData: true,
|
inData: true,
|
||||||
@@ -444,7 +444,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized vendor native test binary",
|
name: "sanitized vendor native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: socSpecificModule,
|
kind: socSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -457,7 +457,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized odm native test binary",
|
name: "sanitized odm native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: deviceSpecificModule,
|
kind: deviceSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -470,7 +470,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized product native test binary",
|
name: "sanitized product native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productSpecificModule,
|
kind: productSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -483,7 +483,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "sanitized product_services native test binary",
|
name: "sanitized product_services native test binary",
|
||||||
ctx: &moduleInstallPathContextImpl{
|
ctx: &moduleInstallPathContextImpl{
|
||||||
androidBaseContextImpl: androidBaseContextImpl{
|
baseModuleContext: baseModuleContext{
|
||||||
target: deviceTarget,
|
target: deviceTarget,
|
||||||
kind: productServicesSpecificModule,
|
kind: productServicesSpecificModule,
|
||||||
},
|
},
|
||||||
@@ -497,7 +497,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
tc.ctx.androidBaseContextImpl.config = testConfig
|
tc.ctx.baseModuleContext.config = testConfig
|
||||||
output := PathForModuleInstall(tc.ctx, tc.in...)
|
output := PathForModuleInstall(tc.ctx, tc.in...)
|
||||||
if output.basePath.path != tc.out {
|
if output.basePath.path != tc.out {
|
||||||
t.Errorf("unexpected path:\n got: %q\nwant: %q\n",
|
t.Errorf("unexpected path:\n got: %q\nwant: %q\n",
|
||||||
|
@@ -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{}) {
|
prefix string, productVariablePropertyValue reflect.Value, variableValue interface{}) {
|
||||||
|
|
||||||
printfIntoProperties(ctx, prefix, productVariablePropertyValue, variableValue)
|
printfIntoProperties(ctx, prefix, productVariablePropertyValue, variableValue)
|
||||||
|
|
||||||
err := proptools.AppendMatchingProperties(a.generalProperties,
|
err := proptools.AppendMatchingProperties(m.generalProperties,
|
||||||
productVariablePropertyValue.Addr().Interface(), nil)
|
productVariablePropertyValue.Addr().Interface(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
||||||
|
@@ -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())
|
certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(ctx.ModuleName())
|
||||||
if overridden {
|
if overridden {
|
||||||
return ":" + certificate
|
return ":" + certificate
|
||||||
|
8
cc/cc.go
8
cc/cc.go
@@ -278,7 +278,7 @@ type ModuleContext interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BaseModuleContext interface {
|
type BaseModuleContext interface {
|
||||||
android.BaseContext
|
android.BaseModuleContext
|
||||||
ModuleContextIntf
|
ModuleContextIntf
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,7 +641,7 @@ func installToBootstrap(name string, config android.Config) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type baseModuleContext struct {
|
type baseModuleContext struct {
|
||||||
android.BaseContext
|
android.BaseModuleContext
|
||||||
moduleContextImpl
|
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 {
|
if c.cachedToolchain == nil {
|
||||||
c.cachedToolchain = config.FindToolchain(ctx.Os(), ctx.Arch())
|
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) {
|
func (c *Module) beginMutator(actx android.BottomUpMutatorContext) {
|
||||||
ctx := &baseModuleContext{
|
ctx := &baseModuleContext{
|
||||||
BaseContext: actx,
|
BaseModuleContext: actx,
|
||||||
moduleContextImpl: moduleContextImpl{
|
moduleContextImpl: moduleContextImpl{
|
||||||
mod: c,
|
mod: c,
|
||||||
},
|
},
|
||||||
|
@@ -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) {
|
arch android.Arch) (string, error) {
|
||||||
|
|
||||||
if apiLevel == "current" {
|
if apiLevel == "current" {
|
||||||
@@ -167,7 +167,7 @@ func getFirstGeneratedVersion(firstSupportedVersion string, platformVersion int)
|
|||||||
return strconv.Atoi(firstSupportedVersion)
|
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.
|
// unversioned_until is normally empty, in which case we should use the version script.
|
||||||
if String(stub.properties.Unversioned_until) == "" {
|
if String(stub.properties.Unversioned_until) == "" {
|
||||||
return true, nil
|
return true, nil
|
||||||
|
@@ -482,7 +482,7 @@ func collectAppDeps(ctx android.ModuleContext) ([]jniLib, []Certificate) {
|
|||||||
return jniLibs, certificates
|
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())
|
certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(ctx.ModuleName())
|
||||||
if overridden {
|
if overridden {
|
||||||
return ":" + certificate
|
return ":" + certificate
|
||||||
|
@@ -380,8 +380,8 @@ type Dependency interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SdkLibraryDependency interface {
|
type SdkLibraryDependency interface {
|
||||||
SdkHeaderJars(ctx android.BaseContext, sdkVersion string) android.Paths
|
SdkHeaderJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths
|
||||||
SdkImplementationJars(ctx android.BaseContext, sdkVersion string) android.Paths
|
SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
type SrcDependency interface {
|
type SrcDependency interface {
|
||||||
@@ -448,11 +448,11 @@ type jniLib struct {
|
|||||||
target android.Target
|
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")
|
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) &&
|
return j.shouldInstrument(ctx) &&
|
||||||
(ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_STATIC") ||
|
(ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_STATIC") ||
|
||||||
ctx.Config().UnbundledBuild())
|
ctx.Config().UnbundledBuild())
|
||||||
|
@@ -46,7 +46,7 @@ type sdkContext interface {
|
|||||||
targetSdkVersion() string
|
targetSdkVersion() string
|
||||||
}
|
}
|
||||||
|
|
||||||
func sdkVersionOrDefault(ctx android.BaseContext, v string) string {
|
func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
|
||||||
switch v {
|
switch v {
|
||||||
case "", "current", "system_current", "test_current", "core_current":
|
case "", "current", "system_current", "test_current", "core_current":
|
||||||
return ctx.Config().DefaultAppTargetSdk()
|
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)
|
// 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).
|
// 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 {
|
switch v {
|
||||||
case "", "current", "test_current", "system_current", "core_current":
|
case "", "current", "test_current", "system_current", "core_current":
|
||||||
return ctx.Config().DefaultAppTargetSdkInt(), nil
|
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)
|
n, err := sdkVersionToNumber(ctx, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -79,7 +79,7 @@ func sdkVersionToNumberAsString(ctx android.BaseContext, v string) (string, erro
|
|||||||
return strconv.Itoa(n), nil
|
return strconv.Itoa(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeSdkDep(ctx android.BaseContext, sdkContext sdkContext) sdkDep {
|
func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
||||||
v := sdkContext.sdkVersion()
|
v := sdkContext.sdkVersion()
|
||||||
// For PDK builds, use the latest SDK version instead of "current"
|
// For PDK builds, use the latest SDK version instead of "current"
|
||||||
if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {
|
if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {
|
||||||
|
@@ -591,7 +591,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) {
|
|||||||
mctx.CreateModule(android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory), &etcProps)
|
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
|
var api, v string
|
||||||
if sdkVersion == "" {
|
if sdkVersion == "" {
|
||||||
api = "system"
|
api = "system"
|
||||||
@@ -615,7 +615,7 @@ func (module *SdkLibrary) PrebuiltJars(ctx android.BaseContext, sdkVersion strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to satisfy SdkLibraryDependency interface
|
// 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.
|
// This module is just a wrapper for the stubs.
|
||||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||||
return module.PrebuiltJars(ctx, sdkVersion)
|
return module.PrebuiltJars(ctx, sdkVersion)
|
||||||
@@ -631,7 +631,7 @@ func (module *SdkLibrary) SdkHeaderJars(ctx android.BaseContext, sdkVersion stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to satisfy SdkLibraryDependency interface
|
// 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.
|
// This module is just a wrapper for the stubs.
|
||||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||||
return module.PrebuiltJars(ctx, sdkVersion)
|
return module.PrebuiltJars(ctx, sdkVersion)
|
||||||
@@ -840,13 +840,13 @@ func (module *sdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to satisfy SdkLibraryDependency interface
|
// 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.
|
// This module is just a wrapper for the prebuilt stubs.
|
||||||
return module.stubsPath
|
return module.stubsPath
|
||||||
}
|
}
|
||||||
|
|
||||||
// to satisfy SdkLibraryDependency interface
|
// 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.
|
// This module is just a wrapper for the stubs.
|
||||||
return module.stubsPath
|
return module.stubsPath
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user