Add product_available to VNDK snapshots

Using vndkproduct.libraries.txt, add 'product_available' property to
the selected VNDK libraries. If the snapshot does not have
vndkproduct.libraries.txt, create an empty list file and make all
snapshot libraries available to product.

Bug: 174323911
Bug: 150902910
Test: run update.py for various snapshot versions
Change-Id: I3f680abcbf73e3f74c5dad49f57e02de4d87a148
This commit is contained in:
Justin Yun
2020-11-27 20:14:28 +09:00
parent aa9127dce6
commit ba2a7e18f8
2 changed files with 28 additions and 4 deletions

View File

@@ -63,7 +63,8 @@ class GenBuildFile(object):
'llndk.libraries.txt',
'vndksp.libraries.txt',
'vndkcore.libraries.txt',
'vndkprivate.libraries.txt'
'vndkprivate.libraries.txt',
'vndkproduct.libraries.txt',
]
def __init__(self, install_dir, vndk_version):
@@ -86,6 +87,8 @@ class GenBuildFile(object):
os.path.basename(self._etc_paths['vndksp.libraries.txt']))
self._vndk_private = self._parse_lib_list(
os.path.basename(self._etc_paths['vndkprivate.libraries.txt']))
self._vndk_product = self._parse_lib_list(
os.path.basename(self._etc_paths['vndkproduct.libraries.txt']))
self._modules_with_notice = self._get_modules_with_notice()
def _get_etc_paths(self):
@@ -117,6 +120,8 @@ class GenBuildFile(object):
abs_path_of_txt = os.path.join(self._install_dir, txt_path)
with open(abs_path_of_txt, 'r') as f:
lib_map[arch] = f.read().strip().split('\n')
if lib_map[arch] == ['']:
lib_map[arch].clear()
return lib_map
def _get_modules_with_notice(self):
@@ -487,6 +492,11 @@ class GenBuildFile(object):
name = os.path.splitext(prebuilt)[0]
vendor_available = str(
prebuilt not in self._vndk_private[arch]).lower()
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]:
product_available = '{ind}product_available: {available},\n'.format(
ind=self.INDENT, available=vendor_available)
vndk_sp = ''
if is_vndk_sp:
@@ -506,6 +516,7 @@ class GenBuildFile(object):
'{ind}target_arch: "{target_arch}",\n'
'{binder32bit}'
'{ind}vendor_available: {vendor_available},\n'
'{product_available}'
'{ind}vndk: {{\n'
'{ind}{ind}enabled: true,\n'
'{vndk_sp}'
@@ -519,6 +530,7 @@ class GenBuildFile(object):
target_arch=arch,
binder32bit=binder32bit,
vendor_available=vendor_available,
product_available=product_available,
vndk_sp=vndk_sp,
notice=notice,
arch_props=arch_props))