bp2build: support generated sources and hdrs

There are two pieces to make this work:
1. Local include paths must include $(BINDIR)-relative paths, to support
generated headers in those directories.
2. The srcs that bp2build outputs for BUILD targets must include labels
for targets given in generated_hdrs and generated_srcs.

Support for exported_generated_hdrs intentionally deferred.

This allows us to remove several targets from the bp2build denylist.
Some are moved to the mixed build denylist, because genreated headers are
still unsupported in mixed builds.
Test: bp2build.sh CI script

Change-Id: Ib4f9dac20f6445487b8dad53b91eac01f437a590
This commit is contained in:
Chris Parsons
2021-05-13 15:13:04 -04:00
parent b1caeb0768
commit 484e50aa7c
7 changed files with 379 additions and 68 deletions

View File

@@ -65,7 +65,9 @@ func TestCcObjectBp2Build(t *testing.T) {
"-Wall",
"-Werror",
"-Iinclude",
"-I$(BINDIR)/include",
"-I.",
"-I$(BINDIR)/.",
],
srcs = ["a/b/c.c"],
)`,
@@ -109,7 +111,9 @@ cc_defaults {
"-Werror",
"-fno-addrsig",
"-Iinclude",
"-I$(BINDIR)/include",
"-I.",
"-I$(BINDIR)/.",
],
srcs = ["a/b/c.c"],
)`,
@@ -140,6 +144,7 @@ cc_object {
copts = [
"-fno-addrsig",
"-I.",
"-I$(BINDIR)/.",
],
srcs = ["x/y/z.c"],
)`, `cc_object(
@@ -147,6 +152,7 @@ cc_object {
copts = [
"-fno-addrsig",
"-I.",
"-I$(BINDIR)/.",
],
deps = [":bar"],
srcs = ["a/b/c.c"],
@@ -284,6 +290,7 @@ func TestCcObjectConfigurableAttributesBp2Build(t *testing.T) {
copts = [
"-fno-addrsig",
"-I.",
"-I$(BINDIR)/.",
] + select({
"//build/bazel/platforms/arch:x86": ["-fPIC"],
"//conditions:default": [],
@@ -329,6 +336,7 @@ func TestCcObjectConfigurableAttributesBp2Build(t *testing.T) {
copts = [
"-fno-addrsig",
"-I.",
"-I$(BINDIR)/.",
] + select({
"//build/bazel/platforms/arch:arm": ["-Wall"],
"//build/bazel/platforms/arch:arm64": ["-Wall"],
@@ -373,6 +381,7 @@ func TestCcObjectConfigurableAttributesBp2Build(t *testing.T) {
copts = [
"-fno-addrsig",
"-I.",
"-I$(BINDIR)/.",
] + select({
"//build/bazel/platforms/os:android": ["-fPIC"],
"//build/bazel/platforms/os:darwin": ["-Wall"],