Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 15 | package android |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 16 | |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 17 | import ( |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 18 | "github.com/google/blueprint" |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 19 | "github.com/google/blueprint/proptools" |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 20 | ) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 21 | |
Jeff Gaston | af3cc2d | 2017-09-27 17:01:44 -0700 | [diff] [blame] | 22 | // Phases: |
| 23 | // run Pre-arch mutators |
| 24 | // run archMutator |
| 25 | // run Pre-deps mutators |
| 26 | // run depsMutator |
| 27 | // run PostDeps mutators |
| 28 | // continue on to GenerateAndroidBuildActions |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 29 | |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 30 | func registerMutatorsToContext(ctx *blueprint.Context, mutators []*mutator) { |
| 31 | for _, t := range mutators { |
| 32 | var handle blueprint.MutatorHandle |
| 33 | if t.bottomUpMutator != nil { |
| 34 | handle = ctx.RegisterBottomUpMutator(t.name, t.bottomUpMutator) |
| 35 | } else if t.topDownMutator != nil { |
| 36 | handle = ctx.RegisterTopDownMutator(t.name, t.topDownMutator) |
| 37 | } |
| 38 | if t.parallel { |
| 39 | handle.Parallel() |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 40 | } |
| 41 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 44 | func registerMutators(ctx *blueprint.Context, preArch, preDeps, postDeps []RegisterMutatorFunc) { |
| 45 | mctx := ®isterMutatorsContext{} |
Nan Zhang | db0b9a3 | 2017-02-27 10:12:13 -0800 | [diff] [blame] | 46 | |
| 47 | register := func(funcs []RegisterMutatorFunc) { |
| 48 | for _, f := range funcs { |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 49 | f(mctx) |
Nan Zhang | db0b9a3 | 2017-02-27 10:12:13 -0800 | [diff] [blame] | 50 | } |
| 51 | } |
| 52 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 53 | register(preArch) |
Nan Zhang | db0b9a3 | 2017-02-27 10:12:13 -0800 | [diff] [blame] | 54 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 55 | register(preDeps) |
| 56 | |
| 57 | mctx.BottomUp("deps", depsMutator).Parallel() |
| 58 | |
| 59 | register(postDeps) |
| 60 | |
| 61 | registerMutatorsToContext(ctx, mctx.mutators) |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | type registerMutatorsContext struct { |
| 65 | mutators []*mutator |
| 66 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 67 | |
| 68 | type RegisterMutatorsContext interface { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 69 | TopDown(name string, m TopDownMutator) MutatorHandle |
| 70 | BottomUp(name string, m BottomUpMutator) MutatorHandle |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | type RegisterMutatorFunc func(RegisterMutatorsContext) |
| 74 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 75 | var preArch = []RegisterMutatorFunc{ |
Colin Cross | f8b860a | 2019-04-16 14:43:28 -0700 | [diff] [blame] | 76 | registerLoadHookMutator, |
Dan Willemsen | 6e72ef7 | 2018-01-26 18:27:02 -0800 | [diff] [blame] | 77 | RegisterNamespaceMutator, |
Paul Duffin | e2453c7 | 2019-05-31 14:00:04 +0100 | [diff] [blame] | 78 | // Rename package module types. |
| 79 | registerPackageRenamer, |
Colin Cross | 5ea9bcc | 2017-07-27 15:41:32 -0700 | [diff] [blame] | 80 | RegisterPrebuiltsPreArchMutators, |
Martin Stjernholm | 226b20d | 2019-05-17 22:42:02 +0100 | [diff] [blame] | 81 | registerVisibilityRuleChecker, |
Colin Cross | 89536d4 | 2017-07-07 14:35:50 -0700 | [diff] [blame] | 82 | RegisterDefaultsPreArchMutators, |
Paul Duffin | 2e61fa6 | 2019-03-28 14:10:57 +0000 | [diff] [blame] | 83 | registerVisibilityRuleGatherer, |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 84 | } |
| 85 | |
Colin Cross | ae4c618 | 2017-09-15 17:33:55 -0700 | [diff] [blame] | 86 | func registerArchMutator(ctx RegisterMutatorsContext) { |
| 87 | ctx.BottomUp("arch", archMutator).Parallel() |
| 88 | ctx.TopDown("arch_hooks", archHookMutator).Parallel() |
| 89 | } |
| 90 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 91 | var preDeps = []RegisterMutatorFunc{ |
Colin Cross | ae4c618 | 2017-09-15 17:33:55 -0700 | [diff] [blame] | 92 | registerArchMutator, |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | var postDeps = []RegisterMutatorFunc{ |
Colin Cross | 1b48842 | 2019-03-04 22:33:56 -0800 | [diff] [blame] | 96 | registerPathDepsMutator, |
Colin Cross | 5ea9bcc | 2017-07-27 15:41:32 -0700 | [diff] [blame] | 97 | RegisterPrebuiltsPostDepsMutators, |
Paul Duffin | 2e61fa6 | 2019-03-28 14:10:57 +0000 | [diff] [blame] | 98 | registerVisibilityRuleEnforcer, |
Steven Moreland | 65b3fd9 | 2017-12-06 14:18:35 -0800 | [diff] [blame] | 99 | registerNeverallowMutator, |
Jaewoong Jung | b639a6a | 2019-05-10 15:16:29 -0700 | [diff] [blame] | 100 | RegisterOverridePostDepsMutators, |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 101 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 102 | |
| 103 | func PreArchMutators(f RegisterMutatorFunc) { |
| 104 | preArch = append(preArch, f) |
| 105 | } |
| 106 | |
| 107 | func PreDepsMutators(f RegisterMutatorFunc) { |
| 108 | preDeps = append(preDeps, f) |
| 109 | } |
| 110 | |
| 111 | func PostDepsMutators(f RegisterMutatorFunc) { |
| 112 | postDeps = append(postDeps, f) |
| 113 | } |
| 114 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 115 | type TopDownMutator func(TopDownMutatorContext) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 116 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 117 | type TopDownMutatorContext interface { |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 118 | BaseModuleContext |
Colin Cross | 3f68a13 | 2017-10-23 17:10:29 -0700 | [diff] [blame] | 119 | |
Colin Cross | cb55e08 | 2019-07-01 15:32:31 -0700 | [diff] [blame] | 120 | MutatorName() string |
| 121 | |
Colin Cross | 3f68a13 | 2017-10-23 17:10:29 -0700 | [diff] [blame] | 122 | Rename(name string) |
Colin Cross | 3f68a13 | 2017-10-23 17:10:29 -0700 | [diff] [blame] | 123 | |
| 124 | CreateModule(blueprint.ModuleFactory, ...interface{}) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 127 | type topDownMutatorContext struct { |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 128 | bp blueprint.TopDownMutatorContext |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 129 | baseModuleContext |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 130 | } |
| 131 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 132 | type BottomUpMutator func(BottomUpMutatorContext) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 133 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 134 | type BottomUpMutatorContext interface { |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 135 | BaseModuleContext |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 136 | |
Colin Cross | cb55e08 | 2019-07-01 15:32:31 -0700 | [diff] [blame] | 137 | MutatorName() string |
| 138 | |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 139 | Rename(name string) |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 140 | |
| 141 | AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) |
| 142 | AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) |
| 143 | CreateVariations(...string) []blueprint.Module |
| 144 | CreateLocalVariations(...string) []blueprint.Module |
| 145 | SetDependencyVariation(string) |
Jiyong Park | 1d1119f | 2019-07-29 21:27:18 +0900 | [diff] [blame^] | 146 | SetDefaultDependencyVariation(*string) |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 147 | AddVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) |
| 148 | AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) |
| 149 | AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) |
| 150 | ReplaceDependencies(string) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 151 | } |
| 152 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 153 | type bottomUpMutatorContext struct { |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 154 | bp blueprint.BottomUpMutatorContext |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 155 | baseModuleContext |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 156 | } |
| 157 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 158 | func (x *registerMutatorsContext) BottomUp(name string, m BottomUpMutator) MutatorHandle { |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 159 | f := func(ctx blueprint.BottomUpMutatorContext) { |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 160 | if a, ok := ctx.Module().(Module); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 161 | actx := &bottomUpMutatorContext{ |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 162 | bp: ctx, |
| 163 | baseModuleContext: a.base().baseModuleContextFactory(ctx), |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 164 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 165 | m(actx) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 166 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 167 | } |
| 168 | mutator := &mutator{name: name, bottomUpMutator: f} |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 169 | x.mutators = append(x.mutators, mutator) |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 170 | return mutator |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 171 | } |
| 172 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 173 | func (x *registerMutatorsContext) TopDown(name string, m TopDownMutator) MutatorHandle { |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 174 | f := func(ctx blueprint.TopDownMutatorContext) { |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 175 | if a, ok := ctx.Module().(Module); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 176 | actx := &topDownMutatorContext{ |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 177 | bp: ctx, |
| 178 | baseModuleContext: a.base().baseModuleContextFactory(ctx), |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 179 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 180 | m(actx) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 181 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 182 | } |
| 183 | mutator := &mutator{name: name, topDownMutator: f} |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 184 | x.mutators = append(x.mutators, mutator) |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 185 | return mutator |
| 186 | } |
| 187 | |
| 188 | type MutatorHandle interface { |
| 189 | Parallel() MutatorHandle |
| 190 | } |
| 191 | |
| 192 | func (mutator *mutator) Parallel() MutatorHandle { |
| 193 | mutator.parallel = true |
| 194 | return mutator |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 195 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 196 | |
| 197 | func depsMutator(ctx BottomUpMutatorContext) { |
Colin Cross | 6db4a6a | 2018-08-30 12:52:41 -0700 | [diff] [blame] | 198 | if m, ok := ctx.Module().(Module); ok && m.Enabled() { |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 199 | m.DepsMutator(ctx) |
| 200 | } |
| 201 | } |
Colin Cross | d11fcda | 2017-10-23 17:59:01 -0700 | [diff] [blame] | 202 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 203 | func (t *topDownMutatorContext) AppendProperties(props ...interface{}) { |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 204 | for _, p := range props { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 205 | err := proptools.AppendMatchingProperties(t.Module().base().customizableProperties, |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 206 | p, nil) |
| 207 | if err != nil { |
| 208 | if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 209 | t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 210 | } else { |
| 211 | panic(err) |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 217 | func (t *topDownMutatorContext) PrependProperties(props ...interface{}) { |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 218 | for _, p := range props { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 219 | err := proptools.PrependMatchingProperties(t.Module().base().customizableProperties, |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 220 | p, nil) |
| 221 | if err != nil { |
| 222 | if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 223 | t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 224 | } else { |
| 225 | panic(err) |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | } |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 230 | |
| 231 | // android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that |
| 232 | // has an overridden version in android.BaseModuleContext has to be manually forwarded to BaseModuleContext to avoid |
| 233 | // ambiguous method errors, or it has to store a blueprint.TopDownMutatorContext non-embedded, in which case every |
| 234 | // non-overridden method has to be forwarded. There are fewer non-overridden methods, so use the latter. The following |
| 235 | // methods forward to the identical blueprint versions for topDownMutatorContext and bottomUpMutatorContext. |
| 236 | |
Colin Cross | cb55e08 | 2019-07-01 15:32:31 -0700 | [diff] [blame] | 237 | func (t *topDownMutatorContext) MutatorName() string { |
| 238 | return t.bp.MutatorName() |
| 239 | } |
| 240 | |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 241 | func (t *topDownMutatorContext) Rename(name string) { |
| 242 | t.bp.Rename(name) |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 243 | t.Module().base().commonProperties.DebugName = name |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | func (t *topDownMutatorContext) CreateModule(factory blueprint.ModuleFactory, props ...interface{}) { |
Steven Moreland | 12f23e0 | 2019-07-29 16:44:57 -0700 | [diff] [blame] | 247 | common := []interface{}{&t.Module().base().commonProperties} |
| 248 | t.bp.CreateModule(factory, append(common, props...)...) |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 249 | } |
| 250 | |
Colin Cross | cb55e08 | 2019-07-01 15:32:31 -0700 | [diff] [blame] | 251 | func (b *bottomUpMutatorContext) MutatorName() string { |
| 252 | return b.bp.MutatorName() |
| 253 | } |
| 254 | |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 255 | func (b *bottomUpMutatorContext) Rename(name string) { |
| 256 | b.bp.Rename(name) |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 257 | b.Module().base().commonProperties.DebugName = name |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | func (b *bottomUpMutatorContext) AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) { |
| 261 | b.bp.AddDependency(module, tag, name...) |
| 262 | } |
| 263 | |
| 264 | func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) { |
| 265 | b.bp.AddReverseDependency(module, tag, name) |
| 266 | } |
| 267 | |
| 268 | func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []blueprint.Module { |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 269 | modules := b.bp.CreateVariations(variations...) |
| 270 | |
| 271 | for i := range variations { |
| 272 | base := modules[i].(Module).base() |
| 273 | base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) |
| 274 | base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) |
| 275 | } |
| 276 | |
| 277 | return modules |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []blueprint.Module { |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 281 | modules := b.bp.CreateLocalVariations(variations...) |
| 282 | |
| 283 | for i := range variations { |
| 284 | base := modules[i].(Module).base() |
| 285 | base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) |
| 286 | base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) |
| 287 | } |
| 288 | |
| 289 | return modules |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) { |
| 293 | b.bp.SetDependencyVariation(variation) |
| 294 | } |
| 295 | |
Jiyong Park | 1d1119f | 2019-07-29 21:27:18 +0900 | [diff] [blame^] | 296 | func (b *bottomUpMutatorContext) SetDefaultDependencyVariation(variation *string) { |
| 297 | b.bp.SetDefaultDependencyVariation(variation) |
| 298 | } |
| 299 | |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 300 | func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, |
| 301 | names ...string) { |
| 302 | |
| 303 | b.bp.AddVariationDependencies(variations, tag, names...) |
| 304 | } |
| 305 | |
| 306 | func (b *bottomUpMutatorContext) AddFarVariationDependencies(variations []blueprint.Variation, |
| 307 | tag blueprint.DependencyTag, names ...string) { |
| 308 | |
| 309 | b.bp.AddFarVariationDependencies(variations, tag, names...) |
| 310 | } |
| 311 | |
| 312 | func (b *bottomUpMutatorContext) AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) { |
| 313 | b.bp.AddInterVariantDependency(tag, from, to) |
| 314 | } |
| 315 | |
| 316 | func (b *bottomUpMutatorContext) ReplaceDependencies(name string) { |
| 317 | b.bp.ReplaceDependencies(name) |
| 318 | } |