summaryrefslogtreecommitdiff
path: root/bp2build/filegroup_conversion_test.go
diff options
context:
space:
mode:
author Vinh Tran <vinhdaitran@google.com> 2022-08-16 13:10:31 -0400
committer Vinh Tran <vinhdaitran@google.com> 2022-08-18 14:01:15 -0400
commit444154d5d31b25b9d6412540465198b324ba4cb1 (patch)
tree29c288e9d29536bcf99ab4ce7dd05e2d8e62bfd6 /bp2build/filegroup_conversion_test.go
parent16fe8e1cf108c95ee48776121c4e2d45d9e3fd50 (diff)
Convert filegroup with AIDL srcs to aidl_library
Change-Id: I94c185744a86c812dc48e30b66e060361b9161cb Test: USE_BAZEL_ANALYSIS=1 m libbinder Test: USE_BAZEL_ANALYSIS=1 m module-lib-api-stubs-docs-non-updatable Bug: 243010121
Diffstat (limited to 'bp2build/filegroup_conversion_test.go')
-rw-r--r--bp2build/filegroup_conversion_test.go65
1 files changed, 65 insertions, 0 deletions
diff --git a/bp2build/filegroup_conversion_test.go b/bp2build/filegroup_conversion_test.go
index b598b855e..de09a1787 100644
--- a/bp2build/filegroup_conversion_test.go
+++ b/bp2build/filegroup_conversion_test.go
@@ -56,3 +56,68 @@ filegroup {
ExpectedErr: fmt.Errorf("filegroup 'foo' cannot contain a file with the same name"),
})
}
+
+func TestFilegroupWithAidlSrcs(t *testing.T) {
+ testcases := []struct {
+ name string
+ bp string
+ expectedBazelAttrs AttrNameToString
+ }{
+ {
+ name: "filegroup with only aidl srcs",
+ bp: `
+ filegroup {
+ name: "foo",
+ srcs: ["aidl/foo.aidl"],
+ path: "aidl",
+ }`,
+ expectedBazelAttrs: AttrNameToString{
+ "srcs": `["aidl/foo.aidl"]`,
+ "strip_import_prefix": `"aidl"`,
+ },
+ },
+ {
+ name: "filegroup without path",
+ bp: `
+ filegroup {
+ name: "foo",
+ srcs: ["aidl/foo.aidl"],
+ }`,
+ expectedBazelAttrs: AttrNameToString{
+ "srcs": `["aidl/foo.aidl"]`,
+ },
+ },
+ }
+
+ for _, test := range testcases {
+ expectedBazelTargets := []string{
+ MakeBazelTargetNoRestrictions("aidl_library", "foo", test.expectedBazelAttrs),
+ }
+ runFilegroupTestCase(t, Bp2buildTestCase{
+ Description: test.name,
+ Blueprint: test.bp,
+ ExpectedBazelTargets: expectedBazelTargets,
+ })
+ }
+}
+
+func TestFilegroupWithAidlAndNonAidlSrcs(t *testing.T) {
+ runFilegroupTestCase(t, Bp2buildTestCase{
+ Description: "filegroup with aidl and non-aidl srcs",
+ Filesystem: map[string]string{},
+ Blueprint: `
+filegroup {
+ name: "foo",
+ srcs: [
+ "aidl/foo.aidl",
+ "buf.proto",
+ ],
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{
+ "srcs": `[
+ "aidl/foo.aidl",
+ "buf.proto",
+ ]`}),
+ }})
+}