diff options
author | 2022-09-01 11:54:47 -0700 | |
---|---|---|
committer | 2022-09-14 13:02:53 -0700 | |
commit | 2aa806b52d305b1fd0eb7007f13a331eaa034e17 (patch) | |
tree | 59035754afe801982c7a572b14656138459da08b /bp2build/filegroup_conversion_test.go | |
parent | 8c6f4576ef15c9266c06d83bf032d976fff88648 (diff) |
Support proto modules with external references.
Bug: 236055697
Test: Manual testing and adding new unit tests.
Change-Id: I984c0ecb93f0023727a39a3af3921820337bf8c7
Diffstat (limited to 'bp2build/filegroup_conversion_test.go')
-rw-r--r-- | bp2build/filegroup_conversion_test.go | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/bp2build/filegroup_conversion_test.go b/bp2build/filegroup_conversion_test.go index de09a1787..d84d4b374 100644 --- a/bp2build/filegroup_conversion_test.go +++ b/bp2build/filegroup_conversion_test.go @@ -15,10 +15,10 @@ package bp2build import ( - "android/soong/android" "fmt" - "testing" + + "android/soong/android" ) func runFilegroupTestCase(t *testing.T, tc Bp2buildTestCase) { @@ -121,3 +121,43 @@ filegroup { ]`}), }}) } + +func TestFilegroupWithProtoSrcs(t *testing.T) { + runFilegroupTestCase(t, Bp2buildTestCase{ + Description: "filegroup with proto and non-proto srcs", + Filesystem: map[string]string{}, + Blueprint: ` +filegroup { + name: "foo", + srcs: ["proto/foo.proto"], + path: "proto", +}`, + ExpectedBazelTargets: []string{ + MakeBazelTargetNoRestrictions("proto_library", "foo_bp2build_converted", AttrNameToString{ + "srcs": `["proto/foo.proto"]`, + "strip_import_prefix": `"proto"`}), + MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{ + "srcs": `["proto/foo.proto"]`}), + }}) +} + +func TestFilegroupWithProtoAndNonProtoSrcs(t *testing.T) { + runFilegroupTestCase(t, Bp2buildTestCase{ + Description: "filegroup with proto and non-proto srcs", + Filesystem: map[string]string{}, + Blueprint: ` +filegroup { + name: "foo", + srcs: [ + "foo.proto", + "buf.cpp", + ], +}`, + ExpectedBazelTargets: []string{ + MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{ + "srcs": `[ + "foo.proto", + "buf.cpp", + ]`}), + }}) +} |