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

Commit 9a933b42 authored by Yu Liu's avatar Yu Liu Committed by Gerrit Code Review
Browse files

Merge "Replace FinalModule with IsFinalModule." into main

parents 6d89d77d 88ea9ffc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -833,7 +833,7 @@ func UpdateDirectlyInAnyApex(mctx BottomUpMutatorContext, am ApexModule) {

	// If this is the FinalModule (last visited module) copy
	// AnyVariantDirectlyInAnyApex to all the other variants
	if am == mctx.FinalModule().(ApexModule) {
	if mctx.IsFinalModule(am) {
		mctx.VisitAllModuleVariants(func(variant Module) {
			variant.(ApexModule).apexModuleBase().ApexProperties.AnyVariantDirectlyInAnyApex =
				base.ApexProperties.AnyVariantDirectlyInAnyApex
+11 −1
Original line number Diff line number Diff line
@@ -198,9 +198,15 @@ type BaseModuleContext interface {
	// singleton actions that are only done once for all variants of a module.
	FinalModule() Module

	// IsFinalModule returns if the current module is the last variant.  Variants of a module are always visited in
	// order by mutators and GenerateBuildActions, so the data created by the current mutator can be read from all
	// variants using VisitAllModuleVariants if the current module is the last one. This can be used to perform
	// singleton actions that are only done once for all variants of a module.
	IsFinalModule(module Module) bool

	// VisitAllModuleVariants calls visit for each variant of the current module.  Variants of a module are always
	// visited in order by mutators and GenerateBuildActions, so the data created by the current mutator can be read
	// from all variants if the current module == FinalModule().  Otherwise, care must be taken to not access any
	// from all variants if the current module is the last one. Otherwise, care must be taken to not access any
	// data modified by the current mutator.
	VisitAllModuleVariants(visit func(Module))

@@ -592,6 +598,10 @@ func (b *baseModuleContext) FinalModule() Module {
	return b.bp.FinalModule().(Module)
}

func (b *baseModuleContext) IsFinalModule(module Module) bool {
	return b.bp.IsFinalModule(module)
}

// IsMetaDependencyTag returns true for cross-cutting metadata dependencies.
func IsMetaDependencyTag(tag blueprint.DependencyTag) bool {
	if tag == licenseKindTag {
+1 −1
Original line number Diff line number Diff line
@@ -2036,7 +2036,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
		ctx.GetMissingDependencies()
	}

	if m == ctx.FinalModule().(Module).base() {
	if ctx.IsFinalModule(m.module) {
		m.generateModuleTarget(ctx)
		if ctx.Failed() {
			return
+3 −3
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ type SingletonContext interface {
	VisitAllModuleVariantProxies(module Module, visit func(proxy ModuleProxy))

	PrimaryModule(module Module) Module
	FinalModule(module Module) Module
	IsFinalModule(module Module) bool

	AddNinjaFileDeps(deps ...string)

@@ -273,8 +273,8 @@ func (s *singletonContextAdaptor) PrimaryModule(module Module) Module {
	return s.SingletonContext.PrimaryModule(module).(Module)
}

func (s *singletonContextAdaptor) FinalModule(module Module) Module {
	return s.SingletonContext.FinalModule(module).(Module)
func (s *singletonContextAdaptor) IsFinalModule(module Module) bool {
	return s.SingletonContext.IsFinalModule(module)
}

func (s *singletonContextAdaptor) ModuleVariantsFromName(referer Module, name string) []Module {
+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ func (m *tidyPhonySingleton) GenerateBuildActions(ctx android.SingletonContext)

	// Collect tidy/obj targets from the 'final' modules.
	ctx.VisitAllModules(func(module android.Module) {
		if module == ctx.FinalModule(module) {
		if ctx.IsFinalModule(module) {
			collectTidyObjModuleTargets(ctx, module, tidyModulesInDirGroup, objModulesInDirGroup)
		}
	})
Loading