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

Commit 0ba7034b authored by Cole Faust's avatar Cole Faust Committed by Gerrit Code Review
Browse files

Merge "Add error functions to IncomingTransitionContext" into main

parents f7a1f641 bda1816d
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -21,9 +21,20 @@ import (
	"github.com/google/blueprint"
)

// ModuleErrorContext provides only methods to report errors about the current module.
type ModuleErrorContext interface {
	// ModuleErrorf reports an error at the line number of the module type in the module definition.
	ModuleErrorf(fmt string, args ...interface{})

	// PropertyErrorf reports an error at the line number of a property in the module definition.
	PropertyErrorf(property, fmt string, args ...interface{})
}

// EarlyModuleContext provides methods that can be called early, as soon as the properties have
// been parsed into the module and before any mutators have run.
type EarlyModuleContext interface {
	ModuleErrorContext

	// Module returns the current module as a Module.  It should rarely be necessary, as the module already has a
	// reference to itself.
	Module() Module
@@ -49,12 +60,6 @@ type EarlyModuleContext interface {
	// Errorf reports an error at the specified position of the module definition file.
	Errorf(pos scanner.Position, fmt string, args ...interface{})

	// ModuleErrorf reports an error at the line number of the module type in the module definition.
	ModuleErrorf(fmt string, args ...interface{})

	// PropertyErrorf reports an error at the line number of a property in the module definition.
	PropertyErrorf(property, fmt string, args ...interface{})

	// OtherModulePropertyErrorf reports an error at the line number of a property in the given module definition.
	OtherModulePropertyErrorf(module Module, property, fmt string, args ...interface{})

+9 −0
Original line number Diff line number Diff line
@@ -339,6 +339,7 @@ func (x *registerMutatorsContext) BottomUpBlueprint(name string, m blueprint.Bot
type IncomingTransitionContext interface {
	ArchModuleContext
	ModuleProviderContext
	ModuleErrorContext

	// Module returns the target of the dependency edge for which the transition
	// is being computed
@@ -539,6 +540,14 @@ func (c *incomingTransitionContextImpl) provider(provider blueprint.AnyProviderK
	return c.bp.Provider(provider)
}

func (c *incomingTransitionContextImpl) ModuleErrorf(fmt string, args ...interface{}) {
	c.bp.ModuleErrorf(fmt, args)
}

func (c *incomingTransitionContextImpl) PropertyErrorf(property, fmt string, args ...interface{}) {
	c.bp.PropertyErrorf(property, fmt, args)
}

func (a *androidTransitionMutator) IncomingTransition(bpctx blueprint.IncomingTransitionContext, incomingVariation string) string {
	if m, ok := bpctx.Module().(Module); ok {
		ctx := incomingTransitionContextPool.Get().(*incomingTransitionContextImpl)