Implement bp2build for the license module

Also, add ExpectedRuleTarget type to simplify bp2build testing

Bug: 190817312
Test: treehugger
Change-Id: Id3a642680d3518d36360ba957919a6fc96222672
This commit is contained in:
Sasha Smundak
2022-08-04 13:28:38 -07:00
parent fb58949414
commit 9d2f1743d2
5 changed files with 139 additions and 2 deletions

View File

@@ -141,7 +141,7 @@ func RunBp2BuildTestCase(t *testing.T, registerModuleTypes func(ctx android.Regi
android.FailIfErrored(t, errs)
}
if actualCount, expectedCount := len(bazelTargets), len(tc.ExpectedBazelTargets); actualCount != expectedCount {
t.Errorf("%s: Expected %d bazel target (%s), got `%d`` (%s)",
t.Errorf("%s: Expected %d bazel target (%s), got %d (%s)",
tc.Description, expectedCount, tc.ExpectedBazelTargets, actualCount, bazelTargets)
} else {
for i, target := range bazelTargets {
@@ -452,3 +452,14 @@ func MakeBazelTargetNoRestrictions(typ, name string, attrs AttrNameToString) str
func MakeBazelTarget(typ, name string, attrs AttrNameToString) string {
return makeBazelTargetHostOrDevice(typ, name, attrs, android.DeviceSupported)
}
type ExpectedRuleTarget struct {
Rule string
Name string
Attrs AttrNameToString
Hod android.HostOrDeviceSupported
}
func (ebr ExpectedRuleTarget) String() string {
return makeBazelTargetHostOrDevice(ebr.Rule, ebr.Name, ebr.Attrs, ebr.Hod)
}