cronet: add script to generate desc_*.json

It's very basic for now.

Test: run the script
Change-Id: Ie848f8da6936f4300ba5ecdc041523440be25e8a
diff --git a/tools/gn2bp/gen_desc_json.sh b/tools/gn2bp/gen_desc_json.sh
new file mode 100755
index 0000000..510b967
--- /dev/null
+++ b/tools/gn2bp/gen_desc_json.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+set -x
+
+# Run this script inside a full chromium checkout.
+# TODO: add support for applying local patches.
+
+OUT_PATH="out/cronet"
+
+#######################################
+# Generate desc.json for a specified architecture.
+# Globals:
+#   OUT_PATH
+# Arguments:
+#   target_cpu, string
+#######################################
+function gn_desc() {
+  local -a gn_args=(
+    "target_os = \"android\""
+    "enable_websockets = false"
+    "disable_file_support = true"
+    "disable_brotli_filter = false"
+    "is_component_build = false"
+    "use_crash_key_stubs = true"
+    "use_partition_alloc = false"
+    "include_transport_security_state_preload_list = false"
+    "use_platform_icu_alternatives = true"
+    "default_min_sdk_version = 19"
+    "use_errorprone_java_compiler = true"
+    "enable_reporting = true"
+    "use_hashed_jni_names = true"
+    "treat_warnings_as_errors = false"
+    "enable_base_tracing = false"
+  )
+  gn_args+=("target_cpu = \"${1}\"")
+
+  # Only set arm_use_neon on arm architectures to prevent warning from being
+  # written to json output.
+  if [[ "$1" =~ ^arm ]]; then
+    gn_args+=("arm_use_neon = false")
+  fi
+
+  # Configure gn args.
+  gn gen "${OUT_PATH}" --args="${gn_args[*]}"
+
+  # Generate desc.json.
+  local -r out_file="desc_${1}.json"
+  gn desc "${OUT_PATH}" --format=json --all-toolchains "//*" > "${out_file}"
+}
+
+gn_desc x86
+gn_desc x64
+gn_desc arm
+gn_desc arm64
+