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 | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 18 | "reflect" |
| 19 | |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 20 | "github.com/google/blueprint" |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 21 | "github.com/google/blueprint/proptools" |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 22 | ) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 23 | |
Jeff Gaston | af3cc2d | 2017-09-27 17:01:44 -0700 | [diff] [blame] | 24 | // Phases: |
| 25 | // run Pre-arch mutators |
| 26 | // run archMutator |
| 27 | // run Pre-deps mutators |
| 28 | // run depsMutator |
| 29 | // run PostDeps mutators |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 30 | // run FinalDeps mutators (CreateVariations disallowed in this phase) |
Jeff Gaston | af3cc2d | 2017-09-27 17:01:44 -0700 | [diff] [blame] | 31 | // continue on to GenerateAndroidBuildActions |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 32 | |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 33 | func registerMutatorsToContext(ctx *blueprint.Context, mutators []*mutator) { |
| 34 | for _, t := range mutators { |
| 35 | var handle blueprint.MutatorHandle |
| 36 | if t.bottomUpMutator != nil { |
| 37 | handle = ctx.RegisterBottomUpMutator(t.name, t.bottomUpMutator) |
| 38 | } else if t.topDownMutator != nil { |
| 39 | handle = ctx.RegisterTopDownMutator(t.name, t.topDownMutator) |
| 40 | } |
| 41 | if t.parallel { |
| 42 | handle.Parallel() |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 43 | } |
| 44 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Jingwen Chen | 4133ce6 | 2020-12-02 04:34:15 -0500 | [diff] [blame] | 47 | func registerMutatorsForBazelConversion(ctx *blueprint.Context) { |
| 48 | // FIXME(b/171263886): Start bringing in mutators to make the Bionic |
| 49 | // module subgraph suitable for automated conversion. |
| 50 | } |
| 51 | |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 52 | func registerMutators(ctx *blueprint.Context, preArch, preDeps, postDeps, finalDeps []RegisterMutatorFunc) { |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 53 | mctx := ®isterMutatorsContext{} |
Nan Zhang | db0b9a3 | 2017-02-27 10:12:13 -0800 | [diff] [blame] | 54 | |
| 55 | register := func(funcs []RegisterMutatorFunc) { |
| 56 | for _, f := range funcs { |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 57 | f(mctx) |
Nan Zhang | db0b9a3 | 2017-02-27 10:12:13 -0800 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 61 | register(preArch) |
Nan Zhang | db0b9a3 | 2017-02-27 10:12:13 -0800 | [diff] [blame] | 62 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 63 | register(preDeps) |
| 64 | |
| 65 | mctx.BottomUp("deps", depsMutator).Parallel() |
| 66 | |
| 67 | register(postDeps) |
| 68 | |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 69 | mctx.finalPhase = true |
| 70 | register(finalDeps) |
| 71 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 72 | registerMutatorsToContext(ctx, mctx.mutators) |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | type registerMutatorsContext struct { |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 76 | mutators []*mutator |
| 77 | finalPhase bool |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 78 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 79 | |
| 80 | type RegisterMutatorsContext interface { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 81 | TopDown(name string, m TopDownMutator) MutatorHandle |
| 82 | BottomUp(name string, m BottomUpMutator) MutatorHandle |
Colin Cross | 617b88a | 2020-08-24 18:04:09 -0700 | [diff] [blame] | 83 | BottomUpBlueprint(name string, m blueprint.BottomUpMutator) MutatorHandle |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | type RegisterMutatorFunc func(RegisterMutatorsContext) |
| 87 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 88 | var preArch = []RegisterMutatorFunc{ |
Dan Willemsen | 6e72ef7 | 2018-01-26 18:27:02 -0800 | [diff] [blame] | 89 | RegisterNamespaceMutator, |
Paul Duffin | aa4162e | 2020-05-05 11:35:43 +0100 | [diff] [blame] | 90 | |
Paul Duffin | aa4162e | 2020-05-05 11:35:43 +0100 | [diff] [blame] | 91 | // Check the visibility rules are valid. |
| 92 | // |
| 93 | // This must run after the package renamer mutators so that any issues found during |
| 94 | // validation of the package's default_visibility property are reported using the |
| 95 | // correct package name and not the synthetic name. |
| 96 | // |
| 97 | // This must also be run before defaults mutators as the rules for validation are |
| 98 | // different before checking the rules than they are afterwards. e.g. |
| 99 | // visibility: ["//visibility:private", "//visibility:public"] |
| 100 | // would be invalid if specified in a module definition but is valid if it results |
| 101 | // from something like this: |
| 102 | // |
| 103 | // defaults { |
| 104 | // name: "defaults", |
| 105 | // // Be inaccessible outside a package by default. |
| 106 | // visibility: ["//visibility:private"] |
| 107 | // } |
| 108 | // |
| 109 | // defaultable_module { |
| 110 | // name: "defaultable_module", |
| 111 | // defaults: ["defaults"], |
| 112 | // // Override the default. |
| 113 | // visibility: ["//visibility:public"] |
| 114 | // } |
| 115 | // |
Paul Duffin | 593b3c9 | 2019-12-05 14:31:48 +0000 | [diff] [blame] | 116 | RegisterVisibilityRuleChecker, |
Paul Duffin | aa4162e | 2020-05-05 11:35:43 +0100 | [diff] [blame] | 117 | |
| 118 | // Apply properties from defaults modules to the referencing modules. |
Paul Duffin | afa9fa1 | 2020-04-29 16:47:28 +0100 | [diff] [blame] | 119 | // |
| 120 | // Any mutators that are added before this will not see any modules created by |
| 121 | // a DefaultableHook. |
Colin Cross | 89536d4 | 2017-07-07 14:35:50 -0700 | [diff] [blame] | 122 | RegisterDefaultsPreArchMutators, |
Paul Duffin | aa4162e | 2020-05-05 11:35:43 +0100 | [diff] [blame] | 123 | |
Paul Duffin | 44f1d84 | 2020-06-26 20:17:02 +0100 | [diff] [blame] | 124 | // Add dependencies on any components so that any component references can be |
| 125 | // resolved within the deps mutator. |
| 126 | // |
| 127 | // Must be run after defaults so it can be used to create dependencies on the |
| 128 | // component modules that are creating in a DefaultableHook. |
| 129 | // |
| 130 | // Must be run before RegisterPrebuiltsPreArchMutators, i.e. before prebuilts are |
| 131 | // renamed. That is so that if a module creates components using a prebuilt module |
| 132 | // type that any dependencies (which must use prebuilt_ prefixes) are resolved to |
| 133 | // the prebuilt module and not the source module. |
| 134 | RegisterComponentsMutator, |
| 135 | |
Paul Duffin | c988c8e | 2020-04-29 18:27:14 +0100 | [diff] [blame] | 136 | // Create an association between prebuilt modules and their corresponding source |
| 137 | // modules (if any). |
Paul Duffin | afa9fa1 | 2020-04-29 16:47:28 +0100 | [diff] [blame] | 138 | // |
| 139 | // Must be run after defaults mutators to ensure that any modules created by |
| 140 | // a DefaultableHook can be either a prebuilt or a source module with a matching |
| 141 | // prebuilt. |
Paul Duffin | c988c8e | 2020-04-29 18:27:14 +0100 | [diff] [blame] | 142 | RegisterPrebuiltsPreArchMutators, |
| 143 | |
Paul Duffin | aa4162e | 2020-05-05 11:35:43 +0100 | [diff] [blame] | 144 | // Gather the visibility rules for all modules for us during visibility enforcement. |
| 145 | // |
| 146 | // This must come after the defaults mutators to ensure that any visibility supplied |
| 147 | // in a defaults module has been successfully applied before the rules are gathered. |
Paul Duffin | 593b3c9 | 2019-12-05 14:31:48 +0000 | [diff] [blame] | 148 | RegisterVisibilityRuleGatherer, |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Colin Cross | ae4c618 | 2017-09-15 17:33:55 -0700 | [diff] [blame] | 151 | func registerArchMutator(ctx RegisterMutatorsContext) { |
Colin Cross | 617b88a | 2020-08-24 18:04:09 -0700 | [diff] [blame] | 152 | ctx.BottomUpBlueprint("os", osMutator).Parallel() |
Colin Cross | fb0c16e | 2019-11-20 17:12:35 -0800 | [diff] [blame] | 153 | ctx.BottomUp("image", imageMutator).Parallel() |
Colin Cross | 617b88a | 2020-08-24 18:04:09 -0700 | [diff] [blame] | 154 | ctx.BottomUpBlueprint("arch", archMutator).Parallel() |
Colin Cross | ae4c618 | 2017-09-15 17:33:55 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 157 | var preDeps = []RegisterMutatorFunc{ |
Colin Cross | ae4c618 | 2017-09-15 17:33:55 -0700 | [diff] [blame] | 158 | registerArchMutator, |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | var postDeps = []RegisterMutatorFunc{ |
Colin Cross | 1b48842 | 2019-03-04 22:33:56 -0800 | [diff] [blame] | 162 | registerPathDepsMutator, |
Colin Cross | 5ea9bcc | 2017-07-27 15:41:32 -0700 | [diff] [blame] | 163 | RegisterPrebuiltsPostDepsMutators, |
Paul Duffin | 593b3c9 | 2019-12-05 14:31:48 +0000 | [diff] [blame] | 164 | RegisterVisibilityRuleEnforcer, |
Artur Satayev | c5570ac | 2020-04-09 16:06:36 +0100 | [diff] [blame] | 165 | RegisterNeverallowMutator, |
Jaewoong Jung | b639a6a | 2019-05-10 15:16:29 -0700 | [diff] [blame] | 166 | RegisterOverridePostDepsMutators, |
Colin Cross | cec8171 | 2017-07-13 14:43:27 -0700 | [diff] [blame] | 167 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 168 | |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 169 | var finalDeps = []RegisterMutatorFunc{} |
| 170 | |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 171 | func PreArchMutators(f RegisterMutatorFunc) { |
| 172 | preArch = append(preArch, f) |
| 173 | } |
| 174 | |
| 175 | func PreDepsMutators(f RegisterMutatorFunc) { |
| 176 | preDeps = append(preDeps, f) |
| 177 | } |
| 178 | |
| 179 | func PostDepsMutators(f RegisterMutatorFunc) { |
| 180 | postDeps = append(postDeps, f) |
| 181 | } |
| 182 | |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 183 | func FinalDepsMutators(f RegisterMutatorFunc) { |
| 184 | finalDeps = append(finalDeps, f) |
| 185 | } |
| 186 | |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 187 | type BaseMutatorContext interface { |
| 188 | BaseModuleContext |
| 189 | |
| 190 | // MutatorName returns the name that this mutator was registered with. |
| 191 | MutatorName() string |
| 192 | |
| 193 | // Rename all variants of a module. The new name is not visible to calls to ModuleName, |
| 194 | // AddDependency or OtherModuleName until after this mutator pass is complete. |
| 195 | Rename(name string) |
| 196 | } |
| 197 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 198 | type TopDownMutator func(TopDownMutatorContext) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 199 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 200 | type TopDownMutatorContext interface { |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 201 | BaseMutatorContext |
Colin Cross | 3f68a13 | 2017-10-23 17:10:29 -0700 | [diff] [blame] | 202 | |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 203 | // CreateModule creates a new module by calling the factory method for the specified moduleType, and applies |
| 204 | // the specified property structs to it as if the properties were set in a blueprint file. |
Colin Cross | e003c4a | 2019-09-25 12:58:36 -0700 | [diff] [blame] | 205 | CreateModule(ModuleFactory, ...interface{}) Module |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 206 | } |
| 207 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 208 | type topDownMutatorContext struct { |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 209 | bp blueprint.TopDownMutatorContext |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 210 | baseModuleContext |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 211 | } |
| 212 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 213 | type BottomUpMutator func(BottomUpMutatorContext) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 214 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 215 | type BottomUpMutatorContext interface { |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 216 | BaseMutatorContext |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 217 | |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 218 | // AddDependency adds a dependency to the given module. It returns a slice of modules for each |
| 219 | // dependency (some entries may be nil). |
| 220 | // |
| 221 | // If the mutator is parallel (see MutatorHandle.Parallel), this method will pause until the |
| 222 | // new dependencies have had the current mutator called on them. If the mutator is not |
| 223 | // parallel this method does not affect the ordering of the current mutator pass, but will |
| 224 | // be ordered correctly for all future mutator passes. |
| 225 | AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) []blueprint.Module |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 226 | |
| 227 | // AddReverseDependency adds a dependency from the destination to the given module. |
| 228 | // Does not affect the ordering of the current mutator pass, but will be ordered |
| 229 | // correctly for all future mutator passes. All reverse dependencies for a destination module are |
| 230 | // collected until the end of the mutator pass, sorted by name, and then appended to the destination |
| 231 | // module's dependency list. |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 232 | AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 233 | |
| 234 | // CreateVariations splits a module into multiple variants, one for each name in the variationNames |
| 235 | // parameter. It returns a list of new modules in the same order as the variationNames |
| 236 | // list. |
| 237 | // |
| 238 | // If any of the dependencies of the module being operated on were already split |
| 239 | // by calling CreateVariations with the same name, the dependency will automatically |
| 240 | // be updated to point the matching variant. |
| 241 | // |
| 242 | // If a module is split, and then a module depending on the first module is not split |
| 243 | // when the Mutator is later called on it, the dependency of the depending module will |
| 244 | // automatically be updated to point to the first variant. |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 245 | CreateVariations(...string) []Module |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 246 | |
| 247 | // CreateLocationVariations splits a module into multiple variants, one for each name in the variantNames |
| 248 | // parameter. It returns a list of new modules in the same order as the variantNames |
| 249 | // list. |
| 250 | // |
| 251 | // Local variations do not affect automatic dependency resolution - dependencies added |
| 252 | // to the split module via deps or DynamicDependerModule must exactly match a variant |
| 253 | // that contains all the non-local variations. |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 254 | CreateLocalVariations(...string) []Module |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 255 | |
| 256 | // SetDependencyVariation sets all dangling dependencies on the current module to point to the variation |
| 257 | // with given name. This function ignores the default variation set by SetDefaultDependencyVariation. |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 258 | SetDependencyVariation(string) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 259 | |
| 260 | // SetDefaultDependencyVariation sets the default variation when a dangling reference is detected |
| 261 | // during the subsequent calls on Create*Variations* functions. To reset, set it to nil. |
Jiyong Park | 1d1119f | 2019-07-29 21:27:18 +0900 | [diff] [blame] | 262 | SetDefaultDependencyVariation(*string) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 263 | |
| 264 | // AddVariationDependencies adds deps as dependencies of the current module, but uses the variations |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 265 | // argument to select which variant of the dependency to use. It returns a slice of modules for |
| 266 | // each dependency (some entries may be nil). A variant of the dependency must exist that matches |
| 267 | // the all of the non-local variations of the current module, plus the variations argument. |
| 268 | // |
| 269 | // If the mutator is parallel (see MutatorHandle.Parallel), this method will pause until the |
| 270 | // new dependencies have had the current mutator called on them. If the mutator is not |
| 271 | // parallel this method does not affect the ordering of the current mutator pass, but will |
| 272 | // be ordered correctly for all future mutator passes. |
| 273 | AddVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 274 | |
| 275 | // AddFarVariationDependencies adds deps as dependencies of the current module, but uses the |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 276 | // variations argument to select which variant of the dependency to use. It returns a slice of |
| 277 | // modules for each dependency (some entries may be nil). A variant of the dependency must |
| 278 | // exist that matches the variations argument, but may also have other variations. |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 279 | // For any unspecified variation the first variant will be used. |
| 280 | // |
| 281 | // Unlike AddVariationDependencies, the variations of the current module are ignored - the |
| 282 | // dependency only needs to match the supplied variations. |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 283 | // |
| 284 | // If the mutator is parallel (see MutatorHandle.Parallel), this method will pause until the |
| 285 | // new dependencies have had the current mutator called on them. If the mutator is not |
| 286 | // parallel this method does not affect the ordering of the current mutator pass, but will |
| 287 | // be ordered correctly for all future mutator passes. |
| 288 | AddFarVariationDependencies([]blueprint.Variation, blueprint.DependencyTag, ...string) []blueprint.Module |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 289 | |
| 290 | // AddInterVariantDependency adds a dependency between two variants of the same module. Variants are always |
| 291 | // ordered in the same orderas they were listed in CreateVariations, and AddInterVariantDependency does not change |
| 292 | // that ordering, but it associates a DependencyTag with the dependency and makes it visible to VisitDirectDeps, |
| 293 | // WalkDeps, etc. |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 294 | AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 295 | |
| 296 | // ReplaceDependencies replaces all dependencies on the identical variant of the module with the |
| 297 | // specified name with the current variant of this module. Replacements don't take effect until |
| 298 | // after the mutator pass is finished. |
Colin Cross | aabf679 | 2017-11-29 00:27:14 -0800 | [diff] [blame] | 299 | ReplaceDependencies(string) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 300 | |
| 301 | // ReplaceDependencies replaces all dependencies on the identical variant of the module with the |
| 302 | // specified name with the current variant of this module as long as the supplied predicate returns |
| 303 | // true. |
| 304 | // |
| 305 | // Replacements don't take effect until after the mutator pass is finished. |
Paul Duffin | 80342d7 | 2020-06-26 22:08:43 +0100 | [diff] [blame] | 306 | ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 307 | |
| 308 | // AliasVariation takes a variationName that was passed to CreateVariations for this module, |
| 309 | // and creates an alias from the current variant (before the mutator has run) to the new |
| 310 | // variant. The alias will be valid until the next time a mutator calls CreateVariations or |
| 311 | // CreateLocalVariations on this module without also calling AliasVariation. The alias can |
| 312 | // be used to add dependencies on the newly created variant using the variant map from |
| 313 | // before CreateVariations was run. |
Jaewoong Jung | 9f88ce2 | 2019-11-15 10:57:34 -0800 | [diff] [blame] | 314 | AliasVariation(variationName string) |
Colin Cross | 9f35c3d | 2020-09-16 19:04:41 -0700 | [diff] [blame] | 315 | |
| 316 | // CreateAliasVariation takes a toVariationName that was passed to CreateVariations for this |
| 317 | // module, and creates an alias from a new fromVariationName variant the toVariationName |
| 318 | // variant. The alias will be valid until the next time a mutator calls CreateVariations or |
| 319 | // CreateLocalVariations on this module without also calling AliasVariation. The alias can |
| 320 | // be used to add dependencies on the toVariationName variant using the fromVariationName |
| 321 | // variant. |
Colin Cross | 1b9604b | 2020-08-11 12:03:56 -0700 | [diff] [blame] | 322 | CreateAliasVariation(fromVariationName, toVariationName string) |
Colin Cross | d27e7b8 | 2020-07-02 11:38:17 -0700 | [diff] [blame] | 323 | |
| 324 | // SetVariationProvider sets the value for a provider for the given newly created variant of |
| 325 | // the current module, i.e. one of the Modules returned by CreateVariations.. It panics if |
| 326 | // not called during the appropriate mutator or GenerateBuildActions pass for the provider, |
| 327 | // if the value is not of the appropriate type, or if the module is not a newly created |
| 328 | // variant of the current module. The value should not be modified after being passed to |
| 329 | // SetVariationProvider. |
| 330 | SetVariationProvider(module blueprint.Module, provider blueprint.ProviderKey, value interface{}) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 331 | } |
| 332 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 333 | type bottomUpMutatorContext struct { |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 334 | bp blueprint.BottomUpMutatorContext |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 335 | baseModuleContext |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 336 | finalPhase bool |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 337 | } |
| 338 | |
Colin Cross | 617b88a | 2020-08-24 18:04:09 -0700 | [diff] [blame] | 339 | func bottomUpMutatorContextFactory(ctx blueprint.BottomUpMutatorContext, a Module, |
| 340 | finalPhase bool) BottomUpMutatorContext { |
| 341 | |
| 342 | return &bottomUpMutatorContext{ |
| 343 | bp: ctx, |
| 344 | baseModuleContext: a.base().baseModuleContextFactory(ctx), |
| 345 | finalPhase: finalPhase, |
| 346 | } |
| 347 | } |
| 348 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 349 | func (x *registerMutatorsContext) BottomUp(name string, m BottomUpMutator) MutatorHandle { |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 350 | finalPhase := x.finalPhase |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 351 | f := func(ctx blueprint.BottomUpMutatorContext) { |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 352 | if a, ok := ctx.Module().(Module); ok { |
Colin Cross | 617b88a | 2020-08-24 18:04:09 -0700 | [diff] [blame] | 353 | m(bottomUpMutatorContextFactory(ctx, a, finalPhase)) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 354 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 355 | } |
| 356 | mutator := &mutator{name: name, bottomUpMutator: f} |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 357 | x.mutators = append(x.mutators, mutator) |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 358 | return mutator |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 359 | } |
| 360 | |
Colin Cross | 617b88a | 2020-08-24 18:04:09 -0700 | [diff] [blame] | 361 | func (x *registerMutatorsContext) BottomUpBlueprint(name string, m blueprint.BottomUpMutator) MutatorHandle { |
| 362 | mutator := &mutator{name: name, bottomUpMutator: m} |
| 363 | x.mutators = append(x.mutators, mutator) |
| 364 | return mutator |
| 365 | } |
| 366 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 367 | func (x *registerMutatorsContext) TopDown(name string, m TopDownMutator) MutatorHandle { |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 368 | f := func(ctx blueprint.TopDownMutatorContext) { |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 369 | if a, ok := ctx.Module().(Module); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 370 | actx := &topDownMutatorContext{ |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 371 | bp: ctx, |
| 372 | baseModuleContext: a.base().baseModuleContextFactory(ctx), |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 373 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 374 | m(actx) |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 375 | } |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 376 | } |
| 377 | mutator := &mutator{name: name, topDownMutator: f} |
Colin Cross | 795c377 | 2017-03-16 16:50:10 -0700 | [diff] [blame] | 378 | x.mutators = append(x.mutators, mutator) |
Colin Cross | 798bfce | 2016-10-12 14:28:16 -0700 | [diff] [blame] | 379 | return mutator |
| 380 | } |
| 381 | |
| 382 | type MutatorHandle interface { |
| 383 | Parallel() MutatorHandle |
| 384 | } |
| 385 | |
| 386 | func (mutator *mutator) Parallel() MutatorHandle { |
| 387 | mutator.parallel = true |
| 388 | return mutator |
Colin Cross | 6362e27 | 2015-10-29 15:25:03 -0700 | [diff] [blame] | 389 | } |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 390 | |
Paul Duffin | 44f1d84 | 2020-06-26 20:17:02 +0100 | [diff] [blame] | 391 | func RegisterComponentsMutator(ctx RegisterMutatorsContext) { |
| 392 | ctx.BottomUp("component-deps", componentDepsMutator).Parallel() |
| 393 | } |
| 394 | |
| 395 | // A special mutator that runs just prior to the deps mutator to allow the dependencies |
| 396 | // on component modules to be added so that they can depend directly on a prebuilt |
| 397 | // module. |
| 398 | func componentDepsMutator(ctx BottomUpMutatorContext) { |
| 399 | if m := ctx.Module(); m.Enabled() { |
| 400 | m.ComponentDepsMutator(ctx) |
| 401 | } |
| 402 | } |
| 403 | |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 404 | func depsMutator(ctx BottomUpMutatorContext) { |
Paul Duffin | 44f1d84 | 2020-06-26 20:17:02 +0100 | [diff] [blame] | 405 | if m := ctx.Module(); m.Enabled() { |
Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 406 | m.DepsMutator(ctx) |
| 407 | } |
| 408 | } |
Colin Cross | d11fcda | 2017-10-23 17:59:01 -0700 | [diff] [blame] | 409 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 410 | func (t *topDownMutatorContext) AppendProperties(props ...interface{}) { |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 411 | for _, p := range props { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 412 | err := proptools.AppendMatchingProperties(t.Module().base().customizableProperties, |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 413 | p, nil) |
| 414 | if err != nil { |
| 415 | if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 416 | t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 417 | } else { |
| 418 | panic(err) |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 424 | func (t *topDownMutatorContext) PrependProperties(props ...interface{}) { |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 425 | for _, p := range props { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 426 | err := proptools.PrependMatchingProperties(t.Module().base().customizableProperties, |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 427 | p, nil) |
| 428 | if err != nil { |
| 429 | if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { |
Colin Cross | 25de6c3 | 2019-06-06 14:29:25 -0700 | [diff] [blame] | 430 | t.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) |
Colin Cross | 519917d | 2017-11-02 16:35:56 -0700 | [diff] [blame] | 431 | } else { |
| 432 | panic(err) |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | } |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 437 | |
| 438 | // android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that |
| 439 | // has an overridden version in android.BaseModuleContext has to be manually forwarded to BaseModuleContext to avoid |
| 440 | // ambiguous method errors, or it has to store a blueprint.TopDownMutatorContext non-embedded, in which case every |
| 441 | // non-overridden method has to be forwarded. There are fewer non-overridden methods, so use the latter. The following |
| 442 | // methods forward to the identical blueprint versions for topDownMutatorContext and bottomUpMutatorContext. |
| 443 | |
Colin Cross | cb55e08 | 2019-07-01 15:32:31 -0700 | [diff] [blame] | 444 | func (t *topDownMutatorContext) MutatorName() string { |
| 445 | return t.bp.MutatorName() |
| 446 | } |
| 447 | |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 448 | func (t *topDownMutatorContext) Rename(name string) { |
| 449 | t.bp.Rename(name) |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 450 | t.Module().base().commonProperties.DebugName = name |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 451 | } |
| 452 | |
Colin Cross | e003c4a | 2019-09-25 12:58:36 -0700 | [diff] [blame] | 453 | func (t *topDownMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module { |
Colin Cross | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 454 | inherited := []interface{}{&t.Module().base().commonProperties} |
Colin Cross | e003c4a | 2019-09-25 12:58:36 -0700 | [diff] [blame] | 455 | module := t.bp.CreateModule(ModuleFactoryAdaptor(factory), append(inherited, props...)...).(Module) |
Colin Cross | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 456 | |
| 457 | if t.Module().base().variableProperties != nil && module.base().variableProperties != nil { |
| 458 | src := t.Module().base().variableProperties |
| 459 | dst := []interface{}{ |
| 460 | module.base().variableProperties, |
| 461 | // Put an empty copy of the src properties into dst so that properties in src that are not in dst |
| 462 | // don't cause a "failed to find property to extend" error. |
Colin Cross | 43e789d | 2020-01-28 09:46:50 -0800 | [diff] [blame] | 463 | proptools.CloneEmptyProperties(reflect.ValueOf(src)).Interface(), |
Colin Cross | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 464 | } |
| 465 | err := proptools.AppendMatchingProperties(dst, src, nil) |
| 466 | if err != nil { |
| 467 | panic(err) |
| 468 | } |
| 469 | } |
| 470 | |
Colin Cross | e003c4a | 2019-09-25 12:58:36 -0700 | [diff] [blame] | 471 | return module |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 472 | } |
| 473 | |
Colin Cross | cb55e08 | 2019-07-01 15:32:31 -0700 | [diff] [blame] | 474 | func (b *bottomUpMutatorContext) MutatorName() string { |
| 475 | return b.bp.MutatorName() |
| 476 | } |
| 477 | |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 478 | func (b *bottomUpMutatorContext) Rename(name string) { |
| 479 | b.bp.Rename(name) |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 480 | b.Module().base().commonProperties.DebugName = name |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 483 | func (b *bottomUpMutatorContext) AddDependency(module blueprint.Module, tag blueprint.DependencyTag, name ...string) []blueprint.Module { |
| 484 | return b.bp.AddDependency(module, tag, name...) |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | func (b *bottomUpMutatorContext) AddReverseDependency(module blueprint.Module, tag blueprint.DependencyTag, name string) { |
| 488 | b.bp.AddReverseDependency(module, tag, name) |
| 489 | } |
| 490 | |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 491 | func (b *bottomUpMutatorContext) CreateVariations(variations ...string) []Module { |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 492 | if b.finalPhase { |
| 493 | panic("CreateVariations not allowed in FinalDepsMutators") |
| 494 | } |
| 495 | |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 496 | modules := b.bp.CreateVariations(variations...) |
| 497 | |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 498 | aModules := make([]Module, len(modules)) |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 499 | for i := range variations { |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 500 | aModules[i] = modules[i].(Module) |
| 501 | base := aModules[i].base() |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 502 | base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) |
| 503 | base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) |
| 504 | } |
| 505 | |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 506 | return aModules |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 507 | } |
| 508 | |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 509 | func (b *bottomUpMutatorContext) CreateLocalVariations(variations ...string) []Module { |
Martin Stjernholm | 710ec3a | 2020-01-16 15:12:04 +0000 | [diff] [blame] | 510 | if b.finalPhase { |
| 511 | panic("CreateLocalVariations not allowed in FinalDepsMutators") |
| 512 | } |
| 513 | |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 514 | modules := b.bp.CreateLocalVariations(variations...) |
| 515 | |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 516 | aModules := make([]Module, len(modules)) |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 517 | for i := range variations { |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 518 | aModules[i] = modules[i].(Module) |
| 519 | base := aModules[i].base() |
Colin Cross | 9a36223 | 2019-07-01 15:32:45 -0700 | [diff] [blame] | 520 | base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, b.MutatorName()) |
| 521 | base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variations[i]) |
| 522 | } |
| 523 | |
Colin Cross | 43b92e0 | 2019-11-18 15:28:57 -0800 | [diff] [blame] | 524 | return aModules |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | func (b *bottomUpMutatorContext) SetDependencyVariation(variation string) { |
| 528 | b.bp.SetDependencyVariation(variation) |
| 529 | } |
| 530 | |
Jiyong Park | 1d1119f | 2019-07-29 21:27:18 +0900 | [diff] [blame] | 531 | func (b *bottomUpMutatorContext) SetDefaultDependencyVariation(variation *string) { |
| 532 | b.bp.SetDefaultDependencyVariation(variation) |
| 533 | } |
| 534 | |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 535 | func (b *bottomUpMutatorContext) AddVariationDependencies(variations []blueprint.Variation, tag blueprint.DependencyTag, |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 536 | names ...string) []blueprint.Module { |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 537 | |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 538 | return b.bp.AddVariationDependencies(variations, tag, names...) |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 539 | } |
| 540 | |
| 541 | func (b *bottomUpMutatorContext) AddFarVariationDependencies(variations []blueprint.Variation, |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 542 | tag blueprint.DependencyTag, names ...string) []blueprint.Module { |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 543 | |
Colin Cross | 4f1dcb0 | 2020-09-16 18:45:04 -0700 | [diff] [blame] | 544 | return b.bp.AddFarVariationDependencies(variations, tag, names...) |
Colin Cross | dc35e21 | 2019-06-06 16:13:11 -0700 | [diff] [blame] | 545 | } |
| 546 | |
| 547 | func (b *bottomUpMutatorContext) AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module) { |
| 548 | b.bp.AddInterVariantDependency(tag, from, to) |
| 549 | } |
| 550 | |
| 551 | func (b *bottomUpMutatorContext) ReplaceDependencies(name string) { |
| 552 | b.bp.ReplaceDependencies(name) |
| 553 | } |
Jaewoong Jung | 9f88ce2 | 2019-11-15 10:57:34 -0800 | [diff] [blame] | 554 | |
Paul Duffin | 80342d7 | 2020-06-26 22:08:43 +0100 | [diff] [blame] | 555 | func (b *bottomUpMutatorContext) ReplaceDependenciesIf(name string, predicate blueprint.ReplaceDependencyPredicate) { |
| 556 | b.bp.ReplaceDependenciesIf(name, predicate) |
| 557 | } |
| 558 | |
Jaewoong Jung | 9f88ce2 | 2019-11-15 10:57:34 -0800 | [diff] [blame] | 559 | func (b *bottomUpMutatorContext) AliasVariation(variationName string) { |
| 560 | b.bp.AliasVariation(variationName) |
| 561 | } |
Colin Cross | 1b9604b | 2020-08-11 12:03:56 -0700 | [diff] [blame] | 562 | |
| 563 | func (b *bottomUpMutatorContext) CreateAliasVariation(fromVariationName, toVariationName string) { |
| 564 | b.bp.CreateAliasVariation(fromVariationName, toVariationName) |
| 565 | } |
Colin Cross | d27e7b8 | 2020-07-02 11:38:17 -0700 | [diff] [blame] | 566 | |
| 567 | func (b *bottomUpMutatorContext) SetVariationProvider(module blueprint.Module, provider blueprint.ProviderKey, value interface{}) { |
| 568 | b.bp.SetVariationProvider(module, provider, value) |
| 569 | } |