bp2build: add support for cc_object's objs and exclude_srcs properties.

objs contains module references to other cc_objects that will be used
for linking later. This maps to cc_library deps.

Also support exclude_srcs, and added tests.

Test: bp2build generate, sync, bazel build //bionic/...

Change-Id: I21200ff73f24bcf5357d9df8dcb5519cde532a77
diff --git a/bp2build/cc_object_conversion_test.go b/bp2build/cc_object_conversion_test.go
index f094102..f655842 100644
--- a/bp2build/cc_object_conversion_test.go
+++ b/bp2build/cc_object_conversion_test.go
@@ -38,9 +38,10 @@
 			moduleTypeUnderTestFactory:         cc.ObjectFactory,
 			moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
 			filesystem: map[string]string{
-				"a/b/foo.h": "",
-				"a/b/bar.h": "",
-				"a/b/c.c":   "",
+				"a/b/foo.h":     "",
+				"a/b/bar.h":     "",
+				"a/b/exclude.c": "",
+				"a/b/c.c":       "",
 			},
 			blueprint: `cc_object {
     name: "foo",
@@ -52,8 +53,9 @@
     ],
     srcs: [
         "a/b/*.h",
-        "a/b/c.c"
+        "a/b/*.c"
     ],
+    exclude_srcs: ["a/b/exclude.c"],
 
     bazel_module: { bp2build_available: true },
 }
@@ -134,6 +136,52 @@
 )`,
 			},
 		},
+		{
+			description:                        "cc_object with cc_object deps in objs props",
+			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"],
+    objs: ["bar"],
+
+    bazel_module: { bp2build_available: true },
+}
+
+cc_object {
+    name: "bar",
+    srcs: ["x/y/z.c"],
+
+    bazel_module: { bp2build_available: true },
+}
+`,
+			expectedBazelTargets: []string{`cc_object(
+    name = "bar",
+    copts = [
+        "-fno-addrsig",
+    ],
+    srcs = [
+        "x/y/z.c",
+    ],
+)`, `cc_object(
+    name = "foo",
+    copts = [
+        "-fno-addrsig",
+    ],
+    deps = [
+        ":bar",
+    ],
+    srcs = [
+        "a/b/c.c",
+    ],
+)`,
+			},
+		},
 	}
 
 	dir := "."