Add shared libs from upstream cc modules to cc_aidl_library targets

In Soong, aidl cc binding code is built with all the libs defined in the cc modules. In Bazel, because cc_aidl_library creates a cc_library_static target with the generated .h and .cpp files, it needs to depend on the libs from the parent cc modules in order to build successfully.

We can also consider including static libs but that requires a larger change to cc_aidl_library macro (e.g. renaming deps to aidl_libraries and preserving deps for static libs to be consistent with cc lirary macros).

This CL only adds shared libs (e.g. (implementation_)dynamic_deps) and ignore static libs for now since they're not needed for the modules currently  allowlisted.

This fix is similar to https://android-review.googlesource.com/c/platform/build/soong/+/2219103/4/android/proto.go#207 for proto.

We can follow-up with adding static libs to cc_aidl_library later if needed.

Bug: 247151591
Test: presubmit is able to build allowlisted modules successfully
Change-Id: I40f14297f8c8f4c2a36b1e972d009824398b59cd
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index f633040..1b8e9b4 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3206,3 +3206,45 @@
 		},
 	})
 }
+
+func TestCcLibraryWithAidlAndSharedLibs(t *testing.T) {
+	runCcLibraryTestCase(t, Bp2buildTestCase{
+		Description:                "cc_aidl_library depends on shared libs from parent cc_library_static",
+		ModuleTypeUnderTest:        "cc_library",
+		ModuleTypeUnderTestFactory: cc.LibraryFactory,
+		Blueprint: `
+cc_library_static {
+    name: "foo",
+    srcs: [
+        "Foo.aidl",
+    ],
+	shared_libs: [
+		"bar",
+		"baz",
+	],
+	export_shared_lib_headers: [
+		"baz",
+	],
+}` +
+			simpleModuleDoNotConvertBp2build("cc_library", "bar") +
+			simpleModuleDoNotConvertBp2build("cc_library", "baz"),
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("aidl_library", "foo_aidl_library", AttrNameToString{
+				"srcs": `["Foo.aidl"]`,
+			}),
+			MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
+				"deps": `[":foo_aidl_library"]`,
+				"implementation_dynamic_deps": `[
+        ":baz",
+        ":bar",
+    ]`,
+			}),
+			MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+				"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
+				"dynamic_deps":                      `[":baz"]`,
+				"implementation_dynamic_deps":       `[":bar"]`,
+				"local_includes":                    `["."]`,
+			}),
+		},
+	})
+}