Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8a87831 authored by Cole Faust's avatar Cole Faust
Browse files

Rename ConfigAndErrorContext to ConfigurableEvaluatorContext

I'm going to be adding some methods to this interface, give it
a name based on how it's going to be used, not based on what methods
it contains.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I9bba04ba756c4dbe00625e2d04af81e78a11cae9
parent 28b806c9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -983,11 +983,11 @@ func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleIn
	return nil
}

func ShouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module Module) bool {
func ShouldSkipAndroidMkProcessing(ctx ConfigurableEvaluatorContext, module Module) bool {
	return shouldSkipAndroidMkProcessing(ctx, module.base())
}

func shouldSkipAndroidMkProcessing(ctx ConfigAndErrorContext, module *ModuleBase) bool {
func shouldSkipAndroidMkProcessing(ctx ConfigurableEvaluatorContext, module *ModuleBase) bool {
	if !module.commonProperties.NamespaceExportedToMake {
		// TODO(jeffrygaston) do we want to validate that there are no modules being
		// exported to Kati that depend on this module?
+10 −10
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ type Module interface {

	base() *ModuleBase
	Disable()
	Enabled(ctx ConfigAndErrorContext) bool
	Enabled(ctx ConfigurableEvaluatorContext) bool
	Target() Target
	MultiTargets() []Target

@@ -109,12 +109,12 @@ type Module interface {
	// Get information about the properties that can contain visibility rules.
	visibilityProperties() []visibilityProperty

	RequiredModuleNames(ctx ConfigAndErrorContext) []string
	RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string
	HostRequiredModuleNames() []string
	TargetRequiredModuleNames() []string
	VintfFragmentModuleNames(ctx ConfigAndErrorContext) []string
	VintfFragmentModuleNames(ctx ConfigurableEvaluatorContext) []string

	ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools.ConfigurableEvaluator
	ConfigurableEvaluator(ctx ConfigurableEvaluatorContext) proptools.ConfigurableEvaluator
}

// Qualified id for a module
@@ -1339,7 +1339,7 @@ func (m *ModuleBase) PartitionTag(config DeviceConfig) string {
	return partition
}

func (m *ModuleBase) Enabled(ctx ConfigAndErrorContext) bool {
func (m *ModuleBase) Enabled(ctx ConfigurableEvaluatorContext) bool {
	if m.commonProperties.ForcedDisabled {
		return false
	}
@@ -1536,7 +1536,7 @@ func (m *ModuleBase) InRecovery() bool {
	return m.base().commonProperties.ImageVariation == RecoveryVariation
}

func (m *ModuleBase) RequiredModuleNames(ctx ConfigAndErrorContext) []string {
func (m *ModuleBase) RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string {
	return m.base().commonProperties.Required.GetOrDefault(m.ConfigurableEvaluator(ctx), nil)
}

@@ -1548,7 +1548,7 @@ func (m *ModuleBase) TargetRequiredModuleNames() []string {
	return m.base().commonProperties.Target_required
}

func (m *ModuleBase) VintfFragmentModuleNames(ctx ConfigAndErrorContext) []string {
func (m *ModuleBase) VintfFragmentModuleNames(ctx ConfigurableEvaluatorContext) []string {
	return m.base().commonProperties.Vintf_fragment_modules.GetOrDefault(m.ConfigurableEvaluator(ctx), nil)
}

@@ -2204,17 +2204,17 @@ func (m *ModuleBase) IsNativeBridgeSupported() bool {
	return proptools.Bool(m.commonProperties.Native_bridge_supported)
}

type ConfigAndErrorContext interface {
type ConfigurableEvaluatorContext interface {
	Config() Config
	OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
}

type configurationEvalutor struct {
	ctx ConfigAndErrorContext
	ctx ConfigurableEvaluatorContext
	m   Module
}

func (m *ModuleBase) ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools.ConfigurableEvaluator {
func (m *ModuleBase) ConfigurableEvaluator(ctx ConfigurableEvaluatorContext) proptools.ConfigurableEvaluator {
	return configurationEvalutor{
		ctx: ctx,
		m:   m.module,
+2 −2
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ type ModuleContext interface {
	InstallInVendor() bool
	InstallForceOS() (*OsType, *ArchType)

	RequiredModuleNames(ctx ConfigAndErrorContext) []string
	RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string
	HostRequiredModuleNames() []string
	TargetRequiredModuleNames() []string

@@ -855,7 +855,7 @@ func (m *moduleContext) ExpandOptionalSource(srcFile *string, _ string) Optional
	return OptionalPath{}
}

func (m *moduleContext) RequiredModuleNames(ctx ConfigAndErrorContext) []string {
func (m *moduleContext) RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string {
	return m.module.RequiredModuleNames(ctx)
}

+1 −1
Original line number Diff line number Diff line
@@ -813,7 +813,7 @@ type SdkMemberProperties interface {

// SdkMemberContext provides access to information common to a specific member.
type SdkMemberContext interface {
	ConfigAndErrorContext
	ConfigurableEvaluatorContext

	// SdkModuleContext returns the module context of the sdk common os variant which is creating the
	// snapshot.
+1 −1
Original line number Diff line number Diff line
@@ -1326,7 +1326,7 @@ func (ctx *panickingConfigAndErrorContext) Config() Config {
	return ctx.ctx.Config()
}

func PanickingConfigAndErrorContext(ctx *TestContext) ConfigAndErrorContext {
func PanickingConfigAndErrorContext(ctx *TestContext) ConfigurableEvaluatorContext {
	return &panickingConfigAndErrorContext{
		ctx: ctx,
	}
Loading