gn2bp: add support for building against Android zlib

Experimental support -- off by default.

Test: builds.
Change-Id: Ibf58f981f9b135bc1504bc8264d4e2b917f8b597
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 1c36c61..884a48c 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -96,6 +96,10 @@
 local_include_dirs_denylist = [
 ]
 
+android_include_dirs_denylist = [
+    'third_party/zlib/',
+]
+
 # Name of the module which settings such as compiler flags for all other
 # modules.
 defaults_module = module_prefix + 'defaults'
@@ -140,6 +144,13 @@
     ],
 }
 
+def enable_zlib(module, arch):
+  # Requires crrev/c/4109079
+  if arch is None:
+    module.shared_libs.add('libz')
+  else:
+    module.arch[arch].shared_libs.add('libz')
+
 # Android equivalents for third-party libraries that the upstream project
 # depends on.
 builtin_deps = {
@@ -149,6 +160,16 @@
         lambda m, a: None,
 }
 
+android_deps = {
+    '//third_party/zlib:zlib':
+        enable_zlib,
+}
+
+# Uncomment the following lines to use Android deps rather than their Chromium
+# equivalent:
+#builtin_deps.update(android_deps)
+#local_include_dirs_denylist.extend(android_include_dirs_denylist)
+
 # Name of tethering apex module
 tethering_apex = "com.android.tethering"