Handle include_build_directory prop in bp2build

Test: go test cc tests
Test: generate bp2build, sync bp2build, bazel build //bionic/...
Bug: 181794963
Change-Id: I8dcef585e3025ef6f44d22430ed67b1e0429dca0
This commit is contained in:
Liz Kammer
2021-03-18 16:56:36 -04:00
parent 45a4971808
commit a4aa43072b
3 changed files with 51 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ func TestCcObjectBp2Build(t *testing.T) {
],
local_include_dirs = [
"include",
".",
],
srcs = [
"a/b/bar.h",
@@ -120,6 +121,7 @@ cc_defaults {
],
local_include_dirs = [
"include",
".",
],
srcs = [
"a/b/c.c",
@@ -156,6 +158,9 @@ cc_object {
copts = [
"-fno-addrsig",
],
local_include_dirs = [
".",
],
srcs = [
"x/y/z.c",
],
@@ -167,6 +172,37 @@ cc_object {
deps = [
":bar",
],
local_include_dirs = [
".",
],
srcs = [
"a/b/c.c",
],
)`,
},
},
{
description: "cc_object with include_build_dir: false",
moduleTypeUnderTest: "cc_object",
moduleTypeUnderTestFactory: cc.ObjectFactory,
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
filesystem: map[string]string{
"a/b/c.c": "",
"x/y/z.c": "",
},
blueprint: `cc_object {
name: "foo",
srcs: ["a/b/c.c"],
include_build_directory: false,
bazel_module: { bp2build_available: true },
}
`,
expectedBazelTargets: []string{`cc_object(
name = "foo",
copts = [
"-fno-addrsig",
],
srcs = [
"a/b/c.c",
],
@@ -262,6 +298,9 @@ func TestCcObjectConfigurableAttributesBp2Build(t *testing.T) {
"//conditions:default": [
],
}),
local_include_dirs = [
".",
],
)`,
},
},
@@ -310,6 +349,9 @@ func TestCcObjectConfigurableAttributesBp2Build(t *testing.T) {
"//conditions:default": [
],
}),
local_include_dirs = [
".",
],
)`,
},
},