From a2a29342aad7bccc2f55f47615f7d5c34b80ba6a Mon Sep 17 00:00:00 2001 From: Bill Peckham Date: Mon, 5 Oct 2020 16:22:12 -0700 Subject: [PATCH] Split gen_bp_files, make Android.bp idempotent. Split gen_bp_files for future use of new build_props function. Sort the data output to the Android.bp file so that the script does not depend on the sort of the keys in the various dictionaries. Bug: 157967325 Test: verify that vendor snapshot content is identical Test: verify Android.bp is sorted by arch, variation, name Change-Id: I438f8611ad460bccfcae99441ad7c60aa3b68c49 --- vendor_snapshot/update.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vendor_snapshot/update.py b/vendor_snapshot/update.py index 253888a63..b71a12fa1 100644 --- a/vendor_snapshot/update.py +++ b/vendor_snapshot/update.py @@ -208,7 +208,7 @@ def gen_bp_module(variation, name, version, target_arch, arch_props, bp_dir): return bp -def gen_bp_files(install_dir, snapshot_version): +def build_props(install_dir): # props[target_arch]["static"|"shared"|"binary"|"header"][name][arch] : json props = dict() @@ -264,11 +264,17 @@ def gen_bp_files(install_dir, snapshot_version): else: variation_dict[module_name][arch].update(prop) - for target_arch in props: + return props + + +def gen_bp_files(install_dir, snapshot_version): + props = build_props(install_dir) + + for target_arch in sorted(props): androidbp = '' bp_dir = os.path.join(install_dir, target_arch) - for variation in props[target_arch]: - for name in props[target_arch][variation]: + for variation in sorted(props[target_arch]): + for name in sorted(props[target_arch][variation]): androidbp += gen_bp_module(variation, name, snapshot_version, target_arch, props[target_arch][variation][name],