Support shared_libs, static_libs and default_shared_libs in cc_object
cc_object files don't link against static or shared libraries, but they
can use headers from them. Make cc_object use the default_shared_libs
headers, and add support for explicit static and shared library
dependencies.
Bug: 153662223
Test: go test ./cc/...
Change-Id: I9ab160ede06db1b135d217d72770c22f500cfe1b
diff --git a/bp2build/cc_object_conversion_test.go b/bp2build/cc_object_conversion_test.go
index 57f75ea..8ede226 100644
--- a/bp2build/cc_object_conversion_test.go
+++ b/bp2build/cc_object_conversion_test.go
@@ -46,6 +46,7 @@
blueprint: `cc_object {
name: "foo",
local_include_dirs: ["include"],
+ default_shared_libs: [],
cflags: [
"-Wno-gcc-compat",
"-Wall",
@@ -83,6 +84,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
local_include_dirs: ["include"],
srcs: [
"a/b/*.h",
@@ -135,12 +137,14 @@
},
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
srcs: ["a/b/c.c"],
objs: ["bar"],
}
cc_object {
name: "bar",
+ default_shared_libs: [],
srcs: ["x/y/z.c"],
}
`,
@@ -178,6 +182,7 @@
},
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
srcs: ["a/b/c.c"],
include_build_directory: false,
}
@@ -199,6 +204,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
include_build_directory: false,
product_variables: {
platform_sdk_version: {
@@ -227,6 +233,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
srcs: ["a.cpp"],
arch: {
x86: {
@@ -266,6 +273,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
srcs: ["base.cpp"],
arch: {
x86: {
@@ -321,6 +329,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
+ default_shared_libs: [],
srcs: ["base.cpp"],
target: {
android: {