diff --git a/android/apex.go b/android/apex.go index a4ff0f97a..4a71b4061 100644 --- a/android/apex.go +++ b/android/apex.go @@ -257,7 +257,7 @@ type ApexModuleBase struct { canHaveApexVariants bool apexInfos []ApexInfo - apexInfosLock sync.Mutex // protects apexInfos during parallel apexDepsMutator + apexInfosLock sync.Mutex // protects apexInfos during parallel apexInfoMutator } // Initializes ApexModuleBase struct. Not calling this (even when inheriting from ApexModuleBase) @@ -442,7 +442,7 @@ func CreateApexVariations(mctx BottomUpMutatorContext, module ApexModule) []Modu } else { apexInfos = base.apexInfos } - // base.apexInfos is only needed to propagate the list of apexes from apexDepsMutator to + // base.apexInfos is only needed to propagate the list of apexes from apexInfoMutator to // apexMutator. It is no longer accurate after mergeApexVariations, and won't be copied to // all but the first created variant. Clear it so it doesn't accidentally get used later. base.apexInfos = nil diff --git a/apex/apex.go b/apex/apex.go index 12b5bc0c1..2a81b9b99 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -55,7 +55,7 @@ func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) { } func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) { - ctx.TopDown("apex_deps", apexDepsMutator).Parallel() + ctx.TopDown("apex_info", apexInfoMutator).Parallel() ctx.BottomUp("apex_unique", apexUniqueVariationsMutator).Parallel() ctx.BottomUp("apex_test_for_deps", apexTestForDepsMutator).Parallel() ctx.BottomUp("apex_test_for", apexTestForMutator).Parallel() @@ -491,12 +491,12 @@ func (af *apexFile) availableToPlatform() bool { // 1) DepsMutator: from the properties like native_shared_libs, java_libs, etc., modules are added // to the (direct) dependencies of this APEX bundle. // -// 2) apexDepsMutator: this is a post-deps mutator, so runs after DepsMutator. Its goal is to +// 2) apexInfoMutator: this is a post-deps mutator, so runs after DepsMutator. Its goal is to // collect modules that are direct and transitive dependencies of each APEX bundle. The collected // modules are marked as being included in the APEX via BuildForApex(). // -// 3) apexMutator: this is a post-deps mutator that runs after apexDepsMutator. For each module that -// are marked by the apexDepsMutator, apex variations are created using CreateApexVariations(). +// 3) apexMutator: this is a post-deps mutator that runs after apexInfoMutator. For each module that +// are marked by the apexInfoMutator, apex variations are created using CreateApexVariations(). type dependencyTag struct { blueprint.BaseDependencyTag @@ -726,14 +726,20 @@ type ApexBundleInfo struct { Contents *android.ApexContents } -var ApexBundleInfoProvider = blueprint.NewMutatorProvider(ApexBundleInfo{}, "apex_deps") +var ApexBundleInfoProvider = blueprint.NewMutatorProvider(ApexBundleInfo{}, "apex_info") -// apexDepsMutator is responsible for collecting modules that need to have apex variants. They are +// apexInfoMutator is responsible for collecting modules that need to have apex variants. They are // identified by doing a graph walk starting from an apexBundle. Basically, all the (direct and // indirect) dependencies are collected. But a few types of modules that shouldn't be included in // the apexBundle (e.g. stub libraries) are not collected. Note that a single module can be depended // on by multiple apexBundles. In that case, the module is collected for all of the apexBundles. -func apexDepsMutator(mctx android.TopDownMutatorContext) { +// +// For each dependency between an apex and an ApexModule an ApexInfo object describing the apex +// is passed to that module's BuildForApex(ApexInfo) method which collates them all in a list. +// The apexMutator uses that list to create module variants for the apexes to which it belongs. +// The relationship between module variants and apexes is not one-to-one as variants will be +// shared between compatible apexes. +func apexInfoMutator(mctx android.TopDownMutatorContext) { if !mctx.Module().Enabled() { return } @@ -915,7 +921,7 @@ func markPlatformAvailability(mctx android.BottomUpMutatorContext) { } // apexMutator visits each module and creates apex variations if the module was marked in the -// previous run of apexDepsMutator. +// previous run of apexInfoMutator. func apexMutator(mctx android.BottomUpMutatorContext) { if !mctx.Module().Enabled() { return