Merge "Add HasMutatorFinished" into main

This commit is contained in:
Cole Faust
2024-09-12 00:02:10 +00:00
committed by Gerrit Code Review
9 changed files with 24 additions and 12 deletions

View File

@@ -502,6 +502,7 @@ type fillInEntriesContext interface {
otherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) otherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
ModuleType(module blueprint.Module) string ModuleType(module blueprint.Module) string
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
HasMutatorFinished(mutatorName string) bool
} }
func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) { func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) {

View File

@@ -220,6 +220,10 @@ type BaseModuleContext interface {
// EvaluateConfiguration makes ModuleContext a valid proptools.ConfigurableEvaluator, so this context // EvaluateConfiguration makes ModuleContext a valid proptools.ConfigurableEvaluator, so this context
// can be used to evaluate the final value of Configurable properties. // can be used to evaluate the final value of Configurable properties.
EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue
// HasMutatorFinished returns true if the given mutator has finished running.
// It will panic if given an invalid mutator name.
HasMutatorFinished(mutatorName string) bool
} }
type baseModuleContext struct { type baseModuleContext struct {
@@ -270,6 +274,10 @@ func (b *baseModuleContext) setProvider(provider blueprint.AnyProviderKey, value
b.bp.SetProvider(provider, value) b.bp.SetProvider(provider, value)
} }
func (b *baseModuleContext) HasMutatorFinished(mutatorName string) bool {
return b.bp.HasMutatorFinished(mutatorName)
}
func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module { func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module {
return b.bp.GetDirectDepWithTag(name, tag) return b.bp.GetDirectDepWithTag(name, tag)
} }

View File

@@ -94,6 +94,7 @@ type ModuleWithDepsPathContext interface {
EarlyModulePathContext EarlyModulePathContext
VisitDirectDepsBlueprint(visit func(blueprint.Module)) VisitDirectDepsBlueprint(visit func(blueprint.Module))
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
HasMutatorFinished(mutatorName string) bool
} }
// ModuleMissingDepsPathContext is a subset of *ModuleContext methods required by // ModuleMissingDepsPathContext is a subset of *ModuleContext methods required by

View File

@@ -813,8 +813,6 @@ type SdkMemberProperties interface {
// SdkMemberContext provides access to information common to a specific member. // SdkMemberContext provides access to information common to a specific member.
type SdkMemberContext interface { type SdkMemberContext interface {
ConfigurableEvaluatorContext
// SdkModuleContext returns the module context of the sdk common os variant which is creating the // SdkModuleContext returns the module context of the sdk common os variant which is creating the
// snapshot. // snapshot.
// //

View File

@@ -90,6 +90,10 @@ type SingletonContext interface {
// OtherModulePropertyErrorf reports an error on the line number of the given property of the given module // OtherModulePropertyErrorf reports an error on the line number of the given property of the given module
OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{})
// HasMutatorFinished returns true if the given mutator has finished running.
// It will panic if given an invalid mutator name.
HasMutatorFinished(mutatorName string) bool
} }
type singletonAdaptor struct { type singletonAdaptor struct {
@@ -286,3 +290,7 @@ func (s *singletonContextAdaptor) otherModuleProvider(module blueprint.Module, p
func (s *singletonContextAdaptor) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) { func (s *singletonContextAdaptor) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) {
s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args...) s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args...)
} }
func (s *singletonContextAdaptor) HasMutatorFinished(mutatorName string) bool {
return s.blueprintSingletonContext().HasMutatorFinished(mutatorName)
}

View File

@@ -1326,6 +1326,10 @@ func (ctx *panickingConfigAndErrorContext) Config() Config {
return ctx.ctx.Config() return ctx.ctx.Config()
} }
func (ctx *panickingConfigAndErrorContext) HasMutatorFinished(mutatorName string) bool {
return ctx.ctx.HasMutatorFinished(mutatorName)
}
func PanickingConfigAndErrorContext(ctx *TestContext) ConfigurableEvaluatorContext { func PanickingConfigAndErrorContext(ctx *TestContext) ConfigurableEvaluatorContext {
return &panickingConfigAndErrorContext{ return &panickingConfigAndErrorContext{
ctx: ctx, ctx: ctx,

View File

@@ -132,7 +132,7 @@ func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberCo
if ccModule.linker != nil { if ccModule.linker != nil {
specifiedDeps := specifiedDeps{} specifiedDeps := specifiedDeps{}
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx, ccModule, specifiedDeps) specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx.SdkModuleContext(), ccModule, specifiedDeps)
p.SharedLibs = specifiedDeps.sharedLibs p.SharedLibs = specifiedDeps.sharedLibs
p.SystemSharedLibs = specifiedDeps.systemSharedLibs p.SystemSharedLibs = specifiedDeps.systemSharedLibs

View File

@@ -543,7 +543,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
p.ExportedFlags = exportedInfo.Flags p.ExportedFlags = exportedInfo.Flags
if ccModule.linker != nil { if ccModule.linker != nil {
specifiedDeps := specifiedDeps{} specifiedDeps := specifiedDeps{}
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx, ccModule, specifiedDeps) specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx.SdkModuleContext(), ccModule, specifiedDeps)
if lib := ccModule.library; lib != nil { if lib := ccModule.library; lib != nil {
if !lib.hasStubsVariants() { if !lib.hasStubsVariants() {

View File

@@ -1989,14 +1989,6 @@ func (m *memberContext) IsTargetBuildBeforeTiramisu() bool {
return m.builder.targetBuildRelease.EarlierThan(buildReleaseT) return m.builder.targetBuildRelease.EarlierThan(buildReleaseT)
} }
func (m *memberContext) Config() android.Config {
return m.sdkMemberContext.Config()
}
func (m *memberContext) OtherModulePropertyErrorf(module android.Module, property string, fmt string, args ...interface{}) {
m.sdkMemberContext.OtherModulePropertyErrorf(module, property, fmt, args)
}
var _ android.SdkMemberContext = (*memberContext)(nil) var _ android.SdkMemberContext = (*memberContext)(nil)
func (s *sdk) createMemberSnapshot(ctx *memberContext, member *sdkMember, bpModule *bpModule) { func (s *sdk) createMemberSnapshot(ctx *memberContext, member *sdkMember, bpModule *bpModule) {