diff options
| author | 2023-03-09 18:54:44 +0000 | |
|---|---|---|
| committer | 2023-03-09 18:54:44 +0000 | |
| commit | dc3f27f7b6ac14682df885eae1e35e44fce7c164 (patch) | |
| tree | 9a64887e7796d633ea2b02c2d5eb72e5b4515ff9 /android/mutator.go | |
| parent | 81771ec3d51b1c7269ee34e0f3c7e6f24b0fcc10 (diff) | |
| parent | d14a70d7ed4e2bfcbb50458b226ecc91b6b82115 (diff) | |
Merge changes Ib004c2c3,I6b63d9d0 am: d14a70d7ed
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2475621
Change-Id: I70c01922b3d6d7d0f4f7c8ceb547acc0f6dd9b68
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'android/mutator.go')
| -rw-r--r-- | android/mutator.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/android/mutator.go b/android/mutator.go index 4dacb8df8..676f8a511 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -268,6 +268,11 @@ type TopDownMutatorContext interface { // platforms, as dictated by a given bool attribute: the target will not be buildable in // any platform for which this bool attribute is false. CreateBazelTargetModuleWithRestrictions(bazel.BazelTargetModuleProperties, CommonAttributes, interface{}, bazel.BoolAttribute) + + // CreateBazelTargetAliasInDir creates an alias definition in `dir` directory. + // This function can be used to create alias definitions in a directory that is different + // from the directory of the visited Soong module. + CreateBazelTargetAliasInDir(dir string, name string, actual bazel.Label) } type topDownMutatorContext struct { @@ -705,6 +710,34 @@ func (t *topDownMutatorContext) CreateBazelTargetModuleWithRestrictions( t.createBazelTargetModule(bazelProps, commonAttrs, attrs, enabledProperty) } +var ( + bazelAliasModuleProperties = bazel.BazelTargetModuleProperties{ + Rule_class: "alias", + } +) + +type bazelAliasAttributes struct { + Actual *bazel.LabelAttribute +} + +func (t *topDownMutatorContext) CreateBazelTargetAliasInDir( + dir string, + name string, + actual bazel.Label) { + mod := t.Module() + attrs := &bazelAliasAttributes{ + Actual: bazel.MakeLabelAttribute(actual.Label), + } + info := bp2buildInfo{ + Dir: dir, + BazelProps: bazelAliasModuleProperties, + CommonAttrs: CommonAttributes{Name: name}, + ConstraintAttrs: constraintAttributes{}, + Attrs: attrs, + } + mod.base().addBp2buildInfo(info) +} + // ApexAvailableTags converts the apex_available property value of an ApexModule // module and returns it as a list of keyed tags. func ApexAvailableTags(mod Module) bazel.StringListAttribute { |