bp2build conversion for rscript srcs in cc modules
Bazel does not support using .rscrip/.fs files as cc srcs.
For a module foo with foo srcs, Bp2build will create a bazel
target of rule class rscript_to_cpp with name foo_renderscript
which will have only the renderscript files as srcs.
Bp2build will also create a target foo with the expected cc rule class.
The foo target will have all other src files as srcs and will also
have the target foo_renderscript as another src.
Bug: 210509914
Test: bp2build testing & b build target rstest-latency
Change-Id: Ifdc55051a3595f5fcf54eab8b59e11e9351e141c
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index ab6e4a5..18cb9e1 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -1182,3 +1182,35 @@
},
})
}
+
+func TestCCBinaryRscriptSrc(t *testing.T) {
+ runCcBinaryTests(t, ccBinaryBp2buildTestCase{
+ description: `cc_binary with rscript files in sources`,
+ blueprint: `
+{rule_name} {
+ name : "foo",
+ srcs : [
+ "ccSrc.cc",
+ "rsSrc.rscript",
+ ],
+ include_build_directory: false,
+}
+`,
+ targets: []testBazelTarget{
+ {"rscript_to_cpp", "foo_renderscript", AttrNameToString{
+ "srcs": `["rsSrc.rscript"]`,
+ }},
+ {"cc_binary", "foo", AttrNameToString{
+ "absolute_includes": `[
+ "frameworks/rs",
+ "frameworks/rs/cpp",
+ ]`,
+ "local_includes": `["."]`,
+ "srcs": `[
+ "ccSrc.cc",
+ "foo_renderscript",
+ ]`,
+ }},
+ },
+ })
+}