Remove repetition in android package names
Types in the android package don't need to be prefixed with 'android'. Test: m checkbuild Change-Id: Ieefcfc1a2c4161d9c412f40ef31867149ec21aec
This commit is contained in:
@@ -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())
|
||||
}
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ type BuildParams struct {
|
||||
|
||||
type ModuleBuildParams BuildParams
|
||||
|
||||
type androidBaseContext interface {
|
||||
type baseContext interface {
|
||||
Target() Target
|
||||
TargetPrimary() bool
|
||||
MultiTargets() []Target
|
||||
@@ -80,7 +80,7 @@ type androidBaseContext interface {
|
||||
|
||||
type BaseContext interface {
|
||||
BaseModuleContext
|
||||
androidBaseContext
|
||||
baseContext
|
||||
}
|
||||
|
||||
// BaseModuleContext is the same as blueprint.BaseModuleContext except that Config() returns
|
||||
@@ -108,7 +108,7 @@ type BaseModuleContext interface {
|
||||
}
|
||||
|
||||
type ModuleContext interface {
|
||||
androidBaseContext
|
||||
baseContext
|
||||
BaseModuleContext
|
||||
|
||||
// Deprecated: use ModuleContext.Build instead.
|
||||
@@ -457,9 +457,9 @@ func InitAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupported, defa
|
||||
// The ModuleBase type is responsible for implementing the GenerateBuildActions
|
||||
// method to support the blueprint.Module interface. This method will then call
|
||||
// the module's GenerateAndroidBuildActions method once for each build variant
|
||||
// that is to be built. GenerateAndroidBuildActions is passed a
|
||||
// AndroidModuleContext rather than the usual blueprint.ModuleContext.
|
||||
// AndroidModuleContext exposes extra functionality specific to the Android build
|
||||
// that is to be built. GenerateAndroidBuildActions is passed a ModuleContext
|
||||
// rather than the usual blueprint.ModuleContext.
|
||||
// ModuleContext exposes extra functionality specific to the Android build
|
||||
// system including details about the particular build variant that is to be
|
||||
// generated.
|
||||
//
|
||||
@@ -826,8 +826,8 @@ func determineModuleKind(a *ModuleBase, ctx blueprint.BaseModuleContext) moduleK
|
||||
}
|
||||
}
|
||||
|
||||
func (a *ModuleBase) androidBaseContextFactory(ctx blueprint.BaseModuleContext) androidBaseContextImpl {
|
||||
return androidBaseContextImpl{
|
||||
func (a *ModuleBase) baseContextFactory(ctx blueprint.BaseModuleContext) baseContextImpl {
|
||||
return baseContextImpl{
|
||||
target: a.commonProperties.CompileTarget,
|
||||
targetPrimary: a.commonProperties.CompilePrimary,
|
||||
multiTargets: a.commonProperties.CompileMultiTargets,
|
||||
@@ -837,14 +837,14 @@ func (a *ModuleBase) androidBaseContextFactory(ctx blueprint.BaseModuleContext)
|
||||
}
|
||||
|
||||
func (a *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
|
||||
ctx := &androidModuleContext{
|
||||
module: a.module,
|
||||
ModuleContext: blueprintCtx,
|
||||
androidBaseContextImpl: a.androidBaseContextFactory(blueprintCtx),
|
||||
installDeps: a.computeInstallDeps(blueprintCtx),
|
||||
installFiles: a.installFiles,
|
||||
missingDeps: blueprintCtx.GetMissingDependencies(),
|
||||
variables: make(map[string]string),
|
||||
ctx := &moduleContext{
|
||||
module: a.module,
|
||||
ModuleContext: blueprintCtx,
|
||||
baseContextImpl: a.baseContextFactory(blueprintCtx),
|
||||
installDeps: a.computeInstallDeps(blueprintCtx),
|
||||
installFiles: a.installFiles,
|
||||
missingDeps: blueprintCtx.GetMissingDependencies(),
|
||||
variables: make(map[string]string),
|
||||
}
|
||||
|
||||
if ctx.config.captureBuild {
|
||||
@@ -917,7 +917,7 @@ func (a *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
a.variables = ctx.variables
|
||||
}
|
||||
|
||||
type androidBaseContextImpl struct {
|
||||
type baseContextImpl struct {
|
||||
target Target
|
||||
multiTargets []Target
|
||||
targetPrimary bool
|
||||
@@ -926,9 +926,9 @@ type androidBaseContextImpl struct {
|
||||
config Config
|
||||
}
|
||||
|
||||
type androidModuleContext struct {
|
||||
type moduleContext struct {
|
||||
blueprint.ModuleContext
|
||||
androidBaseContextImpl
|
||||
baseContextImpl
|
||||
installDeps Paths
|
||||
installFiles Paths
|
||||
checkbuildFiles Paths
|
||||
@@ -941,8 +941,8 @@ type androidModuleContext struct {
|
||||
variables map[string]string
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) ninjaError(desc string, outputs []string, err error) {
|
||||
a.ModuleContext.Build(pctx.PackageContext, blueprint.BuildParams{
|
||||
func (m *moduleContext) ninjaError(desc string, outputs []string, err error) {
|
||||
m.ModuleContext.Build(pctx.PackageContext, blueprint.BuildParams{
|
||||
Rule: ErrorRule,
|
||||
Description: desc,
|
||||
Outputs: outputs,
|
||||
@@ -954,12 +954,12 @@ func (a *androidModuleContext) ninjaError(desc string, outputs []string, err err
|
||||
return
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) Config() Config {
|
||||
return a.ModuleContext.Config().(Config)
|
||||
func (m *moduleContext) Config() Config {
|
||||
return m.ModuleContext.Config().(Config)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) ModuleBuild(pctx PackageContext, params ModuleBuildParams) {
|
||||
a.Build(pctx, BuildParams(params))
|
||||
func (m *moduleContext) ModuleBuild(pctx PackageContext, params ModuleBuildParams) {
|
||||
m.Build(pctx, BuildParams(params))
|
||||
}
|
||||
|
||||
func convertBuildParams(params BuildParams) blueprint.BuildParams {
|
||||
@@ -1002,29 +1002,29 @@ func convertBuildParams(params BuildParams) blueprint.BuildParams {
|
||||
return bparams
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) Variable(pctx PackageContext, name, value string) {
|
||||
if a.config.captureBuild {
|
||||
a.variables[name] = value
|
||||
func (m *moduleContext) Variable(pctx PackageContext, name, value string) {
|
||||
if m.config.captureBuild {
|
||||
m.variables[name] = value
|
||||
}
|
||||
|
||||
a.ModuleContext.Variable(pctx.PackageContext, name, value)
|
||||
m.ModuleContext.Variable(pctx.PackageContext, name, value)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) Rule(pctx PackageContext, name string, params blueprint.RuleParams,
|
||||
func (m *moduleContext) Rule(pctx PackageContext, name string, params blueprint.RuleParams,
|
||||
argNames ...string) blueprint.Rule {
|
||||
|
||||
rule := a.ModuleContext.Rule(pctx.PackageContext, name, params, argNames...)
|
||||
rule := m.ModuleContext.Rule(pctx.PackageContext, name, params, argNames...)
|
||||
|
||||
if a.config.captureBuild {
|
||||
a.ruleParams[rule] = params
|
||||
if m.config.captureBuild {
|
||||
m.ruleParams[rule] = params
|
||||
}
|
||||
|
||||
return rule
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) Build(pctx PackageContext, params BuildParams) {
|
||||
if a.config.captureBuild {
|
||||
a.buildParams = append(a.buildParams, params)
|
||||
func (m *moduleContext) Build(pctx PackageContext, params BuildParams) {
|
||||
if m.config.captureBuild {
|
||||
m.buildParams = append(m.buildParams, params)
|
||||
}
|
||||
|
||||
bparams := convertBuildParams(params)
|
||||
@@ -1033,39 +1033,39 @@ func (a *androidModuleContext) Build(pctx PackageContext, params BuildParams) {
|
||||
bparams.Description = "${moduleDesc}" + params.Description + "${moduleDescSuffix}"
|
||||
}
|
||||
|
||||
if a.missingDeps != nil {
|
||||
a.ninjaError(bparams.Description, bparams.Outputs,
|
||||
if m.missingDeps != nil {
|
||||
m.ninjaError(bparams.Description, bparams.Outputs,
|
||||
fmt.Errorf("module %s missing dependencies: %s\n",
|
||||
a.ModuleName(), strings.Join(a.missingDeps, ", ")))
|
||||
m.ModuleName(), strings.Join(m.missingDeps, ", ")))
|
||||
return
|
||||
}
|
||||
|
||||
a.ModuleContext.Build(pctx.PackageContext, bparams)
|
||||
m.ModuleContext.Build(pctx.PackageContext, bparams)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) GetMissingDependencies() []string {
|
||||
return a.missingDeps
|
||||
func (m *moduleContext) GetMissingDependencies() []string {
|
||||
return m.missingDeps
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) AddMissingDependencies(deps []string) {
|
||||
func (m *moduleContext) AddMissingDependencies(deps []string) {
|
||||
if deps != nil {
|
||||
a.missingDeps = append(a.missingDeps, deps...)
|
||||
a.missingDeps = FirstUniqueStrings(a.missingDeps)
|
||||
m.missingDeps = append(m.missingDeps, deps...)
|
||||
m.missingDeps = FirstUniqueStrings(m.missingDeps)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) validateAndroidModule(module blueprint.Module) Module {
|
||||
func (m *moduleContext) validateAndroidModule(module blueprint.Module) Module {
|
||||
aModule, _ := module.(Module)
|
||||
if aModule == nil {
|
||||
a.ModuleErrorf("module %q not an android module", a.OtherModuleName(aModule))
|
||||
m.ModuleErrorf("module %q not an android module", m.OtherModuleName(aModule))
|
||||
return nil
|
||||
}
|
||||
|
||||
if !aModule.Enabled() {
|
||||
if a.Config().AllowMissingDependencies() {
|
||||
a.AddMissingDependencies([]string{a.OtherModuleName(aModule)})
|
||||
if m.Config().AllowMissingDependencies() {
|
||||
m.AddMissingDependencies([]string{m.OtherModuleName(aModule)})
|
||||
} else {
|
||||
a.ModuleErrorf("depends on disabled module %q", a.OtherModuleName(aModule))
|
||||
m.ModuleErrorf("depends on disabled module %q", m.OtherModuleName(aModule))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1073,15 +1073,15 @@ func (a *androidModuleContext) validateAndroidModule(module blueprint.Module) Mo
|
||||
return aModule
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) getDirectDepInternal(name string, tag blueprint.DependencyTag) (blueprint.Module, blueprint.DependencyTag) {
|
||||
func (m *moduleContext) getDirectDepInternal(name string, tag blueprint.DependencyTag) (blueprint.Module, blueprint.DependencyTag) {
|
||||
type dep struct {
|
||||
mod blueprint.Module
|
||||
tag blueprint.DependencyTag
|
||||
}
|
||||
var deps []dep
|
||||
a.VisitDirectDepsBlueprint(func(m blueprint.Module) {
|
||||
if aModule, _ := m.(Module); aModule != nil && aModule.base().BaseModuleName() == name {
|
||||
returnedTag := a.ModuleContext.OtherModuleDependencyTag(aModule)
|
||||
m.VisitDirectDepsBlueprint(func(module blueprint.Module) {
|
||||
if aModule, _ := module.(Module); aModule != nil && aModule.base().BaseModuleName() == name {
|
||||
returnedTag := m.ModuleContext.OtherModuleDependencyTag(aModule)
|
||||
if tag == nil || returnedTag == tag {
|
||||
deps = append(deps, dep{aModule, returnedTag})
|
||||
}
|
||||
@@ -1091,17 +1091,17 @@ func (a *androidModuleContext) getDirectDepInternal(name string, tag blueprint.D
|
||||
return deps[0].mod, deps[0].tag
|
||||
} else if len(deps) >= 2 {
|
||||
panic(fmt.Errorf("Multiple dependencies having same BaseModuleName() %q found from %q",
|
||||
name, a.ModuleName()))
|
||||
name, m.ModuleName()))
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) GetDirectDepsWithTag(tag blueprint.DependencyTag) []Module {
|
||||
func (m *moduleContext) GetDirectDepsWithTag(tag blueprint.DependencyTag) []Module {
|
||||
var deps []Module
|
||||
a.VisitDirectDepsBlueprint(func(m blueprint.Module) {
|
||||
if aModule, _ := m.(Module); aModule != nil {
|
||||
if a.ModuleContext.OtherModuleDependencyTag(aModule) == tag {
|
||||
m.VisitDirectDepsBlueprint(func(module blueprint.Module) {
|
||||
if aModule, _ := module.(Module); aModule != nil {
|
||||
if m.ModuleContext.OtherModuleDependencyTag(aModule) == tag {
|
||||
deps = append(deps, aModule)
|
||||
}
|
||||
}
|
||||
@@ -1109,42 +1109,42 @@ func (a *androidModuleContext) GetDirectDepsWithTag(tag blueprint.DependencyTag)
|
||||
return deps
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module {
|
||||
m, _ := a.getDirectDepInternal(name, tag)
|
||||
return m
|
||||
func (m *moduleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module {
|
||||
module, _ := m.getDirectDepInternal(name, tag)
|
||||
return module
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag) {
|
||||
return a.getDirectDepInternal(name, nil)
|
||||
func (m *moduleContext) GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag) {
|
||||
return m.getDirectDepInternal(name, nil)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitDirectDepsBlueprint(visit func(blueprint.Module)) {
|
||||
a.ModuleContext.VisitDirectDeps(visit)
|
||||
func (m *moduleContext) VisitDirectDepsBlueprint(visit func(blueprint.Module)) {
|
||||
m.ModuleContext.VisitDirectDeps(visit)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitDirectDeps(visit func(Module)) {
|
||||
a.ModuleContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||
func (m *moduleContext) VisitDirectDeps(visit func(Module)) {
|
||||
m.ModuleContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||
if aModule := m.validateAndroidModule(module); aModule != nil {
|
||||
visit(aModule)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module)) {
|
||||
a.ModuleContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||
if a.ModuleContext.OtherModuleDependencyTag(aModule) == tag {
|
||||
func (m *moduleContext) VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module)) {
|
||||
m.ModuleContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||
if aModule := m.validateAndroidModule(module); aModule != nil {
|
||||
if m.ModuleContext.OtherModuleDependencyTag(aModule) == tag {
|
||||
visit(aModule)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
|
||||
a.ModuleContext.VisitDirectDepsIf(
|
||||
func (m *moduleContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
|
||||
m.ModuleContext.VisitDirectDepsIf(
|
||||
// pred
|
||||
func(module blueprint.Module) bool {
|
||||
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||
if aModule := m.validateAndroidModule(module); aModule != nil {
|
||||
return pred(aModule)
|
||||
} else {
|
||||
return false
|
||||
@@ -1156,19 +1156,19 @@ func (a *androidModuleContext) VisitDirectDepsIf(pred func(Module) bool, visit f
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitDepsDepthFirst(visit func(Module)) {
|
||||
a.ModuleContext.VisitDepsDepthFirst(func(module blueprint.Module) {
|
||||
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||
func (m *moduleContext) VisitDepsDepthFirst(visit func(Module)) {
|
||||
m.ModuleContext.VisitDepsDepthFirst(func(module blueprint.Module) {
|
||||
if aModule := m.validateAndroidModule(module); aModule != nil {
|
||||
visit(aModule)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
|
||||
a.ModuleContext.VisitDepsDepthFirstIf(
|
||||
func (m *moduleContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
|
||||
m.ModuleContext.VisitDepsDepthFirstIf(
|
||||
// pred
|
||||
func(module blueprint.Module) bool {
|
||||
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||
if aModule := m.validateAndroidModule(module); aModule != nil {
|
||||
return pred(aModule)
|
||||
} else {
|
||||
return false
|
||||
@@ -1180,14 +1180,14 @@ func (a *androidModuleContext) VisitDepsDepthFirstIf(pred func(Module) bool, vis
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) WalkDepsBlueprint(visit func(blueprint.Module, blueprint.Module) bool) {
|
||||
a.ModuleContext.WalkDeps(visit)
|
||||
func (m *moduleContext) WalkDepsBlueprint(visit func(blueprint.Module, blueprint.Module) bool) {
|
||||
m.ModuleContext.WalkDeps(visit)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) WalkDeps(visit func(Module, Module) bool) {
|
||||
a.ModuleContext.WalkDeps(func(child, parent blueprint.Module) bool {
|
||||
childAndroidModule := a.validateAndroidModule(child)
|
||||
parentAndroidModule := a.validateAndroidModule(parent)
|
||||
func (m *moduleContext) WalkDeps(visit func(Module, Module) bool) {
|
||||
m.ModuleContext.WalkDeps(func(child, parent blueprint.Module) bool {
|
||||
childAndroidModule := m.validateAndroidModule(child)
|
||||
parentAndroidModule := m.validateAndroidModule(parent)
|
||||
if childAndroidModule != nil && parentAndroidModule != nil {
|
||||
return visit(childAndroidModule, parentAndroidModule)
|
||||
} else {
|
||||
@@ -1196,97 +1196,97 @@ func (a *androidModuleContext) WalkDeps(visit func(Module, Module) bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) VisitAllModuleVariants(visit func(Module)) {
|
||||
a.ModuleContext.VisitAllModuleVariants(func(module blueprint.Module) {
|
||||
func (m *moduleContext) VisitAllModuleVariants(visit func(Module)) {
|
||||
m.ModuleContext.VisitAllModuleVariants(func(module blueprint.Module) {
|
||||
visit(module.(Module))
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) PrimaryModule() Module {
|
||||
return a.ModuleContext.PrimaryModule().(Module)
|
||||
func (m *moduleContext) PrimaryModule() Module {
|
||||
return m.ModuleContext.PrimaryModule().(Module)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) FinalModule() Module {
|
||||
return a.ModuleContext.FinalModule().(Module)
|
||||
func (m *moduleContext) FinalModule() Module {
|
||||
return m.ModuleContext.FinalModule().(Module)
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Target() Target {
|
||||
return a.target
|
||||
func (b *baseContextImpl) Target() Target {
|
||||
return b.target
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) TargetPrimary() bool {
|
||||
return a.targetPrimary
|
||||
func (b *baseContextImpl) TargetPrimary() bool {
|
||||
return b.targetPrimary
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) MultiTargets() []Target {
|
||||
return a.multiTargets
|
||||
func (b *baseContextImpl) MultiTargets() []Target {
|
||||
return b.multiTargets
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Arch() Arch {
|
||||
return a.target.Arch
|
||||
func (b *baseContextImpl) Arch() Arch {
|
||||
return b.target.Arch
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Os() OsType {
|
||||
return a.target.Os
|
||||
func (b *baseContextImpl) Os() OsType {
|
||||
return b.target.Os
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Host() bool {
|
||||
return a.target.Os.Class == Host || a.target.Os.Class == HostCross
|
||||
func (b *baseContextImpl) Host() bool {
|
||||
return b.target.Os.Class == Host || b.target.Os.Class == HostCross
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Device() bool {
|
||||
return a.target.Os.Class == Device
|
||||
func (b *baseContextImpl) Device() bool {
|
||||
return b.target.Os.Class == Device
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Darwin() bool {
|
||||
return a.target.Os == Darwin
|
||||
func (b *baseContextImpl) Darwin() bool {
|
||||
return b.target.Os == Darwin
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Fuchsia() bool {
|
||||
return a.target.Os == Fuchsia
|
||||
func (b *baseContextImpl) Fuchsia() bool {
|
||||
return b.target.Os == Fuchsia
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Windows() bool {
|
||||
return a.target.Os == Windows
|
||||
func (b *baseContextImpl) Windows() bool {
|
||||
return b.target.Os == Windows
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Debug() bool {
|
||||
return a.debug
|
||||
func (b *baseContextImpl) Debug() bool {
|
||||
return b.debug
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) PrimaryArch() bool {
|
||||
if len(a.config.Targets[a.target.Os]) <= 1 {
|
||||
func (b *baseContextImpl) PrimaryArch() bool {
|
||||
if len(b.config.Targets[b.target.Os]) <= 1 {
|
||||
return true
|
||||
}
|
||||
return a.target.Arch.ArchType == a.config.Targets[a.target.Os][0].Arch.ArchType
|
||||
return b.target.Arch.ArchType == b.config.Targets[b.target.Os][0].Arch.ArchType
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) AConfig() Config {
|
||||
return a.config
|
||||
func (b *baseContextImpl) AConfig() Config {
|
||||
return b.config
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) DeviceConfig() DeviceConfig {
|
||||
return DeviceConfig{a.config.deviceConfig}
|
||||
func (b *baseContextImpl) DeviceConfig() DeviceConfig {
|
||||
return DeviceConfig{b.config.deviceConfig}
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Platform() bool {
|
||||
return a.kind == platformModule
|
||||
func (b *baseContextImpl) Platform() bool {
|
||||
return b.kind == platformModule
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) DeviceSpecific() bool {
|
||||
return a.kind == deviceSpecificModule
|
||||
func (b *baseContextImpl) DeviceSpecific() bool {
|
||||
return b.kind == deviceSpecificModule
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) SocSpecific() bool {
|
||||
return a.kind == socSpecificModule
|
||||
func (b *baseContextImpl) SocSpecific() bool {
|
||||
return b.kind == socSpecificModule
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) ProductSpecific() bool {
|
||||
return a.kind == productSpecificModule
|
||||
func (b *baseContextImpl) ProductSpecific() bool {
|
||||
return b.kind == productSpecificModule
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) ProductServicesSpecific() bool {
|
||||
return a.kind == productServicesSpecificModule
|
||||
func (b *baseContextImpl) ProductServicesSpecific() bool {
|
||||
return b.kind == productServicesSpecificModule
|
||||
}
|
||||
|
||||
// Makes this module a platform module, i.e. not specific to soc, device,
|
||||
@@ -1303,36 +1303,36 @@ func (a *ModuleBase) EnableNativeBridgeSupportByDefault() {
|
||||
a.commonProperties.Native_bridge_supported = boolPtr(true)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) InstallInData() bool {
|
||||
return a.module.InstallInData()
|
||||
func (m *moduleContext) InstallInData() bool {
|
||||
return m.module.InstallInData()
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) InstallInSanitizerDir() bool {
|
||||
return a.module.InstallInSanitizerDir()
|
||||
func (m *moduleContext) InstallInSanitizerDir() bool {
|
||||
return m.module.InstallInSanitizerDir()
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) InstallInRecovery() bool {
|
||||
return a.module.InstallInRecovery()
|
||||
func (m *moduleContext) InstallInRecovery() bool {
|
||||
return m.module.InstallInRecovery()
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) skipInstall(fullInstallPath OutputPath) bool {
|
||||
if a.module.base().commonProperties.SkipInstall {
|
||||
func (m *moduleContext) skipInstall(fullInstallPath OutputPath) bool {
|
||||
if m.module.base().commonProperties.SkipInstall {
|
||||
return true
|
||||
}
|
||||
|
||||
// We'll need a solution for choosing which of modules with the same name in different
|
||||
// namespaces to install. For now, reuse the list of namespaces exported to Make as the
|
||||
// list of namespaces to install in a Soong-only build.
|
||||
if !a.module.base().commonProperties.NamespaceExportedToMake {
|
||||
if !m.module.base().commonProperties.NamespaceExportedToMake {
|
||||
return true
|
||||
}
|
||||
|
||||
if a.Device() {
|
||||
if a.Config().SkipDeviceInstall() {
|
||||
if m.Device() {
|
||||
if m.Config().SkipDeviceInstall() {
|
||||
return true
|
||||
}
|
||||
|
||||
if a.Config().SkipMegaDeviceInstall(fullInstallPath.String()) {
|
||||
if m.Config().SkipMegaDeviceInstall(fullInstallPath.String()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1340,29 +1340,29 @@ func (a *androidModuleContext) skipInstall(fullInstallPath OutputPath) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) InstallFile(installPath OutputPath, name string, srcPath Path,
|
||||
func (m *moduleContext) InstallFile(installPath OutputPath, name string, srcPath Path,
|
||||
deps ...Path) OutputPath {
|
||||
return a.installFile(installPath, name, srcPath, Cp, deps)
|
||||
return m.installFile(installPath, name, srcPath, Cp, deps)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) InstallExecutable(installPath OutputPath, name string, srcPath Path,
|
||||
func (m *moduleContext) InstallExecutable(installPath OutputPath, name string, srcPath Path,
|
||||
deps ...Path) OutputPath {
|
||||
return a.installFile(installPath, name, srcPath, CpExecutable, deps)
|
||||
return m.installFile(installPath, name, srcPath, CpExecutable, deps)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) installFile(installPath OutputPath, name string, srcPath Path,
|
||||
func (m *moduleContext) installFile(installPath OutputPath, name string, srcPath Path,
|
||||
rule blueprint.Rule, deps []Path) OutputPath {
|
||||
|
||||
fullInstallPath := installPath.Join(a, name)
|
||||
a.module.base().hooks.runInstallHooks(a, fullInstallPath, false)
|
||||
fullInstallPath := installPath.Join(m, name)
|
||||
m.module.base().hooks.runInstallHooks(m, fullInstallPath, false)
|
||||
|
||||
if !a.skipInstall(fullInstallPath) {
|
||||
if !m.skipInstall(fullInstallPath) {
|
||||
|
||||
deps = append(deps, a.installDeps...)
|
||||
deps = append(deps, m.installDeps...)
|
||||
|
||||
var implicitDeps, orderOnlyDeps Paths
|
||||
|
||||
if a.Host() {
|
||||
if m.Host() {
|
||||
// Installed host modules might be used during the build, depend directly on their
|
||||
// dependencies so their timestamp is updated whenever their dependency is updated
|
||||
implicitDeps = deps
|
||||
@@ -1370,73 +1370,73 @@ func (a *androidModuleContext) installFile(installPath OutputPath, name string,
|
||||
orderOnlyDeps = deps
|
||||
}
|
||||
|
||||
a.Build(pctx, BuildParams{
|
||||
m.Build(pctx, BuildParams{
|
||||
Rule: rule,
|
||||
Description: "install " + fullInstallPath.Base(),
|
||||
Output: fullInstallPath,
|
||||
Input: srcPath,
|
||||
Implicits: implicitDeps,
|
||||
OrderOnly: orderOnlyDeps,
|
||||
Default: !a.Config().EmbeddedInMake(),
|
||||
Default: !m.Config().EmbeddedInMake(),
|
||||
})
|
||||
|
||||
a.installFiles = append(a.installFiles, fullInstallPath)
|
||||
m.installFiles = append(m.installFiles, fullInstallPath)
|
||||
}
|
||||
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
|
||||
m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
|
||||
return fullInstallPath
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath {
|
||||
fullInstallPath := installPath.Join(a, name)
|
||||
a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
|
||||
func (m *moduleContext) InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath {
|
||||
fullInstallPath := installPath.Join(m, name)
|
||||
m.module.base().hooks.runInstallHooks(m, fullInstallPath, true)
|
||||
|
||||
if !a.skipInstall(fullInstallPath) {
|
||||
if !m.skipInstall(fullInstallPath) {
|
||||
|
||||
relPath, err := filepath.Rel(path.Dir(fullInstallPath.String()), srcPath.String())
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
|
||||
}
|
||||
a.Build(pctx, BuildParams{
|
||||
m.Build(pctx, BuildParams{
|
||||
Rule: Symlink,
|
||||
Description: "install symlink " + fullInstallPath.Base(),
|
||||
Output: fullInstallPath,
|
||||
OrderOnly: Paths{srcPath},
|
||||
Default: !a.Config().EmbeddedInMake(),
|
||||
Default: !m.Config().EmbeddedInMake(),
|
||||
Args: map[string]string{
|
||||
"fromPath": relPath,
|
||||
},
|
||||
})
|
||||
|
||||
a.installFiles = append(a.installFiles, fullInstallPath)
|
||||
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
|
||||
m.installFiles = append(m.installFiles, fullInstallPath)
|
||||
m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
|
||||
}
|
||||
return fullInstallPath
|
||||
}
|
||||
|
||||
// installPath/name -> absPath where absPath might be a path that is available only at runtime
|
||||
// (e.g. /apex/...)
|
||||
func (a *androidModuleContext) InstallAbsoluteSymlink(installPath OutputPath, name string, absPath string) OutputPath {
|
||||
fullInstallPath := installPath.Join(a, name)
|
||||
a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
|
||||
func (m *moduleContext) InstallAbsoluteSymlink(installPath OutputPath, name string, absPath string) OutputPath {
|
||||
fullInstallPath := installPath.Join(m, name)
|
||||
m.module.base().hooks.runInstallHooks(m, fullInstallPath, true)
|
||||
|
||||
if !a.skipInstall(fullInstallPath) {
|
||||
a.Build(pctx, BuildParams{
|
||||
if !m.skipInstall(fullInstallPath) {
|
||||
m.Build(pctx, BuildParams{
|
||||
Rule: Symlink,
|
||||
Description: "install symlink " + fullInstallPath.Base() + " -> " + absPath,
|
||||
Output: fullInstallPath,
|
||||
Default: !a.Config().EmbeddedInMake(),
|
||||
Default: !m.Config().EmbeddedInMake(),
|
||||
Args: map[string]string{
|
||||
"fromPath": absPath,
|
||||
},
|
||||
})
|
||||
|
||||
a.installFiles = append(a.installFiles, fullInstallPath)
|
||||
m.installFiles = append(m.installFiles, fullInstallPath)
|
||||
}
|
||||
return fullInstallPath
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) CheckbuildFile(srcPath Path) {
|
||||
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
|
||||
func (m *moduleContext) CheckbuildFile(srcPath Path) {
|
||||
m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
|
||||
}
|
||||
|
||||
type fileInstaller interface {
|
||||
@@ -1551,54 +1551,54 @@ type HostToolProvider interface {
|
||||
// be tagged with `android:"path" to support automatic source module dependency resolution.
|
||||
//
|
||||
// Deprecated: use PathsForModuleSrc or PathsForModuleSrcExcludes instead.
|
||||
func (ctx *androidModuleContext) ExpandSources(srcFiles, excludes []string) Paths {
|
||||
return PathsForModuleSrcExcludes(ctx, srcFiles, excludes)
|
||||
func (m *moduleContext) ExpandSources(srcFiles, excludes []string) Paths {
|
||||
return PathsForModuleSrcExcludes(m, srcFiles, excludes)
|
||||
}
|
||||
|
||||
// Returns a single path expanded from globs and modules referenced using ":module" syntax. The property must
|
||||
// be tagged with `android:"path" to support automatic source module dependency resolution.
|
||||
//
|
||||
// Deprecated: use PathForModuleSrc instead.
|
||||
func (ctx *androidModuleContext) ExpandSource(srcFile, prop string) Path {
|
||||
return PathForModuleSrc(ctx, srcFile)
|
||||
func (m *moduleContext) ExpandSource(srcFile, prop string) Path {
|
||||
return PathForModuleSrc(m, srcFile)
|
||||
}
|
||||
|
||||
// Returns an optional single path expanded from globs and modules referenced using ":module" syntax if
|
||||
// the srcFile is non-nil. The property must be tagged with `android:"path" to support automatic source module
|
||||
// dependency resolution.
|
||||
func (ctx *androidModuleContext) ExpandOptionalSource(srcFile *string, prop string) OptionalPath {
|
||||
func (m *moduleContext) ExpandOptionalSource(srcFile *string, prop string) OptionalPath {
|
||||
if srcFile != nil {
|
||||
return OptionalPathForPath(PathForModuleSrc(ctx, *srcFile))
|
||||
return OptionalPathForPath(PathForModuleSrc(m, *srcFile))
|
||||
}
|
||||
return OptionalPath{}
|
||||
}
|
||||
|
||||
func (ctx *androidModuleContext) RequiredModuleNames() []string {
|
||||
return ctx.module.base().commonProperties.Required
|
||||
func (m *moduleContext) RequiredModuleNames() []string {
|
||||
return m.module.base().commonProperties.Required
|
||||
}
|
||||
|
||||
func (ctx *androidModuleContext) HostRequiredModuleNames() []string {
|
||||
return ctx.module.base().commonProperties.Host_required
|
||||
func (m *moduleContext) HostRequiredModuleNames() []string {
|
||||
return m.module.base().commonProperties.Host_required
|
||||
}
|
||||
|
||||
func (ctx *androidModuleContext) TargetRequiredModuleNames() []string {
|
||||
return ctx.module.base().commonProperties.Target_required
|
||||
func (m *moduleContext) TargetRequiredModuleNames() []string {
|
||||
return m.module.base().commonProperties.Target_required
|
||||
}
|
||||
|
||||
func (ctx *androidModuleContext) Glob(globPattern string, excludes []string) Paths {
|
||||
ret, err := ctx.GlobWithDeps(globPattern, excludes)
|
||||
func (m *moduleContext) Glob(globPattern string, excludes []string) Paths {
|
||||
ret, err := m.GlobWithDeps(globPattern, excludes)
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("glob: %s", err.Error())
|
||||
m.ModuleErrorf("glob: %s", err.Error())
|
||||
}
|
||||
return pathsForModuleSrcFromFullPath(ctx, ret, true)
|
||||
return pathsForModuleSrcFromFullPath(m, ret, true)
|
||||
}
|
||||
|
||||
func (ctx *androidModuleContext) GlobFiles(globPattern string, excludes []string) Paths {
|
||||
ret, err := ctx.GlobWithDeps(globPattern, excludes)
|
||||
func (m *moduleContext) GlobFiles(globPattern string, excludes []string) Paths {
|
||||
ret, err := m.GlobWithDeps(globPattern, excludes)
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("glob: %s", err.Error())
|
||||
m.ModuleErrorf("glob: %s", err.Error())
|
||||
}
|
||||
return pathsForModuleSrcFromFullPath(ctx, ret, false)
|
||||
return pathsForModuleSrcFromFullPath(m, ret, false)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@@ -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,11 +110,11 @@ func PostDepsMutators(f RegisterMutatorFunc) {
|
||||
postDeps = append(postDeps, f)
|
||||
}
|
||||
|
||||
type AndroidTopDownMutator func(TopDownMutatorContext)
|
||||
type TopDownMutator func(TopDownMutatorContext)
|
||||
|
||||
type TopDownMutatorContext interface {
|
||||
BaseModuleContext
|
||||
androidBaseContext
|
||||
baseContext
|
||||
|
||||
OtherModuleExists(name string) bool
|
||||
Rename(name string)
|
||||
@@ -141,17 +141,17 @@ type TopDownMutatorContext interface {
|
||||
GetWalkPath() []Module
|
||||
}
|
||||
|
||||
type androidTopDownMutatorContext struct {
|
||||
type topDownMutatorContext struct {
|
||||
blueprint.TopDownMutatorContext
|
||||
androidBaseContextImpl
|
||||
baseContextImpl
|
||||
walkPath []Module
|
||||
}
|
||||
|
||||
type AndroidBottomUpMutator func(BottomUpMutatorContext)
|
||||
type BottomUpMutator func(BottomUpMutatorContext)
|
||||
|
||||
type BottomUpMutatorContext interface {
|
||||
BaseModuleContext
|
||||
androidBaseContext
|
||||
baseContext
|
||||
|
||||
OtherModuleExists(name string) bool
|
||||
Rename(name string)
|
||||
@@ -168,17 +168,17 @@ type BottomUpMutatorContext interface {
|
||||
ReplaceDependencies(string)
|
||||
}
|
||||
|
||||
type androidBottomUpMutatorContext struct {
|
||||
type bottomUpMutatorContext struct {
|
||||
blueprint.BottomUpMutatorContext
|
||||
androidBaseContextImpl
|
||||
baseContextImpl
|
||||
}
|
||||
|
||||
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{
|
||||
actx := &bottomUpMutatorContext{
|
||||
BottomUpMutatorContext: ctx,
|
||||
androidBaseContextImpl: a.base().androidBaseContextFactory(ctx),
|
||||
baseContextImpl: a.base().baseContextFactory(ctx),
|
||||
}
|
||||
m(actx)
|
||||
}
|
||||
@@ -188,12 +188,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{
|
||||
TopDownMutatorContext: ctx,
|
||||
baseContextImpl: a.base().baseContextFactory(ctx),
|
||||
}
|
||||
m(actx)
|
||||
}
|
||||
@@ -218,39 +218,39 @@ func depsMutator(ctx BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) Config() Config {
|
||||
return a.config
|
||||
func (t *topDownMutatorContext) Config() Config {
|
||||
return t.config
|
||||
}
|
||||
|
||||
func (a *androidBottomUpMutatorContext) Config() Config {
|
||||
return a.config
|
||||
func (b *bottomUpMutatorContext) Config() Config {
|
||||
return b.config
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) Module() Module {
|
||||
module, _ := a.TopDownMutatorContext.Module().(Module)
|
||||
func (t *topDownMutatorContext) Module() Module {
|
||||
module, _ := t.TopDownMutatorContext.Module().(Module)
|
||||
return module
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) VisitDirectDeps(visit func(Module)) {
|
||||
a.TopDownMutatorContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||
func (t *topDownMutatorContext) VisitDirectDeps(visit func(Module)) {
|
||||
t.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) {
|
||||
func (t *topDownMutatorContext) VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module)) {
|
||||
t.TopDownMutatorContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||
if aModule, _ := module.(Module); aModule != nil {
|
||||
if a.TopDownMutatorContext.OtherModuleDependencyTag(aModule) == tag {
|
||||
if t.TopDownMutatorContext.OtherModuleDependencyTag(aModule) == tag {
|
||||
visit(aModule)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
|
||||
a.TopDownMutatorContext.VisitDirectDepsIf(
|
||||
func (t *topDownMutatorContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
|
||||
t.TopDownMutatorContext.VisitDirectDepsIf(
|
||||
// pred
|
||||
func(module blueprint.Module) bool {
|
||||
if aModule, _ := module.(Module); aModule != nil {
|
||||
@@ -265,16 +265,16 @@ func (a *androidTopDownMutatorContext) VisitDirectDepsIf(pred func(Module) bool,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) VisitDepsDepthFirst(visit func(Module)) {
|
||||
a.TopDownMutatorContext.VisitDepsDepthFirst(func(module blueprint.Module) {
|
||||
func (t *topDownMutatorContext) VisitDepsDepthFirst(visit func(Module)) {
|
||||
t.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(
|
||||
func (t *topDownMutatorContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
|
||||
t.TopDownMutatorContext.VisitDepsDepthFirstIf(
|
||||
// pred
|
||||
func(module blueprint.Module) bool {
|
||||
if aModule, _ := module.(Module); aModule != nil {
|
||||
@@ -289,17 +289,17 @@ func (a *androidTopDownMutatorContext) VisitDepsDepthFirstIf(pred func(Module) b
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool) {
|
||||
a.walkPath = []Module{a.Module()}
|
||||
a.TopDownMutatorContext.WalkDeps(func(child, parent blueprint.Module) bool {
|
||||
func (t *topDownMutatorContext) WalkDeps(visit func(Module, Module) bool) {
|
||||
t.walkPath = []Module{t.Module()}
|
||||
t.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]
|
||||
for t.walkPath[len(t.walkPath)-1] != parentAndroidModule {
|
||||
t.walkPath = t.walkPath[0 : len(t.walkPath)-1]
|
||||
}
|
||||
a.walkPath = append(a.walkPath, childAndroidModule)
|
||||
t.walkPath = append(t.walkPath, childAndroidModule)
|
||||
return visit(childAndroidModule, parentAndroidModule)
|
||||
} else {
|
||||
return false
|
||||
@@ -307,17 +307,17 @@ func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool)
|
||||
})
|
||||
}
|
||||
|
||||
func (a *androidTopDownMutatorContext) GetWalkPath() []Module {
|
||||
return a.walkPath
|
||||
func (t *topDownMutatorContext) GetWalkPath() []Module {
|
||||
return t.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,13 +325,13 @@ 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)
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ var _ PathContext = ModuleContext(nil)
|
||||
type ModuleInstallPathContext interface {
|
||||
PathContext
|
||||
|
||||
androidBaseContext
|
||||
baseContext
|
||||
|
||||
InstallInData() bool
|
||||
InstallInSanitizerDir() bool
|
||||
|
@@ -200,7 +200,7 @@ func p(in interface{}) string {
|
||||
}
|
||||
|
||||
type moduleInstallPathContextImpl struct {
|
||||
androidBaseContextImpl
|
||||
baseContextImpl
|
||||
|
||||
inData bool
|
||||
inSanitizerDir bool
|
||||
@@ -212,7 +212,7 @@ func (moduleInstallPathContextImpl) Fs() pathtools.FileSystem {
|
||||
}
|
||||
|
||||
func (m moduleInstallPathContextImpl) Config() Config {
|
||||
return m.androidBaseContextImpl.config
|
||||
return m.baseContextImpl.config
|
||||
}
|
||||
|
||||
func (moduleInstallPathContextImpl) AddNinjaFileDeps(deps ...string) {}
|
||||
@@ -244,7 +244,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "host binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: hostTarget,
|
||||
},
|
||||
},
|
||||
@@ -255,7 +255,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "system binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
},
|
||||
},
|
||||
@@ -265,7 +265,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "vendor binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: socSpecificModule,
|
||||
},
|
||||
@@ -276,7 +276,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "odm binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: deviceSpecificModule,
|
||||
},
|
||||
@@ -287,7 +287,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "product binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productSpecificModule,
|
||||
},
|
||||
@@ -298,7 +298,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "product_services binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productServicesSpecificModule,
|
||||
},
|
||||
@@ -310,7 +310,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "system native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
},
|
||||
inData: true,
|
||||
@@ -321,7 +321,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "vendor native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: socSpecificModule,
|
||||
},
|
||||
@@ -333,7 +333,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "odm native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: deviceSpecificModule,
|
||||
},
|
||||
@@ -345,7 +345,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "product native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productSpecificModule,
|
||||
},
|
||||
@@ -358,7 +358,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "product_services native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productServicesSpecificModule,
|
||||
},
|
||||
@@ -371,7 +371,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized system binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
},
|
||||
inSanitizerDir: true,
|
||||
@@ -382,7 +382,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized vendor binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: socSpecificModule,
|
||||
},
|
||||
@@ -394,7 +394,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized odm binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: deviceSpecificModule,
|
||||
},
|
||||
@@ -406,7 +406,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized product binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productSpecificModule,
|
||||
},
|
||||
@@ -419,7 +419,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized product_services binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productServicesSpecificModule,
|
||||
},
|
||||
@@ -432,7 +432,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized system native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
},
|
||||
inData: true,
|
||||
@@ -444,7 +444,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized vendor native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: socSpecificModule,
|
||||
},
|
||||
@@ -457,7 +457,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized odm native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: deviceSpecificModule,
|
||||
},
|
||||
@@ -470,7 +470,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized product native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
target: deviceTarget,
|
||||
kind: productSpecificModule,
|
||||
},
|
||||
@@ -483,7 +483,7 @@ func TestPathForModuleInstall(t *testing.T) {
|
||||
{
|
||||
name: "sanitized product_services native test binary",
|
||||
ctx: &moduleInstallPathContextImpl{
|
||||
androidBaseContextImpl: androidBaseContextImpl{
|
||||
baseContextImpl: baseContextImpl{
|
||||
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.baseContextImpl.config = testConfig
|
||||
output := PathForModuleInstall(tc.ctx, tc.in...)
|
||||
if output.basePath.path != tc.out {
|
||||
t.Errorf("unexpected path:\n got: %q\nwant: %q\n",
|
||||
|
Reference in New Issue
Block a user