Merge "Use Soong to build to etc modules."
This commit is contained in:
@@ -25,9 +25,10 @@ import utils
|
|||||||
|
|
||||||
|
|
||||||
class GenBuildFile(object):
|
class GenBuildFile(object):
|
||||||
"""Generates Android.mk and Android.bp for VNDK snapshot.
|
"""Generates Android.bp for VNDK snapshot.
|
||||||
|
|
||||||
VNDK snapshot directory structure under prebuilts/vndk/v{version}:
|
VNDK snapshot directory structure under prebuilts/vndk/v{version}:
|
||||||
|
Android.bp
|
||||||
{SNAPSHOT_ARCH}/
|
{SNAPSHOT_ARCH}/
|
||||||
Android.bp
|
Android.bp
|
||||||
arch-{TARGET_ARCH}-{TARGET_ARCH_VARIANT}/
|
arch-{TARGET_ARCH}-{TARGET_ARCH_VARIANT}/
|
||||||
@@ -52,7 +53,6 @@ class GenBuildFile(object):
|
|||||||
(various *.txt configuration files, e.g. ld.config.*.txt)
|
(various *.txt configuration files, e.g. ld.config.*.txt)
|
||||||
... (other {SNAPSHOT_ARCH}/ directories)
|
... (other {SNAPSHOT_ARCH}/ directories)
|
||||||
common/
|
common/
|
||||||
Android.mk
|
|
||||||
Android.bp
|
Android.bp
|
||||||
NOTICE_FILES/
|
NOTICE_FILES/
|
||||||
(license files, e.g. libfoo.so.txt)
|
(license files, e.g. libfoo.so.txt)
|
||||||
@@ -77,7 +77,7 @@ class GenBuildFile(object):
|
|||||||
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_archs = utils.get_snapshot_archs(install_dir)
|
self._snapshot_archs = utils.get_snapshot_archs(install_dir)
|
||||||
self._mkfile = os.path.join(install_dir, utils.ANDROID_MK_PATH)
|
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._common_bpfile = os.path.join(install_dir, utils.COMMON_BP_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(
|
||||||
@@ -122,10 +122,10 @@ class GenBuildFile(object):
|
|||||||
'*.txt'))
|
'*.txt'))
|
||||||
return [os.path.splitext(os.path.basename(p))[0] for p in notice_paths]
|
return [os.path.splitext(os.path.basename(p))[0] for p in notice_paths]
|
||||||
|
|
||||||
def generate_android_mk(self):
|
def generate_root_android_bp(self):
|
||||||
"""Autogenerates Android.mk."""
|
"""Autogenerates Android.bp."""
|
||||||
|
|
||||||
logging.info('Generating Android.mk for snapshot v{}'.format(
|
logging.info('Generating Android.bp for snapshot v{}'.format(
|
||||||
self._vndk_version))
|
self._vndk_version))
|
||||||
etc_buildrules = []
|
etc_buildrules = []
|
||||||
for prebuilt in self.ETC_MODULES:
|
for prebuilt in self.ETC_MODULES:
|
||||||
@@ -137,15 +137,13 @@ class GenBuildFile(object):
|
|||||||
continue
|
continue
|
||||||
etc_buildrules.append(self._gen_etc_prebuilt(prebuilt))
|
etc_buildrules.append(self._gen_etc_prebuilt(prebuilt))
|
||||||
|
|
||||||
with open(self._mkfile, 'w') as mkfile:
|
with open(self._root_bpfile, 'w') as bpfile:
|
||||||
mkfile.write(self._gen_autogen_msg('#'))
|
bpfile.write(self._gen_autogen_msg('/'))
|
||||||
mkfile.write('\n')
|
bpfile.write('\n')
|
||||||
mkfile.write('LOCAL_PATH := $(call my-dir)\n')
|
bpfile.write('\n'.join(etc_buildrules))
|
||||||
mkfile.write('\n')
|
bpfile.write('\n')
|
||||||
mkfile.write('\n\n'.join(etc_buildrules))
|
|
||||||
mkfile.write('\n')
|
|
||||||
|
|
||||||
logging.info('Successfully generated {}'.format(self._mkfile))
|
logging.info('Successfully generated {}'.format(self._root_bpfile))
|
||||||
|
|
||||||
def generate_common_android_bp(self):
|
def generate_common_android_bp(self):
|
||||||
"""Autogenerates common/Android.bp."""
|
"""Autogenerates common/Android.bp."""
|
||||||
@@ -266,19 +264,22 @@ class GenBuildFile(object):
|
|||||||
etc_path = self._etc_paths[prebuilt]
|
etc_path = self._etc_paths[prebuilt]
|
||||||
etc_sub_path = etc_path[etc_path.index('/') + 1:]
|
etc_sub_path = etc_path[etc_path.index('/') + 1:]
|
||||||
|
|
||||||
return ('#######################################\n'
|
prebuilt_etc = ('prebuilt_etc {{\n'
|
||||||
'# {prebuilt}\n'
|
'{ind}name: "{versioned_name}",\n'
|
||||||
'include $(CLEAR_VARS)\n'
|
'{ind}target: {{\n'.format(
|
||||||
'LOCAL_MODULE := {versioned_name}\n'
|
ind=self.INDENT,
|
||||||
'LOCAL_SRC_FILES := ../$(TARGET_ARCH)/{etc_sub_path}\n'
|
versioned_name=self._get_versioned_name(
|
||||||
'LOCAL_MODULE_CLASS := ETC\n'
|
prebuilt, None, is_etc=True)))
|
||||||
'LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)\n'
|
for arch in self._snapshot_archs:
|
||||||
'LOCAL_MODULE_STEM := $(LOCAL_MODULE)\n'
|
prebuilt_etc += ('{ind}{ind}android_{arch}: {{\n'
|
||||||
'include $(BUILD_PREBUILT)\n'.format(
|
'{ind}{ind}{ind}src: "{arch}/{etc_sub_path}",\n'
|
||||||
prebuilt=prebuilt,
|
'{ind}{ind}}},\n'.format(
|
||||||
versioned_name=self._get_versioned_name(
|
ind=self.INDENT,
|
||||||
prebuilt, None, is_etc=True),
|
arch=arch,
|
||||||
etc_sub_path=etc_sub_path))
|
etc_sub_path=etc_sub_path))
|
||||||
|
prebuilt_etc += ('{ind}}},\n'
|
||||||
|
'}}\n'.format(ind=self.INDENT))
|
||||||
|
return prebuilt_etc
|
||||||
|
|
||||||
def _gen_notice_filegroup(self, module):
|
def _gen_notice_filegroup(self, module):
|
||||||
"""Generates a notice filegroup build rule for a given module.
|
"""Generates a notice filegroup build rule for a given module.
|
||||||
@@ -524,7 +525,7 @@ def main():
|
|||||||
utils.set_logging_config(args.verbose)
|
utils.set_logging_config(args.verbose)
|
||||||
|
|
||||||
buildfile_generator = GenBuildFile(install_dir, vndk_version)
|
buildfile_generator = GenBuildFile(install_dir, vndk_version)
|
||||||
buildfile_generator.generate_android_mk()
|
buildfile_generator.generate_root_android_bp()
|
||||||
buildfile_generator.generate_common_android_bp()
|
buildfile_generator.generate_common_android_bp()
|
||||||
buildfile_generator.generate_android_bp()
|
buildfile_generator.generate_android_bp()
|
||||||
|
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ def revise_ld_config_txt_if_needed(vndk_version):
|
|||||||
|
|
||||||
|
|
||||||
def update_buildfiles(buildfile_generator):
|
def update_buildfiles(buildfile_generator):
|
||||||
logging.info('Generating Android.mk file...')
|
logging.info('Generating root Android.bp file...')
|
||||||
buildfile_generator.generate_android_mk()
|
buildfile_generator.generate_root_android_bp()
|
||||||
|
|
||||||
logging.info('Generating common/Android.bp file...')
|
logging.info('Generating common/Android.bp file...')
|
||||||
buildfile_generator.generate_common_android_bp()
|
buildfile_generator.generate_common_android_bp()
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ import sys
|
|||||||
|
|
||||||
# Global Keys
|
# Global Keys
|
||||||
# All paths are relative to install_dir: prebuilts/vndk/v{version}
|
# All paths are relative to install_dir: prebuilts/vndk/v{version}
|
||||||
|
ROOT_BP_PATH = 'Android.bp'
|
||||||
COMMON_DIR_NAME = 'common'
|
COMMON_DIR_NAME = 'common'
|
||||||
COMMON_DIR_PATH = COMMON_DIR_NAME
|
COMMON_DIR_PATH = COMMON_DIR_NAME
|
||||||
ANDROID_MK_PATH = os.path.join(COMMON_DIR_PATH, 'Android.mk')
|
|
||||||
COMMON_BP_PATH = os.path.join(COMMON_DIR_PATH, 'Android.bp')
|
COMMON_BP_PATH = os.path.join(COMMON_DIR_PATH, 'Android.bp')
|
||||||
CONFIG_DIR_PATH_PATTERN = '*/configs'
|
CONFIG_DIR_PATH_PATTERN = '*/configs'
|
||||||
MANIFEST_FILE_NAME = 'manifest.xml'
|
MANIFEST_FILE_NAME = 'manifest.xml'
|
||||||
|
|||||||
Reference in New Issue
Block a user