Merge "Add -gen suffix to genrule targets with conflicts" am: bf1b88dd35

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2626356

Change-Id: I696eaeeba8ea5c2c1be0b25ff76a6934d4add83c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Christopher Parsons 2023-06-20 17:09:03 +00:00 committed by Automerger Merge Worker
commit 1f876020cf

View file

@ -1012,6 +1012,17 @@ func (m *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
break
}
}
bazelName := m.Name()
for _, out := range outs {
if out == bazelName {
// This is a workaround to circumvent a Bazel warning where a genrule's
// out may not have the same name as the target itself. This makes no
// difference for reverse dependencies, because they may depend on the
// out file by name.
bazelName = bazelName + "-gen"
break
}
}
attrs := &bazelGenruleAttributes{
Srcs: srcs,
Outs: outs,
@ -1022,7 +1033,7 @@ func (m *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
Rule_class: "genrule",
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
Name: m.Name(),
Name: bazelName,
Tags: tags,
}, attrs)
}