From eb19dca3ef72231d64eaef34344e1c0e4042e7df Mon Sep 17 00:00:00 2001 From: Motomu Utsumi Date: Wed, 25 Jan 2023 15:25:08 +0900 Subject: [PATCH] gn2bp: Add apply patch function to gen_desc_json.sh Test: ./gen_desc_json.sh Change-Id: I971ad72a562a1340fa4a6f29468b7415915a7335 --- tools/gn2bp/gen_desc_json.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/gn2bp/gen_desc_json.sh b/tools/gn2bp/gen_desc_json.sh index ed684b35ff..6d1a4f2075 100755 --- a/tools/gn2bp/gen_desc_json.sh +++ b/tools/gn2bp/gen_desc_json.sh @@ -2,10 +2,33 @@ set -x # Run this script inside a full chromium checkout. -# TODO: add support for applying local patches. OUT_PATH="out/cronet" +####################################### +# Apply patches in external/cronet. +# Globals: +# ANDROID_BUILD_TOP +# Arguments: +# None +####################################### +function apply_patches() { + local -r patch_root="${ANDROID_BUILD_TOP}/external/cronet/patches" + + local upstream_patches + upstream_patches=$(ls "${patch_root}/upstream-next") + local patch + for patch in ${upstream_patches}; do + git am --3way "${patch_root}/upstream-next/${patch}" + done + + local local_patches + local_patches=$(ls "${patch_root}/local") + for patch in ${local_patches}; do + git am --3way "${patch_root}/local/${patch}" + done +} + ####################################### # Generate desc.json for a specified architecture. # Globals: @@ -48,6 +71,7 @@ function gn_desc() { gn desc "${OUT_PATH}" --format=json --all-toolchains "//*" > "${out_file}" } +apply_patches gn_desc x86 gn_desc x64 gn_desc arm