Handle excludes_{shared,static}_libs

Bug: 188497994
Test: bp2build.sh
Change-Id: I4a5ea40cbd804e8542fe33143e4926abc0c6164f
diff --git a/android/bazel_paths.go b/android/bazel_paths.go
index f4b2a7c..f93fe2b 100644
--- a/android/bazel_paths.go
+++ b/android/bazel_paths.go
@@ -100,6 +100,22 @@
 	return labels
 }
 
+// BazelLabelForModuleDeps expects two lists: modules (containing modules to include in the list),
+// and excludes (modules to exclude from the list). Both of these should contain references to other
+// modules, ("<module>" or ":<module>"). It returns a Bazel-compatible label list which corresponds
+// to dependencies on the module within the given ctx, and the excluded dependencies.
+func BazelLabelForModuleDepsExcludes(ctx BazelConversionPathContext, modules, excludes []string) bazel.LabelList {
+	moduleLabels := BazelLabelForModuleDeps(ctx, RemoveListFromList(modules, excludes))
+	if len(excludes) == 0 {
+		return moduleLabels
+	}
+	excludeLabels := BazelLabelForModuleDeps(ctx, excludes)
+	return bazel.LabelList{
+		Includes: moduleLabels.Includes,
+		Excludes: excludeLabels.Includes,
+	}
+}
+
 func BazelLabelForModuleSrcSingle(ctx BazelConversionPathContext, path string) bazel.Label {
 	return BazelLabelForModuleSrcExcludes(ctx, []string{path}, []string(nil)).Includes[0]
 }