Loading android/mutator.go +1 −122 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ import ( // run Pre-deps mutators // run Pre-deps mutators // run depsMutator // run depsMutator // run PostDeps mutators // run PostDeps mutators // run FinalDeps mutators (CreateVariations disallowed in this phase) // run FinalDeps mutators (TransitionMutators disallowed in this phase) // continue on to GenerateAndroidBuildActions // continue on to GenerateAndroidBuildActions // collateGloballyRegisteredMutators constructs the list of mutators that have been registered // collateGloballyRegisteredMutators constructs the list of mutators that have been registered Loading Loading @@ -231,36 +231,6 @@ type BottomUpMutatorContext interface { // module's dependency list. // module's dependency list. AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) // CreateVariations splits a module into multiple variants, one for each name in the variationNames // parameter. It returns a list of new modules in the same order as the variationNames // list. // // If any of the dependencies of the module being operated on were already split // by calling CreateVariations with the same name, the dependency will automatically // be updated to point the matching variant. // // If a module is split, and then a module depending on the first module is not split // when the Mutator is later called on it, the dependency of the depending module will // automatically be updated to point to the first variant. CreateVariations(...string) []Module // CreateLocationVariations splits a module into multiple variants, one for each name in the variantNames // parameter. It returns a list of new modules in the same order as the variantNames // list. // // Local variations do not affect automatic dependency resolution - dependencies added // to the split module via deps or DynamicDependerModule must exactly match a variant // that contains all the non-local variations. CreateLocalVariations(...string) []Module // SetDependencyVariation sets all dangling dependencies on the current module to point to the variation // with given name. This function ignores the default variation set by SetDefaultDependencyVariation. SetDependencyVariation(string) // SetDefaultDependencyVariation sets the default variation when a dangling reference is detected // during the subsequent calls on Create*Variations* functions. To reset, set it to nil. SetDefaultDependencyVariation(*string) // AddVariationDependencies adds deps as dependencies of the current module, but uses the variations // AddVariationDependencies adds deps as dependencies of the current module, but uses the variations // argument to select which variant of the dependency to use. It returns a slice of modules for // argument to select which variant of the dependency to use. It returns a slice of modules for // each dependency (some entries may be nil). A variant of the dependency must exist that matches // each dependency (some entries may be nil). A variant of the dependency must exist that matches Loading @@ -287,12 +257,6 @@ type BottomUpMutatorContext interface { // be ordered correctly for all future mutator passes. // be ordered correctly for all future mutator passes. AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module // AddInterVariantDependency adds a dependency between two variants of the same module. Variants are always // ordered in the same orderas they were listed in CreateVariations, and AddInterVariantDependency does not change // that ordering, but it associates a DependencyTag with the dependency and makes it visible to VisitDirectDeps, // WalkDeps, etc. AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) // ReplaceDependencies finds all the variants of the module with the specified name, then // ReplaceDependencies finds all the variants of the module with the specified name, then // replaces all dependencies onto those variants with the current variant of this module. // replaces all dependencies onto those variants with the current variant of this module. // Replacements don't take effect until after the mutator pass is finished. // Replacements don't take effect until after the mutator pass is finished. Loading @@ -303,30 +267,6 @@ type BottomUpMutatorContext interface { // as long as the supplied predicate returns true. // as long as the supplied predicate returns true. // Replacements don't take effect until after the mutator pass is finished. // Replacements don't take effect until after the mutator pass is finished. ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate) ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate) // AliasVariation takes a variationName that was passed to CreateVariations for this module, // and creates an alias from the current variant (before the mutator has run) to the new // variant. The alias will be valid until the next time a mutator calls CreateVariations or // CreateLocalVariations on this module without also calling AliasVariation. The alias can // be used to add dependencies on the newly created variant using the variant map from // before CreateVariations was run. AliasVariation(variationName string) // CreateAliasVariation takes a toVariationName that was passed to CreateVariations for this // module, and creates an alias from a new fromVariationName variant the toVariationName // variant. The alias will be valid until the next time a mutator calls CreateVariations or // CreateLocalVariations on this module without also calling AliasVariation. The alias can // be used to add dependencies on the toVariationName variant using the fromVariationName // variant. CreateAliasVariation(fromVariationName, toVariationName string) // SetVariationProvider sets the value for a provider for the given newly created variant of // the current module, i.e. one of the Modules returned by CreateVariations.. It panics if // not called during the appropriate mutator or GenerateBuildActions pass for the provider, // if the value is not of the appropriate type, or if the module is not a newly created // variant of the current module. The value should not be modified after being passed to // SetVariationProvider. SetVariationProvider(module blueprint.Module, provider blueprint.AnyProviderKey, value interface{}) } } // An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module // An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module Loading Loading @@ -763,51 +703,6 @@ func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, t } } b.bp.AddReverseDependency(module, tag, name) b.bp.AddReverseDependency(module, tag, name) } } func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []Module { if b.finalPhase { panic("CreateVariations not allowed in FinalDepsMutators") } modules := b.bp.CreateVariations(variations...) aModules := make([]Module, len(modules)) for i := range variations { aModules[i] = modules[i].(Module) base := aModules[i].base() base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) } return aModules } func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []Module { if b.finalPhase { panic("CreateLocalVariations not allowed in FinalDepsMutators") } modules := b.bp.CreateLocalVariations(variations...) aModules := make([]Module, len(modules)) for i := range variations { aModules[i] = modules[i].(Module) base := aModules[i].base() base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) } return aModules } func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) { b.bp.SetDependencyVariation(variation) } func (b *bottomUpMutatorContext) SetDefaultDependencyVariation(variation *string) { b.bp.SetDefaultDependencyVariation(variation) } func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, names ...string) []blueprint.Module { names ...string) []blueprint.Module { if b.baseModuleContext.checkedMissingDeps() { if b.baseModuleContext.checkedMissingDeps() { Loading @@ -825,10 +720,6 @@ func (b *bottomUpMutatorContext) AddFarVariationDependencies(variations []bluepr return b.bp.AddFarVariationDependencies(variations, tag, names...) return b.bp.AddFarVariationDependencies(variations, tag, names...) } } func (b *bottomUpMutatorContext) AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) { b.bp.AddInterVariantDependency(tag, from, to) } func (b *bottomUpMutatorContext) ReplaceDependencies(name string) { func (b *bottomUpMutatorContext) ReplaceDependencies(name string) { if b.baseModuleContext.checkedMissingDeps() { if b.baseModuleContext.checkedMissingDeps() { panic("Adding deps not allowed after checking for missing deps") panic("Adding deps not allowed after checking for missing deps") Loading @@ -842,15 +733,3 @@ func (b *bottomUpMutatorContext) ReplaceDependenciesIf(name string, predicate bl } } b.bp.ReplaceDependenciesIf(name, predicate) b.bp.ReplaceDependenciesIf(name, predicate) } } func (b *bottomUpMutatorContext) AliasVariation(variationName string) { b.bp.AliasVariation(variationName) } func (b *bottomUpMutatorContext) CreateAliasVariation(fromVariationName, toVariationName string) { b.bp.CreateAliasVariation(fromVariationName, toVariationName) } func (b *bottomUpMutatorContext) SetVariationProvider(module blueprint.Module, provider blueprint.AnyProviderKey, value interface{}) { b.bp.SetVariationProvider(module, provider, value) } android/mutator_test.go +1 −1 Original line number Original line Diff line number Diff line Loading @@ -287,7 +287,7 @@ func TestFinalDepsPhase(t *testing.T) { AssertDeepEquals(t, "final", finalWant, finalGot) AssertDeepEquals(t, "final", finalWant, finalGot) } } func TestNoCreateVariationsInFinalDeps(t *testing.T) { func TestTransitionMutatorInFinalDeps(t *testing.T) { GroupFixturePreparers( GroupFixturePreparers( FixtureRegisterWithContext(func(ctx RegistrationContext) { FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.FinalDepsMutators(func(ctx RegisterMutatorsContext) { ctx.FinalDepsMutators(func(ctx RegisterMutatorsContext) { Loading android/prebuilt.go +2 −2 Original line number Original line Diff line number Diff line Loading @@ -359,8 +359,8 @@ func GetEmbeddedPrebuilt(module Module) *Prebuilt { // // // This function is for use on dependencies after PrebuiltPostDepsMutator has // This function is for use on dependencies after PrebuiltPostDepsMutator has // run - any dependency that is registered before that will already reference // run - any dependency that is registered before that will already reference // the right module. This function is only safe to call after all mutators that // the right module. This function is only safe to call after all TransitionMutators // may call CreateVariations, e.g. in GenerateAndroidBuildActions. // have run, e.g. in GenerateAndroidBuildActions. func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module { func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module { if !module.IsReplacedByPrebuilt() { if !module.IsReplacedByPrebuilt() { return module return module Loading cc/cc.go +1 −1 Original line number Original line Diff line number Diff line Loading @@ -137,7 +137,7 @@ type Deps struct { // LLNDK headers for the ABI checker to check LLNDK implementation library. // LLNDK headers for the ABI checker to check LLNDK implementation library. // An LLNDK implementation is the core variant. LLNDK header libs are reexported by the vendor variant. // An LLNDK implementation is the core variant. LLNDK header libs are reexported by the vendor variant. // The core variant cannot depend on the vendor variant because of the order of CreateVariations. // The core variant cannot depend on the vendor variant because of the order of imageTransitionMutator.Split(). // Instead, the LLNDK implementation depends on the LLNDK header libs. // Instead, the LLNDK implementation depends on the LLNDK header libs. LlndkHeaderLibs []string LlndkHeaderLibs []string } } Loading Loading
android/mutator.go +1 −122 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ import ( // run Pre-deps mutators // run Pre-deps mutators // run depsMutator // run depsMutator // run PostDeps mutators // run PostDeps mutators // run FinalDeps mutators (CreateVariations disallowed in this phase) // run FinalDeps mutators (TransitionMutators disallowed in this phase) // continue on to GenerateAndroidBuildActions // continue on to GenerateAndroidBuildActions // collateGloballyRegisteredMutators constructs the list of mutators that have been registered // collateGloballyRegisteredMutators constructs the list of mutators that have been registered Loading Loading @@ -231,36 +231,6 @@ type BottomUpMutatorContext interface { // module's dependency list. // module's dependency list. AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) // CreateVariations splits a module into multiple variants, one for each name in the variationNames // parameter. It returns a list of new modules in the same order as the variationNames // list. // // If any of the dependencies of the module being operated on were already split // by calling CreateVariations with the same name, the dependency will automatically // be updated to point the matching variant. // // If a module is split, and then a module depending on the first module is not split // when the Mutator is later called on it, the dependency of the depending module will // automatically be updated to point to the first variant. CreateVariations(...string) []Module // CreateLocationVariations splits a module into multiple variants, one for each name in the variantNames // parameter. It returns a list of new modules in the same order as the variantNames // list. // // Local variations do not affect automatic dependency resolution - dependencies added // to the split module via deps or DynamicDependerModule must exactly match a variant // that contains all the non-local variations. CreateLocalVariations(...string) []Module // SetDependencyVariation sets all dangling dependencies on the current module to point to the variation // with given name. This function ignores the default variation set by SetDefaultDependencyVariation. SetDependencyVariation(string) // SetDefaultDependencyVariation sets the default variation when a dangling reference is detected // during the subsequent calls on Create*Variations* functions. To reset, set it to nil. SetDefaultDependencyVariation(*string) // AddVariationDependencies adds deps as dependencies of the current module, but uses the variations // AddVariationDependencies adds deps as dependencies of the current module, but uses the variations // argument to select which variant of the dependency to use. It returns a slice of modules for // argument to select which variant of the dependency to use. It returns a slice of modules for // each dependency (some entries may be nil). A variant of the dependency must exist that matches // each dependency (some entries may be nil). A variant of the dependency must exist that matches Loading @@ -287,12 +257,6 @@ type BottomUpMutatorContext interface { // be ordered correctly for all future mutator passes. // be ordered correctly for all future mutator passes. AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module // AddInterVariantDependency adds a dependency between two variants of the same module. Variants are always // ordered in the same orderas they were listed in CreateVariations, and AddInterVariantDependency does not change // that ordering, but it associates a DependencyTag with the dependency and makes it visible to VisitDirectDeps, // WalkDeps, etc. AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) // ReplaceDependencies finds all the variants of the module with the specified name, then // ReplaceDependencies finds all the variants of the module with the specified name, then // replaces all dependencies onto those variants with the current variant of this module. // replaces all dependencies onto those variants with the current variant of this module. // Replacements don't take effect until after the mutator pass is finished. // Replacements don't take effect until after the mutator pass is finished. Loading @@ -303,30 +267,6 @@ type BottomUpMutatorContext interface { // as long as the supplied predicate returns true. // as long as the supplied predicate returns true. // Replacements don't take effect until after the mutator pass is finished. // Replacements don't take effect until after the mutator pass is finished. ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate) ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate) // AliasVariation takes a variationName that was passed to CreateVariations for this module, // and creates an alias from the current variant (before the mutator has run) to the new // variant. The alias will be valid until the next time a mutator calls CreateVariations or // CreateLocalVariations on this module without also calling AliasVariation. The alias can // be used to add dependencies on the newly created variant using the variant map from // before CreateVariations was run. AliasVariation(variationName string) // CreateAliasVariation takes a toVariationName that was passed to CreateVariations for this // module, and creates an alias from a new fromVariationName variant the toVariationName // variant. The alias will be valid until the next time a mutator calls CreateVariations or // CreateLocalVariations on this module without also calling AliasVariation. The alias can // be used to add dependencies on the toVariationName variant using the fromVariationName // variant. CreateAliasVariation(fromVariationName, toVariationName string) // SetVariationProvider sets the value for a provider for the given newly created variant of // the current module, i.e. one of the Modules returned by CreateVariations.. It panics if // not called during the appropriate mutator or GenerateBuildActions pass for the provider, // if the value is not of the appropriate type, or if the module is not a newly created // variant of the current module. The value should not be modified after being passed to // SetVariationProvider. SetVariationProvider(module blueprint.Module, provider blueprint.AnyProviderKey, value interface{}) } } // An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module // An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module Loading Loading @@ -763,51 +703,6 @@ func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, t } } b.bp.AddReverseDependency(module, tag, name) b.bp.AddReverseDependency(module, tag, name) } } func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []Module { if b.finalPhase { panic("CreateVariations not allowed in FinalDepsMutators") } modules := b.bp.CreateVariations(variations...) aModules := make([]Module, len(modules)) for i := range variations { aModules[i] = modules[i].(Module) base := aModules[i].base() base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) } return aModules } func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []Module { if b.finalPhase { panic("CreateLocalVariations not allowed in FinalDepsMutators") } modules := b.bp.CreateLocalVariations(variations...) aModules := make([]Module, len(modules)) for i := range variations { aModules[i] = modules[i].(Module) base := aModules[i].base() base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) } return aModules } func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) { b.bp.SetDependencyVariation(variation) } func (b *bottomUpMutatorContext) SetDefaultDependencyVariation(variation *string) { b.bp.SetDefaultDependencyVariation(variation) } func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, names ...string) []blueprint.Module { names ...string) []blueprint.Module { if b.baseModuleContext.checkedMissingDeps() { if b.baseModuleContext.checkedMissingDeps() { Loading @@ -825,10 +720,6 @@ func (b *bottomUpMutatorContext) AddFarVariationDependencies(variations []bluepr return b.bp.AddFarVariationDependencies(variations, tag, names...) return b.bp.AddFarVariationDependencies(variations, tag, names...) } } func (b *bottomUpMutatorContext) AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) { b.bp.AddInterVariantDependency(tag, from, to) } func (b *bottomUpMutatorContext) ReplaceDependencies(name string) { func (b *bottomUpMutatorContext) ReplaceDependencies(name string) { if b.baseModuleContext.checkedMissingDeps() { if b.baseModuleContext.checkedMissingDeps() { panic("Adding deps not allowed after checking for missing deps") panic("Adding deps not allowed after checking for missing deps") Loading @@ -842,15 +733,3 @@ func (b *bottomUpMutatorContext) ReplaceDependenciesIf(name string, predicate bl } } b.bp.ReplaceDependenciesIf(name, predicate) b.bp.ReplaceDependenciesIf(name, predicate) } } func (b *bottomUpMutatorContext) AliasVariation(variationName string) { b.bp.AliasVariation(variationName) } func (b *bottomUpMutatorContext) CreateAliasVariation(fromVariationName, toVariationName string) { b.bp.CreateAliasVariation(fromVariationName, toVariationName) } func (b *bottomUpMutatorContext) SetVariationProvider(module blueprint.Module, provider blueprint.AnyProviderKey, value interface{}) { b.bp.SetVariationProvider(module, provider, value) }
android/mutator_test.go +1 −1 Original line number Original line Diff line number Diff line Loading @@ -287,7 +287,7 @@ func TestFinalDepsPhase(t *testing.T) { AssertDeepEquals(t, "final", finalWant, finalGot) AssertDeepEquals(t, "final", finalWant, finalGot) } } func TestNoCreateVariationsInFinalDeps(t *testing.T) { func TestTransitionMutatorInFinalDeps(t *testing.T) { GroupFixturePreparers( GroupFixturePreparers( FixtureRegisterWithContext(func(ctx RegistrationContext) { FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.FinalDepsMutators(func(ctx RegisterMutatorsContext) { ctx.FinalDepsMutators(func(ctx RegisterMutatorsContext) { Loading
android/prebuilt.go +2 −2 Original line number Original line Diff line number Diff line Loading @@ -359,8 +359,8 @@ func GetEmbeddedPrebuilt(module Module) *Prebuilt { // // // This function is for use on dependencies after PrebuiltPostDepsMutator has // This function is for use on dependencies after PrebuiltPostDepsMutator has // run - any dependency that is registered before that will already reference // run - any dependency that is registered before that will already reference // the right module. This function is only safe to call after all mutators that // the right module. This function is only safe to call after all TransitionMutators // may call CreateVariations, e.g. in GenerateAndroidBuildActions. // have run, e.g. in GenerateAndroidBuildActions. func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module { func PrebuiltGetPreferred(ctx BaseModuleContext, module Module) Module { if !module.IsReplacedByPrebuilt() { if !module.IsReplacedByPrebuilt() { return module return module Loading
cc/cc.go +1 −1 Original line number Original line Diff line number Diff line Loading @@ -137,7 +137,7 @@ type Deps struct { // LLNDK headers for the ABI checker to check LLNDK implementation library. // LLNDK headers for the ABI checker to check LLNDK implementation library. // An LLNDK implementation is the core variant. LLNDK header libs are reexported by the vendor variant. // An LLNDK implementation is the core variant. LLNDK header libs are reexported by the vendor variant. // The core variant cannot depend on the vendor variant because of the order of CreateVariations. // The core variant cannot depend on the vendor variant because of the order of imageTransitionMutator.Split(). // Instead, the LLNDK implementation depends on the LLNDK header libs. // Instead, the LLNDK implementation depends on the LLNDK header libs. LlndkHeaderLibs []string LlndkHeaderLibs []string } } Loading