Files
build_soong/bp2build/compatibility.go
Jingwen Chen 16d90a8954 Remove __bp2build__ prefix trimming.
This is no longer needed after r.android.com/1792714

Test: CI
Change-Id: I808c3124cf1a4f3ebe5d25e41f346a818c3cc57c
2021-09-17 07:16:59 +00:00

28 lines
864 B
Go

package bp2build
import (
"fmt"
)
// Data from the code generation process that is used to improve compatibility
// between build systems.
type CodegenCompatLayer struct {
// A map from the original module name to the generated/handcrafted Bazel
// label for legacy build systems to be able to build a fully-qualified
// Bazel target from an unique module name.
NameToLabelMap map[string]string
}
// Log an entry of module name -> Bazel target label.
func (compatLayer CodegenCompatLayer) AddNameToLabelEntry(name, label string) {
if existingLabel, ok := compatLayer.NameToLabelMap[name]; ok {
panic(fmt.Errorf(
"Module '%s' maps to more than one Bazel target label: %s, %s. "+
"This shouldn't happen. It probably indicates a bug with the bp2build internals.",
name,
existingLabel,
label))
}
compatLayer.NameToLabelMap[name] = label
}