Rename Label.Bp_text to OriginalModuleName.

OriginalModuleName is a clearer name for what the field represents.

Also document it.

Follow-up from aosp/1675466.

Test: TH
Change-Id: Ie1152b5ae63f388164582be70e193a91ef96c89c
This commit is contained in:
Jingwen Chen
2021-04-19 05:00:15 +00:00
parent a0b235a9d9
commit 38e6264fff
3 changed files with 26 additions and 10 deletions

View File

@@ -35,11 +35,27 @@ const BazelTargetModuleNamePrefix = "__bp2build__"
var productVariableSubstitutionPattern = regexp.MustCompile("%(d|s)")
// Label is used to represent a Bazel compatible Label. Also stores the original bp text to support
// string replacement.
// Label is used to represent a Bazel compatible Label. Also stores the original
// bp text to support string replacement.
type Label struct {
Bp_text string
Label string
// The string representation of a Bazel target label. This can be a relative
// or fully qualified label. These labels are used for generating BUILD
// files with bp2build.
Label string
// The original Soong/Blueprint module name that the label was derived from.
// This is used for replacing references to the original name with the new
// label, for example in genrule cmds.
//
// While there is a reversible 1:1 mapping from the module name to Bazel
// label with bp2build that could make computing the original module name
// from the label automatic, it is not the case for handcrafted targets,
// where modules can have a custom label mapping through the { bazel_module:
// { label: <label> } } property.
//
// With handcrafted labels, those modules don't go through bp2build
// conversion, but relies on handcrafted targets in the source tree.
OriginalModuleName string
}
// LabelList is used to represent a list of Bazel labels.