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
This commit is contained in:
Alix
2023-04-24 14:57:32 +00:00
parent 8f55732317
commit e266787aed
7 changed files with 159 additions and 11 deletions

View File

@@ -1555,3 +1555,33 @@ cc_library_shared {
},
})
}
func TestCCLibrarySharedRscriptSrc(t *testing.T) {
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
Description: ``,
Blueprint: `
cc_library_shared{
name : "foo",
srcs : [
"ccSrc.cc",
"rsSrc.rscript",
],
include_build_directory: false,
}
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("rscript_to_cpp", "foo_renderscript", AttrNameToString{
"srcs": `["rsSrc.rscript"]`,
}),
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"absolute_includes": `[
"frameworks/rs",
"frameworks/rs/cpp",
]`,
"local_includes": `["."]`,
"srcs": `[
"ccSrc.cc",
"foo_renderscript",
]`,
})}})
}