From dba5e0f214d3880599a76b7ba69b5f00f571c67b Mon Sep 17 00:00:00 2001 From: Bill Peckham Date: Wed, 12 May 2021 17:21:17 -0700 Subject: [PATCH] Add support for vndk llndk libraries in Android.bp Now that the vndk includes llndk libraries, we must also create the modules for them in the generated Android.bp files. llndk must not define `vndk.enabled: true` and will not be included vndk apexes. No changes on vndk v30 and earlier snapshot versions. Bug: 187963715 Bug: 181815415 Test: python3 development/vndk/snapshot/update.py --use-current-branch --local Change-Id: Ic33d169cc089199e5a742990f6ecfb08c1858288 --- vndk/snapshot/gen_buildfiles.py | 60 ++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/vndk/snapshot/gen_buildfiles.py b/vndk/snapshot/gen_buildfiles.py index f56187dbe..336a9f988 100644 --- a/vndk/snapshot/gen_buildfiles.py +++ b/vndk/snapshot/gen_buildfiles.py @@ -102,6 +102,8 @@ class GenBuildFile(object): self._snapshot_archs = utils.get_snapshot_archs(install_dir) self._root_bpfile = os.path.join(install_dir, utils.ROOT_BP_PATH) self._common_bpfile = os.path.join(install_dir, utils.COMMON_BP_PATH) + self._llndk = self._parse_lib_list( + os.path.basename(self._etc_paths['llndk.libraries.txt'])) self._vndk_core = self._parse_lib_list( os.path.basename(self._etc_paths['vndkcore.libraries.txt'])) self._vndk_sp = self._parse_lib_list( @@ -232,15 +234,26 @@ class GenBuildFile(object): vndk_core_buildrules = self._gen_vndk_shared_prebuilts( self._vndk_core[arch], arch, + is_llndk=False, is_vndk_sp=False, is_binder32=is_binder32, module_names=module_names) vndk_sp_buildrules = self._gen_vndk_shared_prebuilts( self._vndk_sp[arch], arch, + is_llndk=False, is_vndk_sp=True, is_binder32=is_binder32, module_names=module_names) + include_llndk = self._vndk_version > 30 + if include_llndk: + llndk_buildrules = self._gen_vndk_shared_prebuilts( + self._llndk[arch], + arch, + is_llndk=True, + is_vndk_sp=False, + is_binder32=is_binder32, + module_names=module_names) with open(bpfile_path, 'w') as bpfile: bpfile.write(self._gen_autogen_msg('/')) @@ -248,6 +261,9 @@ class GenBuildFile(object): bpfile.write('\n'.join(vndk_core_buildrules)) bpfile.write('\n') bpfile.write('\n'.join(vndk_sp_buildrules)) + if include_llndk: + bpfile.write('\n') + bpfile.write('\n'.join(llndk_buildrules)) variant_include_path = os.path.join(variant_path, 'include') include_path = os.path.join(self._install_dir, arch, 'include') @@ -409,6 +425,7 @@ class GenBuildFile(object): def _gen_vndk_shared_prebuilts(self, prebuilts, arch, + is_llndk, is_vndk_sp, is_binder32, module_names): @@ -417,6 +434,7 @@ class GenBuildFile(object): Args: prebuilts: list of VNDK shared prebuilts arch: string, VNDK snapshot arch (e.g. 'arm64') + is_llndk: bool, True if the prebuilts are LLNDK stubs is_vndk_sp: bool, True if prebuilts are VNDK_SP libs is_binder32: bool, True if binder interface is 32-bit module_names: dict, module names for given prebuilts @@ -427,6 +445,7 @@ class GenBuildFile(object): bp_module = self._gen_vndk_shared_prebuilt( prebuilt, arch, + is_llndk=is_llndk, is_vndk_sp=is_vndk_sp, is_binder32=is_binder32, module_names=module_names) @@ -437,6 +456,7 @@ class GenBuildFile(object): def _gen_vndk_shared_prebuilt(self, prebuilt, arch, + is_llndk, is_vndk_sp, is_binder32, module_names): @@ -446,6 +466,7 @@ class GenBuildFile(object): Args: prebuilt: string, name of prebuilt object arch: string, VNDK snapshot arch (e.g. 'arm64') + is_llndk: bool, True if prebuilt is a LLNDK stub is_vndk_sp: bool, True if prebuilt is a VNDK_SP lib is_binder32: bool, True if binder interface is 32-bit module_names: dict, module names for given prebuilts @@ -571,19 +592,31 @@ class GenBuildFile(object): product_available = '' # if vndkproduct.libraries.txt is empty, make the VNDKs available to product by default. - if not self._vndk_product[arch] or prebuilt in self._vndk_product[arch]: + if not self._vndk_product[arch] or prebuilt in self._vndk_product[arch] or is_llndk: product_available = '{ind}product_available: true,\n'.format( ind=self.INDENT) - vndk_sp = '' - if is_vndk_sp: - vndk_sp = '{ind}{ind}support_system_process: true,\n'.format( - ind=self.INDENT) + vndk_props = '' + if not is_llndk: + vndk_sp = '' + if is_vndk_sp: + vndk_sp = '{ind}{ind}support_system_process: true,\n'.format( + ind=self.INDENT) - vndk_private = '' - if prebuilt in self._vndk_private[arch]: - vndk_private = '{ind}{ind}private: true,\n'.format( - ind=self.INDENT) + vndk_private = '' + if prebuilt in self._vndk_private[arch]: + vndk_private = '{ind}{ind}private: true,\n'.format( + ind=self.INDENT) + + vndk_props = ('{ind}vndk: {{\n' + '{ind}{ind}enabled: true,\n' + '{vndk_sp}' + '{vndk_private}' + '{ind}}},\n'.format( + ind=self.INDENT, + product_available=product_available, + vndk_sp=vndk_sp, + vndk_private=vndk_private)) notice = get_notice_file(prebuilt) arch_props = get_arch_props(prebuilt, arch, src_paths) @@ -599,11 +632,7 @@ class GenBuildFile(object): '{binder32bit}' '{ind}vendor_available: true,\n' '{product_available}' - '{ind}vndk: {{\n' - '{ind}{ind}enabled: true,\n' - '{vndk_sp}' - '{vndk_private}' - '{ind}}},\n' + '{vndk_props}' '{notice}' '{arch_props}' '}}\n'.format( @@ -613,8 +642,7 @@ class GenBuildFile(object): target_arch=arch, binder32bit=binder32bit, product_available=product_available, - vndk_sp=vndk_sp, - vndk_private=vndk_private, + vndk_props=vndk_props, notice=notice, arch_props=arch_props))