Support new binder32bit property
Starting in VNDK snapshot v28 (P), prebuilts built for 32-bit
binder interface are isolated in separate 'binder32' subdirectory
under prebuilts/vndk/v{VER}/{ARCH}/. All other prebuilts are
assumed to use 64-bit binder interface.
To differentiate prebuilts per binder bitness, the following
changes are made:
1) a new 'binder32bit' property added to the Android.bp files
autogenerated for the vndk_prebuilt_shared soong module
2) new phony modules, vndk_v{ver}_{arch}_binder32, defined for
32-bit binder prebuilts,
3) 'binder32' suffix added to the prebuilt versioned name,
e.g. libfoo.vndk.{ver}.{arch}.binder32.vendor
Test: python gen_buildfiles.py 28 -vv
Test: python gen_buildfiles.py 27 -vv
Bug: 78279738
Change-Id: I283fe25a34d3381d13097ede34c428c83dffe11e
This commit is contained in:
@@ -271,7 +271,8 @@ def main():
|
|||||||
logging.error('Error: {}'.format(error))
|
logging.error('Error: {}'.format(error))
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
logging.info('Deleting temp_artifact_dir: {}'.format(temp_artifact_dir))
|
logging.info(
|
||||||
|
'Deleting temp_artifact_dir: {}'.format(temp_artifact_dir))
|
||||||
shutil.rmtree(temp_artifact_dir)
|
shutil.rmtree(temp_artifact_dir)
|
||||||
|
|
||||||
logging.info('Done.')
|
logging.info('Done.')
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class GenBuildFile(object):
|
|||||||
"""Generates Android.mk and Android.bp for VNDK snapshot.
|
"""Generates Android.mk and Android.bp for VNDK snapshot.
|
||||||
|
|
||||||
VNDK snapshot directory structure under prebuilts/vndk/v{version}:
|
VNDK snapshot directory structure under prebuilts/vndk/v{version}:
|
||||||
{SNAPSHOT_VARIANT}/
|
{SNAPSHOT_ARCH}/
|
||||||
Android.bp
|
Android.bp
|
||||||
arch-{TARGET_ARCH}-{TARGET_ARCH_VARIANT}/
|
arch-{TARGET_ARCH}-{TARGET_ARCH_VARIANT}/
|
||||||
shared/
|
shared/
|
||||||
@@ -42,9 +42,15 @@ class GenBuildFile(object):
|
|||||||
(VNDK-core libraries, e.g. libbinder.so)
|
(VNDK-core libraries, e.g. libbinder.so)
|
||||||
vndk-sp/
|
vndk-sp/
|
||||||
(VNDK-SP libraries, e.g. libc++.so)
|
(VNDK-SP libraries, e.g. libc++.so)
|
||||||
|
binder32/
|
||||||
|
(This directory is newly introduced in v28 (Android P) to hold
|
||||||
|
prebuilts built for 32-bit binder interface.)
|
||||||
|
Android.bp
|
||||||
|
arch-{TARGET_ARCH}-{TARGE_ARCH_VARIANT}/
|
||||||
|
...
|
||||||
configs/
|
configs/
|
||||||
(various *.txt configuration files, e.g. ld.config.*.txt)
|
(various *.txt configuration files, e.g. ld.config.*.txt)
|
||||||
... (other {SNAPSHOT_VARIANT}/ directories)
|
... (other {SNAPSHOT_ARCH}/ directories)
|
||||||
common/
|
common/
|
||||||
Android.mk
|
Android.mk
|
||||||
NOTICE_FILES/
|
NOTICE_FILES/
|
||||||
@@ -69,7 +75,7 @@ class GenBuildFile(object):
|
|||||||
self._install_dir = install_dir
|
self._install_dir = install_dir
|
||||||
self._vndk_version = vndk_version
|
self._vndk_version = vndk_version
|
||||||
self._etc_paths = self._get_etc_paths()
|
self._etc_paths = self._get_etc_paths()
|
||||||
self._snapshot_variants = utils.get_snapshot_variants(install_dir)
|
self._snapshot_archs = utils.get_snapshot_archs(install_dir)
|
||||||
self._mkfile = os.path.join(install_dir, utils.ANDROID_MK_PATH)
|
self._mkfile = os.path.join(install_dir, utils.ANDROID_MK_PATH)
|
||||||
self._vndk_core = self._parse_lib_list('vndkcore.libraries.txt')
|
self._vndk_core = self._parse_lib_list('vndkcore.libraries.txt')
|
||||||
self._vndk_sp = self._parse_lib_list(
|
self._vndk_sp = self._parse_lib_list(
|
||||||
@@ -90,7 +96,7 @@ class GenBuildFile(object):
|
|||||||
return etc_paths
|
return etc_paths
|
||||||
|
|
||||||
def _parse_lib_list(self, txt_filename):
|
def _parse_lib_list(self, txt_filename):
|
||||||
"""Returns a map of VNDK library lists per VNDK snapshot variant.
|
"""Returns a map of VNDK library lists per VNDK snapshot arch.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
txt_filename: string, name of snapshot config file
|
txt_filename: string, name of snapshot config file
|
||||||
@@ -100,15 +106,17 @@ class GenBuildFile(object):
|
|||||||
"""
|
"""
|
||||||
lib_map = dict()
|
lib_map = dict()
|
||||||
for txt_path in utils.find(self._install_dir, [txt_filename]):
|
for txt_path in utils.find(self._install_dir, [txt_filename]):
|
||||||
variant = utils.variant_from_path(txt_path)
|
arch = utils.snapshot_arch_from_path(txt_path)
|
||||||
abs_path_of_txt = os.path.join(self._install_dir, txt_path)
|
abs_path_of_txt = os.path.join(self._install_dir, txt_path)
|
||||||
with open(abs_path_of_txt, 'r') as f:
|
with open(abs_path_of_txt, 'r') as f:
|
||||||
lib_map[variant] = f.read().strip().split('\n')
|
lib_map[arch] = f.read().strip().split('\n')
|
||||||
return lib_map
|
return lib_map
|
||||||
|
|
||||||
def generate_android_mk(self):
|
def generate_android_mk(self):
|
||||||
"""Autogenerates Android.mk."""
|
"""Autogenerates Android.mk."""
|
||||||
|
|
||||||
|
logging.info('Generating Android.mk for snapshot v{}'.format(
|
||||||
|
self._vndk_version))
|
||||||
etc_buildrules = []
|
etc_buildrules = []
|
||||||
for prebuilt in self.ETC_MODULES:
|
for prebuilt in self.ETC_MODULES:
|
||||||
etc_buildrules.append(self._gen_etc_prebuilt(prebuilt))
|
etc_buildrules.append(self._gen_etc_prebuilt(prebuilt))
|
||||||
@@ -121,49 +129,104 @@ class GenBuildFile(object):
|
|||||||
mkfile.write('\n\n'.join(etc_buildrules))
|
mkfile.write('\n\n'.join(etc_buildrules))
|
||||||
mkfile.write('\n')
|
mkfile.write('\n')
|
||||||
|
|
||||||
|
logging.info('Successfully generated {}'.format(self._mkfile))
|
||||||
|
|
||||||
def generate_android_bp(self):
|
def generate_android_bp(self):
|
||||||
"""Autogenerates Android.bp file for each VNDK snapshot variant."""
|
"""Autogenerates Android.bp."""
|
||||||
|
|
||||||
|
def gen_for_variant(arch, is_binder32=False):
|
||||||
|
"""Generates Android.bp file for specified VNDK snapshot variant.
|
||||||
|
|
||||||
|
A VNDK snapshot variant is defined by the TARGET_ARCH and binder
|
||||||
|
bitness. Example snapshot variants:
|
||||||
|
vndk_v{ver}_arm: {arch: arm, binder: 64-bit}
|
||||||
|
vndk_v{ver}_arm_binder32: {arch: arm, binder: 32-bit}
|
||||||
|
|
||||||
|
Args:
|
||||||
|
arch: string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
|
is_binder32: bool, True if binder interface is 32-bit
|
||||||
|
"""
|
||||||
|
binder32_suffix = '_{}'.format(
|
||||||
|
utils.BINDER32) if is_binder32 else ''
|
||||||
|
logging.info('Generating Android.bp for vndk_v{}_{}{}'.format(
|
||||||
|
self._vndk_version, arch, binder32_suffix))
|
||||||
|
|
||||||
|
variant_subpath = arch
|
||||||
|
# For O-MR1 snapshot (v27), 32-bit binder prebuilts are not
|
||||||
|
# isolated in separate 'binder32' subdirectory.
|
||||||
|
if is_binder32 and self._vndk_version >= 28:
|
||||||
|
variant_subpath = os.path.join(arch, utils.BINDER32)
|
||||||
|
bpfile_path = os.path.join(self._install_dir, variant_subpath,
|
||||||
|
'Android.bp')
|
||||||
|
|
||||||
for variant in self._snapshot_variants:
|
|
||||||
bpfile = os.path.join(self._install_dir, variant, 'Android.bp')
|
|
||||||
vndk_core_buildrules = self._gen_vndk_shared_prebuilts(
|
vndk_core_buildrules = self._gen_vndk_shared_prebuilts(
|
||||||
self._vndk_core[variant], variant, False)
|
self._vndk_core[arch], arch, is_binder32=is_binder32)
|
||||||
vndk_sp_buildrules = self._gen_vndk_shared_prebuilts(
|
vndk_sp_buildrules = self._gen_vndk_shared_prebuilts(
|
||||||
self._vndk_sp[variant], variant, True)
|
self._vndk_sp[arch],
|
||||||
|
arch,
|
||||||
|
is_vndk_sp=True,
|
||||||
|
is_binder32=is_binder32)
|
||||||
|
|
||||||
with open(bpfile, 'w') as bpfile:
|
with open(bpfile_path, 'w') as bpfile:
|
||||||
bpfile.write(self._gen_autogen_msg('/'))
|
bpfile.write(self._gen_autogen_msg('/'))
|
||||||
bpfile.write('\n')
|
bpfile.write('\n')
|
||||||
bpfile.write(self._gen_bp_phony(variant))
|
bpfile.write(self._gen_bp_phony(arch, is_binder32))
|
||||||
bpfile.write('\n')
|
bpfile.write('\n')
|
||||||
bpfile.write('\n'.join(vndk_core_buildrules))
|
bpfile.write('\n'.join(vndk_core_buildrules))
|
||||||
bpfile.write('\n')
|
bpfile.write('\n')
|
||||||
bpfile.write('\n'.join(vndk_sp_buildrules))
|
bpfile.write('\n'.join(vndk_sp_buildrules))
|
||||||
|
|
||||||
|
logging.info('Successfully generated {}'.format(bpfile_path))
|
||||||
|
|
||||||
|
if self._vndk_version == 27:
|
||||||
|
# For O-MR1 snapshot (v27), 32-bit binder prebuilts are not
|
||||||
|
# isolated in separate 'binder32' subdirectory.
|
||||||
|
for arch in self._snapshot_archs:
|
||||||
|
if arch in ('arm', 'x86'):
|
||||||
|
gen_for_variant(arch, is_binder32=True)
|
||||||
|
else:
|
||||||
|
gen_for_variant(arch)
|
||||||
|
return
|
||||||
|
|
||||||
|
for arch in self._snapshot_archs:
|
||||||
|
if os.path.isdir(
|
||||||
|
os.path.join(self._install_dir, arch, utils.BINDER32)):
|
||||||
|
gen_for_variant(arch, is_binder32=True)
|
||||||
|
gen_for_variant(arch)
|
||||||
|
|
||||||
def _gen_autogen_msg(self, comment_char):
|
def _gen_autogen_msg(self, comment_char):
|
||||||
return ('{0}{0} THIS FILE IS AUTOGENERATED BY '
|
return ('{0}{0} THIS FILE IS AUTOGENERATED BY '
|
||||||
'development/vndk/snapshot/gen_buildfiles.py\n'
|
'development/vndk/snapshot/gen_buildfiles.py\n'
|
||||||
'{0}{0} DO NOT EDIT\n'.format(comment_char))
|
'{0}{0} DO NOT EDIT\n'.format(comment_char))
|
||||||
|
|
||||||
def _get_versioned_name(self, prebuilt, variant, is_etc):
|
def _get_versioned_name(self,
|
||||||
|
prebuilt,
|
||||||
|
arch,
|
||||||
|
is_etc=False,
|
||||||
|
is_binder32=False):
|
||||||
"""Returns the VNDK version-specific module name for a given prebuilt.
|
"""Returns the VNDK version-specific module name for a given prebuilt.
|
||||||
|
|
||||||
The VNDK version-specific module name is defined as follows:
|
The VNDK version-specific module name is defined as follows:
|
||||||
For a VNDK shared lib: 'libfoo.so'
|
For a VNDK shared lib: 'libfoo.so'
|
||||||
-> 'libfoo.vndk.{version}.{variant}.vendor'
|
if binder is 32-bit:
|
||||||
|
'libfoo.vndk.{version}.{arch}.binder32.vendor'
|
||||||
|
else:
|
||||||
|
'libfoo.vndk.{version}.{arch}.vendor'
|
||||||
For an ETC module: 'foo.txt' -> 'foo.{version}.txt'
|
For an ETC module: 'foo.txt' -> 'foo.{version}.txt'
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
prebuilt: string, name of the prebuilt object
|
prebuilt: string, name of the prebuilt object
|
||||||
variant: string, VNDK snapshot variant (e.g. 'arm64')
|
arch: string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
is_etc: bool, True if the LOCAL_MODULE_CLASS of prebuilt is 'ETC'
|
is_etc: bool, True if the LOCAL_MODULE_CLASS of prebuilt is 'ETC'
|
||||||
|
is_binder32: bool, True if binder interface is 32-bit
|
||||||
"""
|
"""
|
||||||
name, ext = os.path.splitext(prebuilt)
|
name, ext = os.path.splitext(prebuilt)
|
||||||
if is_etc:
|
if is_etc:
|
||||||
versioned_name = '{}.{}{}'.format(name, self._vndk_version, ext)
|
versioned_name = '{}.{}{}'.format(name, self._vndk_version, ext)
|
||||||
else:
|
else:
|
||||||
versioned_name = '{}.vndk.{}.{}.vendor'.format(
|
binder_suffix = '.{}'.format(utils.BINDER32) if is_binder32 else ''
|
||||||
name, self._vndk_version, variant)
|
versioned_name = '{}.vndk.{}.{}{}.vendor'.format(
|
||||||
|
name, self._vndk_version, arch, binder_suffix)
|
||||||
|
|
||||||
return versioned_name
|
return versioned_name
|
||||||
|
|
||||||
@@ -187,23 +250,27 @@ class GenBuildFile(object):
|
|||||||
'include $(BUILD_PREBUILT)\n'.format(
|
'include $(BUILD_PREBUILT)\n'.format(
|
||||||
prebuilt=prebuilt,
|
prebuilt=prebuilt,
|
||||||
versioned_name=self._get_versioned_name(
|
versioned_name=self._get_versioned_name(
|
||||||
prebuilt, None, True),
|
prebuilt, None, is_etc=True),
|
||||||
etc_sub_path=etc_sub_path))
|
etc_sub_path=etc_sub_path))
|
||||||
|
|
||||||
def _gen_bp_phony(self, variant):
|
def _gen_bp_phony(self, arch, is_binder32=False):
|
||||||
"""Generates build rule for phony package 'vndk_v{ver}_{variant}'.
|
"""Generates build rule for phony package 'vndk_v{ver}_{arch}'.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
variant: string, VNDK snapshot variant (e.g. 'arm64')
|
arch: string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
|
is_binder32: bool, True if binder interface is 32-bit
|
||||||
"""
|
"""
|
||||||
required = []
|
required = []
|
||||||
for prebuilts in (self._vndk_core[variant], self._vndk_sp[variant]):
|
for prebuilts in (self._vndk_core[arch], self._vndk_sp[arch]):
|
||||||
for prebuilt in prebuilts:
|
for prebuilt in prebuilts:
|
||||||
required.append(
|
required.append(
|
||||||
self._get_versioned_name(prebuilt, variant, False))
|
self._get_versioned_name(
|
||||||
|
prebuilt, arch, is_binder32=is_binder32))
|
||||||
|
|
||||||
for prebuilt in self.ETC_MODULES:
|
for prebuilt in self.ETC_MODULES:
|
||||||
required.append(self._get_versioned_name(prebuilt, None, True))
|
required.append(
|
||||||
|
self._get_versioned_name(
|
||||||
|
prebuilt, None, is_etc=True, is_binder32=is_binder32))
|
||||||
|
|
||||||
required_str = ['"{}",'.format(prebuilt) for prebuilt in required]
|
required_str = ['"{}",'.format(prebuilt) for prebuilt in required]
|
||||||
required_formatted = '\n{ind}{ind}'.format(
|
required_formatted = '\n{ind}{ind}'.format(
|
||||||
@@ -213,37 +280,53 @@ class GenBuildFile(object):
|
|||||||
'{ind}],\n'.format(
|
'{ind}],\n'.format(
|
||||||
ind=self.INDENT,
|
ind=self.INDENT,
|
||||||
required_formatted=required_formatted))
|
required_formatted=required_formatted))
|
||||||
|
binder_suffix = '_{}'.format(utils.BINDER32) if is_binder32 else ''
|
||||||
|
|
||||||
return ('phony {{\n'
|
return ('phony {{\n'
|
||||||
'{ind}name: "vndk_v{ver}_{variant}",\n'
|
'{ind}name: "vndk_v{ver}_{arch}{binder_suffix}",\n'
|
||||||
'{required_buildrule}'
|
'{required_buildrule}'
|
||||||
'}}\n'.format(
|
'}}\n'.format(
|
||||||
ind=self.INDENT,
|
ind=self.INDENT,
|
||||||
ver=self._vndk_version,
|
ver=self._vndk_version,
|
||||||
variant=variant,
|
arch=arch,
|
||||||
|
binder_suffix=binder_suffix,
|
||||||
required_buildrule=required_buildrule))
|
required_buildrule=required_buildrule))
|
||||||
|
|
||||||
def _gen_vndk_shared_prebuilts(self, prebuilts, variant, is_vndk_sp):
|
def _gen_vndk_shared_prebuilts(self,
|
||||||
|
prebuilts,
|
||||||
|
arch,
|
||||||
|
is_vndk_sp=False,
|
||||||
|
is_binder32=False):
|
||||||
"""Returns list of build rules for given prebuilts.
|
"""Returns list of build rules for given prebuilts.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
prebuilts: list of VNDK shared prebuilts
|
prebuilts: list of VNDK shared prebuilts
|
||||||
variant: string, VNDK snapshot variant (e.g. 'arm64')
|
arch: string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
is_vndk_sp: bool, True if prebuilts are VNDK_SP libs
|
is_vndk_sp: bool, True if prebuilts are VNDK_SP libs
|
||||||
|
is_binder32: bool, True if binder interface is 32-bit
|
||||||
"""
|
"""
|
||||||
build_rules = []
|
build_rules = []
|
||||||
for prebuilt in prebuilts:
|
for prebuilt in prebuilts:
|
||||||
build_rules.append(
|
build_rules.append(
|
||||||
self._gen_vndk_shared_prebuilt(prebuilt, variant, is_vndk_sp))
|
self._gen_vndk_shared_prebuilt(
|
||||||
|
prebuilt,
|
||||||
|
arch,
|
||||||
|
is_vndk_sp=is_vndk_sp,
|
||||||
|
is_binder32=is_binder32))
|
||||||
return build_rules
|
return build_rules
|
||||||
|
|
||||||
def _gen_vndk_shared_prebuilt(self, prebuilt, variant, is_vndk_sp):
|
def _gen_vndk_shared_prebuilt(self,
|
||||||
|
prebuilt,
|
||||||
|
arch,
|
||||||
|
is_vndk_sp=False,
|
||||||
|
is_binder32=False):
|
||||||
"""Returns build rule for given prebuilt.
|
"""Returns build rule for given prebuilt.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
prebuilt: string, name of prebuilt object
|
prebuilt: string, name of prebuilt object
|
||||||
variant: string, VNDK snapshot variant (e.g. 'arm64')
|
arch: string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
is_vndk_sp: bool, True if prebuilt is a VNDK_SP lib
|
is_vndk_sp: bool, True if prebuilt is a VNDK_SP lib
|
||||||
|
is_binder32: bool, True if binder interface is 32-bit
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_notice_file(prebuilt):
|
def get_notice_file(prebuilt):
|
||||||
@@ -254,14 +337,16 @@ class GenBuildFile(object):
|
|||||||
"""
|
"""
|
||||||
notice = ''
|
notice = ''
|
||||||
notice_file_name = '{}.txt'.format(prebuilt)
|
notice_file_name = '{}.txt'.format(prebuilt)
|
||||||
notices_dir = os.path.join(self._install_dir,
|
notice_dir = os.path.join(self._install_dir,
|
||||||
utils.NOTICE_FILES_DIR_PATH)
|
utils.NOTICE_FILES_DIR_PATH)
|
||||||
notice_files = utils.find(notices_dir, [notice_file_name])
|
notice_files = utils.find(notice_dir, [notice_file_name])
|
||||||
if len(notice_files) > 0:
|
if len(notice_files) > 0:
|
||||||
|
notice_dir_relpath = os.path.relpath(
|
||||||
|
os.path.join(notice_dir), src_root)
|
||||||
notice = '{ind}notice: "{notice_file_path}",\n'.format(
|
notice = '{ind}notice: "{notice_file_path}",\n'.format(
|
||||||
ind=self.INDENT,
|
ind=self.INDENT,
|
||||||
notice_file_path=os.path.join(
|
notice_file_path=os.path.join(notice_dir_relpath,
|
||||||
'..', utils.NOTICE_FILES_DIR_PATH, notice_files[0]))
|
notice_files[0]))
|
||||||
return notice
|
return notice
|
||||||
|
|
||||||
def get_rel_install_path(prebuilt):
|
def get_rel_install_path(prebuilt):
|
||||||
@@ -277,7 +362,7 @@ class GenBuildFile(object):
|
|||||||
.format(ind=self.INDENT, path=path))
|
.format(ind=self.INDENT, path=path))
|
||||||
return rel_install_path
|
return rel_install_path
|
||||||
|
|
||||||
def get_arch_srcs(prebuilt, variant):
|
def get_arch_srcs(prebuilt, arch):
|
||||||
"""Returns build rule for arch specific srcs.
|
"""Returns build rule for arch specific srcs.
|
||||||
|
|
||||||
e.g.,
|
e.g.,
|
||||||
@@ -292,38 +377,53 @@ class GenBuildFile(object):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
prebuilt: string, name of prebuilt object
|
prebuilt: string, name of prebuilt object
|
||||||
variant: string, VNDK snapshot variant (e.g. 'arm64')
|
arch: string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
"""
|
"""
|
||||||
arch_srcs = '{ind}arch: {{\n'.format(ind=self.INDENT)
|
arch_srcs = '{ind}arch: {{\n'.format(ind=self.INDENT)
|
||||||
variant_path = os.path.join(self._install_dir, variant)
|
src_paths = utils.find(src_root, [prebuilt])
|
||||||
src_paths = utils.find(variant_path, [prebuilt])
|
# filter out paths under 'binder32' subdirectory
|
||||||
|
src_paths = filter(lambda src: not src.startswith(utils.BINDER32),
|
||||||
|
src_paths)
|
||||||
|
|
||||||
for src in sorted(src_paths):
|
for src in sorted(src_paths):
|
||||||
arch_srcs += ('{ind}{ind}{arch}: {{\n'
|
arch_srcs += ('{ind}{ind}{arch}: {{\n'
|
||||||
'{ind}{ind}{ind}srcs: ["{src}"],\n'
|
'{ind}{ind}{ind}srcs: ["{src}"],\n'
|
||||||
'{ind}{ind}}},\n'.format(
|
'{ind}{ind}}},\n'.format(
|
||||||
ind=self.INDENT,
|
ind=self.INDENT,
|
||||||
arch=utils.arch_from_path(
|
arch=utils.prebuilt_arch_from_path(
|
||||||
os.path.join(variant, src)),
|
os.path.join(arch, src)),
|
||||||
src=src))
|
src=src))
|
||||||
arch_srcs += '{ind}}},\n'.format(ind=self.INDENT)
|
arch_srcs += '{ind}}},\n'.format(ind=self.INDENT)
|
||||||
return arch_srcs
|
return arch_srcs
|
||||||
|
|
||||||
|
src_root = os.path.join(self._install_dir, arch)
|
||||||
|
# For O-MR1 snapshot (v27), 32-bit binder prebuilts are not
|
||||||
|
# isolated in separate 'binder32' subdirectory.
|
||||||
|
if is_binder32 and self._vndk_version >= 28:
|
||||||
|
src_root = os.path.join(src_root, utils.BINDER32)
|
||||||
|
|
||||||
name = os.path.splitext(prebuilt)[0]
|
name = os.path.splitext(prebuilt)[0]
|
||||||
vendor_available = str(
|
vendor_available = str(
|
||||||
prebuilt not in self._vndk_private[variant]).lower()
|
prebuilt not in self._vndk_private[arch]).lower()
|
||||||
|
|
||||||
|
vndk_sp = ''
|
||||||
if is_vndk_sp:
|
if is_vndk_sp:
|
||||||
vndk_sp = '{ind}{ind}support_system_process: true,\n'.format(
|
vndk_sp = '{ind}{ind}support_system_process: true,\n'.format(
|
||||||
ind=self.INDENT)
|
ind=self.INDENT)
|
||||||
else:
|
|
||||||
vndk_sp = ''
|
|
||||||
notice = get_notice_file(prebuilt)
|
notice = get_notice_file(prebuilt)
|
||||||
rel_install_path = get_rel_install_path(prebuilt)
|
rel_install_path = get_rel_install_path(prebuilt)
|
||||||
arch_srcs = get_arch_srcs(prebuilt, variant)
|
arch_srcs = get_arch_srcs(prebuilt, arch)
|
||||||
|
|
||||||
|
binder32bit = ''
|
||||||
|
if is_binder32:
|
||||||
|
binder32bit = '{ind}binder32bit: true,\n'.format(ind=self.INDENT)
|
||||||
|
|
||||||
return ('vndk_prebuilt_shared {{\n'
|
return ('vndk_prebuilt_shared {{\n'
|
||||||
'{ind}name: "{name}",\n'
|
'{ind}name: "{name}",\n'
|
||||||
'{ind}version: "{ver}",\n'
|
'{ind}version: "{ver}",\n'
|
||||||
'{ind}target_arch: "{target_arch}",\n'
|
'{ind}target_arch: "{target_arch}",\n'
|
||||||
|
'{binder32bit}'
|
||||||
'{ind}vendor_available: {vendor_available},\n'
|
'{ind}vendor_available: {vendor_available},\n'
|
||||||
'{ind}vndk: {{\n'
|
'{ind}vndk: {{\n'
|
||||||
'{ind}{ind}enabled: true,\n'
|
'{ind}{ind}enabled: true,\n'
|
||||||
@@ -336,8 +436,9 @@ class GenBuildFile(object):
|
|||||||
ind=self.INDENT,
|
ind=self.INDENT,
|
||||||
name=name,
|
name=name,
|
||||||
ver=self._vndk_version,
|
ver=self._vndk_version,
|
||||||
|
target_arch=arch,
|
||||||
|
binder32bit=binder32bit,
|
||||||
vendor_available=vendor_available,
|
vendor_available=vendor_available,
|
||||||
target_arch=variant,
|
|
||||||
vndk_sp=vndk_sp,
|
vndk_sp=vndk_sp,
|
||||||
notice=notice,
|
notice=notice,
|
||||||
rel_install_path=rel_install_path,
|
rel_install_path=rel_install_path,
|
||||||
|
|||||||
@@ -103,17 +103,16 @@ def gather_notice_files(install_dir):
|
|||||||
logging.info('Creating {} directory to gather all NOTICE files...'.format(
|
logging.info('Creating {} directory to gather all NOTICE files...'.format(
|
||||||
common_notices_dir))
|
common_notices_dir))
|
||||||
os.makedirs(common_notices_dir)
|
os.makedirs(common_notices_dir)
|
||||||
for variant in utils.get_snapshot_variants(install_dir):
|
for arch in utils.get_snapshot_archs(install_dir):
|
||||||
notices_dir_per_variant = os.path.join(variant,
|
notices_dir_per_arch = os.path.join(arch, utils.NOTICE_FILES_DIR_NAME)
|
||||||
utils.NOTICE_FILES_DIR_NAME)
|
if os.path.isdir(notices_dir_per_arch):
|
||||||
if os.path.isdir(notices_dir_per_variant):
|
|
||||||
for notice_file in glob.glob(
|
for notice_file in glob.glob(
|
||||||
'{}/*.txt'.format(notices_dir_per_variant)):
|
'{}/*.txt'.format(notices_dir_per_arch)):
|
||||||
if not os.path.isfile(
|
if not os.path.isfile(
|
||||||
os.path.join(common_notices_dir,
|
os.path.join(common_notices_dir,
|
||||||
os.path.basename(notice_file))):
|
os.path.basename(notice_file))):
|
||||||
shutil.copy(notice_file, common_notices_dir)
|
shutil.copy(notice_file, common_notices_dir)
|
||||||
shutil.rmtree(notices_dir_per_variant)
|
shutil.rmtree(notices_dir_per_arch)
|
||||||
|
|
||||||
|
|
||||||
def revise_ld_config_txt_if_needed(vndk_version):
|
def revise_ld_config_txt_if_needed(vndk_version):
|
||||||
@@ -123,10 +122,10 @@ def revise_ld_config_txt_if_needed(vndk_version):
|
|||||||
Versioned VNDK directories: /system/${LIB}/vndk[-sp]-27
|
Versioned VNDK directories: /system/${LIB}/vndk[-sp]-27
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
vndk_version: string, version of VNDK snapshot
|
vndk_version: int, version of VNDK snapshot
|
||||||
"""
|
"""
|
||||||
logging.info('Revising ld.config.txt for O-MR1...')
|
if vndk_version == 27:
|
||||||
if vndk_version == '27':
|
logging.info('Revising ld.config.txt for O-MR1...')
|
||||||
re_pattern = '(system\/\${LIB}\/vndk(?:-sp)?)([:/]|$)'
|
re_pattern = '(system\/\${LIB}\/vndk(?:-sp)?)([:/]|$)'
|
||||||
VNDK_INSTALL_DIR_RE = re.compile(re_pattern, flags=re.MULTILINE)
|
VNDK_INSTALL_DIR_RE = re.compile(re_pattern, flags=re.MULTILINE)
|
||||||
ld_config_txt_paths = glob.glob(
|
ld_config_txt_paths = glob.glob(
|
||||||
@@ -214,7 +213,7 @@ def main():
|
|||||||
'Please provide both --branch and --build or set --local '
|
'Please provide both --branch and --build or set --local '
|
||||||
'option.')
|
'option.')
|
||||||
|
|
||||||
vndk_version = str(args.vndk_version)
|
vndk_version = args.vndk_version
|
||||||
|
|
||||||
install_dir = os.path.join(PREBUILTS_VNDK_DIR, 'v{}'.format(vndk_version))
|
install_dir = os.path.join(PREBUILTS_VNDK_DIR, 'v{}'.format(vndk_version))
|
||||||
if not os.path.isdir(install_dir):
|
if not os.path.isdir(install_dir):
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ MANIFEST_FILE_NAME = 'manifest.xml'
|
|||||||
MODULE_PATHS_FILE_NAME = 'module_paths.txt'
|
MODULE_PATHS_FILE_NAME = 'module_paths.txt'
|
||||||
NOTICE_FILES_DIR_NAME = 'NOTICE_FILES'
|
NOTICE_FILES_DIR_NAME = 'NOTICE_FILES'
|
||||||
NOTICE_FILES_DIR_PATH = os.path.join(COMMON_DIR_PATH, NOTICE_FILES_DIR_NAME)
|
NOTICE_FILES_DIR_PATH = os.path.join(COMMON_DIR_PATH, NOTICE_FILES_DIR_NAME)
|
||||||
|
BINDER32 = 'binder32'
|
||||||
|
|
||||||
|
|
||||||
def set_logging_config(verbose_level):
|
def set_logging_config(verbose_level):
|
||||||
@@ -81,21 +82,21 @@ def get_dist_dir(out_dir):
|
|||||||
return _get_dir_from_env('DIST_DIR', join_realpath(out_dir, 'dist'))
|
return _get_dir_from_env('DIST_DIR', join_realpath(out_dir, 'dist'))
|
||||||
|
|
||||||
|
|
||||||
def get_snapshot_variants(install_dir):
|
def get_snapshot_archs(install_dir):
|
||||||
"""Returns a list of VNDK snapshot variants under install_dir.
|
"""Returns a list of VNDK snapshot arch flavors under install_dir.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
install_dir: string, absolute path of prebuilts/vndk/v{version}
|
install_dir: string, absolute path of prebuilts/vndk/v{version}
|
||||||
"""
|
"""
|
||||||
variants = []
|
archs = []
|
||||||
for file in glob.glob('{}/*'.format(install_dir)):
|
for file in glob.glob('{}/*'.format(install_dir)):
|
||||||
basename = os.path.basename(file)
|
basename = os.path.basename(file)
|
||||||
if os.path.isdir(file) and basename != COMMON_DIR_NAME:
|
if os.path.isdir(file) and basename != COMMON_DIR_NAME:
|
||||||
variants.append(basename)
|
archs.append(basename)
|
||||||
return variants
|
return archs
|
||||||
|
|
||||||
|
|
||||||
def arch_from_path(path):
|
def prebuilt_arch_from_path(path):
|
||||||
"""Extracts arch of prebuilts from path relative to install_dir.
|
"""Extracts arch of prebuilts from path relative to install_dir.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -107,14 +108,14 @@ def arch_from_path(path):
|
|||||||
return path.split('/')[1].split('-')[1]
|
return path.split('/')[1].split('-')[1]
|
||||||
|
|
||||||
|
|
||||||
def variant_from_path(path):
|
def snapshot_arch_from_path(path):
|
||||||
"""Extracts VNDK snapshot variant from path relative to install_dir.
|
"""Extracts VNDK snapshot arch from path relative to install_dir.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
path: string, path relative to prebuilts/vndk/v{version}
|
path: string, path relative to prebuilts/vndk/v{version}
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
string, VNDK snapshot variant (e.g. 'arm64')
|
string, VNDK snapshot arch (e.g. 'arm64')
|
||||||
"""
|
"""
|
||||||
return path.split('/')[0]
|
return path.split('/')[0]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user