Omit bazel.LabelList attrs if no path is specified

Test: go test build_conversion_test.go
Change-Id: Ibcd81049788e99422569fe74e5f3834df4a05122
This commit is contained in:
Liz Kammer 2021-02-16 15:00:05 -05:00
parent 031d8693b3
commit ebfcf672ef
2 changed files with 18 additions and 0 deletions

View File

@ -395,6 +395,9 @@ func BazelLabelForModuleSrcExcludes(ctx BazelConversionPathContext, paths, exclu
// `android:"path"` so that dependencies on other modules will have already been handled by the
// path_properties mutator.
func expandSrcsForBazel(ctx BazelConversionPathContext, paths, expandedExcludes []string) bazel.LabelList {
if paths == nil {
return bazel.LabelList{}
}
labels := bazel.LabelList{
Includes: []bazel.Label{},
}

View File

@ -468,6 +468,21 @@ genrule {
fs map[string]string
dir string
}{
{
description: "filegroup with does not specify srcs",
moduleTypeUnderTest: "filegroup",
moduleTypeUnderTestFactory: android.FileGroupFactory,
moduleTypeUnderTestBp2BuildMutator: android.FilegroupBp2Build,
bp: `filegroup {
name: "fg_foo",
bazel_module: { bp2build_available: true },
}`,
expectedBazelTargets: []string{
`filegroup(
name = "fg_foo",
)`,
},
},
{
description: "filegroup with no srcs",
moduleTypeUnderTest: "filegroup",