Add HasMutatorFinished
To enforce that selects are only evaluated after a certain point
in a followup cl.
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Ib215fedb904aa2e5f4d65cfd26a23f527eb4983e
diff --git a/android/androidmk.go b/android/androidmk.go
index 98f8bb1..c175bec 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -502,6 +502,7 @@
otherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
ModuleType(module blueprint.Module) string
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
+ HasMutatorFinished(mutatorName string) bool
}
func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint.Module) {
diff --git a/android/base_module_context.go b/android/base_module_context.go
index 5506000..bb81377 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -220,6 +220,10 @@
// EvaluateConfiguration makes ModuleContext a valid proptools.ConfigurableEvaluator, so this context
// can be used to evaluate the final value of Configurable properties.
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 {
@@ -270,6 +274,10 @@
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 {
return b.bp.GetDirectDepWithTag(name, tag)
}
diff --git a/android/paths.go b/android/paths.go
index e457959..6322f75 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -94,6 +94,7 @@
EarlyModulePathContext
VisitDirectDepsBlueprint(visit func(blueprint.Module))
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
+ HasMutatorFinished(mutatorName string) bool
}
// ModuleMissingDepsPathContext is a subset of *ModuleContext methods required by
diff --git a/android/sdk.go b/android/sdk.go
index fb1ac24..ab9a91c 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -813,8 +813,6 @@
// SdkMemberContext provides access to information common to a specific member.
type SdkMemberContext interface {
- ConfigurableEvaluatorContext
-
// SdkModuleContext returns the module context of the sdk common os variant which is creating the
// snapshot.
//
diff --git a/android/singleton.go b/android/singleton.go
index 8542bd9..913bf6a 100644
--- a/android/singleton.go
+++ b/android/singleton.go
@@ -90,6 +90,10 @@
// 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{})
+
+ // 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 {
@@ -286,3 +290,7 @@
func (s *singletonContextAdaptor) OtherModulePropertyErrorf(module Module, property string, format string, args ...interface{}) {
s.blueprintSingletonContext().OtherModulePropertyErrorf(module, property, format, args...)
}
+
+func (s *singletonContextAdaptor) HasMutatorFinished(mutatorName string) bool {
+ return s.blueprintSingletonContext().HasMutatorFinished(mutatorName)
+}
diff --git a/android/testing.go b/android/testing.go
index 42cd1eb..1ee6e4c 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -1326,6 +1326,10 @@
return ctx.ctx.Config()
}
+func (ctx *panickingConfigAndErrorContext) HasMutatorFinished(mutatorName string) bool {
+ return ctx.ctx.HasMutatorFinished(mutatorName)
+}
+
func PanickingConfigAndErrorContext(ctx *TestContext) ConfigurableEvaluatorContext {
return &panickingConfigAndErrorContext{
ctx: ctx,
diff --git a/cc/binary_sdk_member.go b/cc/binary_sdk_member.go
index 8a7ea88..4063714 100644
--- a/cc/binary_sdk_member.go
+++ b/cc/binary_sdk_member.go
@@ -132,7 +132,7 @@
if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
- specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx, ccModule, specifiedDeps)
+ specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx.SdkModuleContext(), ccModule, specifiedDeps)
p.SharedLibs = specifiedDeps.sharedLibs
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 053c460..af3658d 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -543,7 +543,7 @@
p.ExportedFlags = exportedInfo.Flags
if ccModule.linker != nil {
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.hasStubsVariants() {
diff --git a/sdk/update.go b/sdk/update.go
index 93bb861..ec87a75 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -1993,14 +1993,6 @@
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)
func (s *sdk) createMemberSnapshot(ctx *memberContext, member *sdkMember, bpModule *bpModule) {