From deb5beb698b08ebc0a6867600e5f28d5c11dd802 Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Fri, 24 Sep 2021 13:17:06 +0900 Subject: [PATCH] Rename soong outdir to generated-headers vndk snapshot captures exported headers as-is, but soong intermediates directory name is used as a result. It may confuse users, so this changes the intermediates directory name to "generated-headers". Bug: 200159267 Test: install snapshot and build Change-Id: I3da7ee98f53e460c448c05ad3456022888099888 Merged-In: I3da7ee98f53e460c448c05ad3456022888099888 (cherry picked from commit 6547080f727fcf7194d2b0fac516c1d9ca4315e7) --- vndk/snapshot/gen_buildfiles.py | 10 ++++++++-- vndk/snapshot/update.py | 7 +++++++ vndk/snapshot/utils.py | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/vndk/snapshot/gen_buildfiles.py b/vndk/snapshot/gen_buildfiles.py index 336a9f988..56fe5959f 100644 --- a/vndk/snapshot/gen_buildfiles.py +++ b/vndk/snapshot/gen_buildfiles.py @@ -525,6 +525,10 @@ class GenBuildFile(object): dirs=dirs, name=name)) + def rename_generated_dirs(dirs): + # Reame out/soong/.intermedaites to generated-headers for better readability. + return [d.replace(utils.SOONG_INTERMEDIATES_DIR, utils.GENERATED_HEADERS_DIR, 1) for d in dirs] + for src in sorted(src_paths): include_dirs = '' system_include_dirs = '' @@ -541,10 +545,12 @@ class GenBuildFile(object): if prebuilt == 'android.hidl.memory@1.0-impl.so': props['RelativeInstallPath'] = 'hw' if 'ExportedDirs' in props: - l = ['include/%s' % d for d in props['ExportedDirs']] + dirs = rename_generated_dirs(props['ExportedDirs']) + l = ['include/%s' % d for d in dirs] include_dirs = list_to_prop_value(l, 'export_include_dirs') if 'ExportedSystemDirs' in props: - l = ['include/%s' % d for d in props['ExportedSystemDirs']] + dirs = rename_generated_dirs(props['ExportedSystemDirs']) + l = ['include/%s' % d for d in dirs] system_include_dirs = list_to_prop_value(l, 'export_system_include_dirs') if 'ExportedFlags' in props: flags = list_to_prop_value(props['ExportedFlags'], 'export_flags') diff --git a/vndk/snapshot/update.py b/vndk/snapshot/update.py index a4e625775..cb973ea51 100644 --- a/vndk/snapshot/update.py +++ b/vndk/snapshot/update.py @@ -95,6 +95,13 @@ def install_snapshot(branch, build, local_dir, install_dir, temp_artifact_dir): logging.info('Unzipping VNDK snapshot: {}'.format(artifact)) utils.check_call(['unzip', '-qn', artifact, '-d', install_dir]) + # rename {install_dir}/{arch}/include/out/soong/.intermediates + for soong_intermediates_dir in glob.glob(install_dir + '/*/include/' + utils.SOONG_INTERMEDIATES_DIR): + generated_headers_dir = soong_intermediates_dir.replace( + utils.SOONG_INTERMEDIATES_DIR, + utils.GENERATED_HEADERS_DIR + ) + os.rename(soong_intermediates_dir, generated_headers_dir) def gather_notice_files(install_dir): """Gathers all NOTICE files to a common NOTICE_FILES directory.""" diff --git a/vndk/snapshot/utils.py b/vndk/snapshot/utils.py index 7d3a94a37..a4e54c4da 100644 --- a/vndk/snapshot/utils.py +++ b/vndk/snapshot/utils.py @@ -37,7 +37,8 @@ NOTICE_FILES_DIR_NAME = 'NOTICE_FILES' NOTICE_FILES_DIR_PATH = os.path.join(COMMON_DIR_PATH, NOTICE_FILES_DIR_NAME) BINDER32 = 'binder32' MINIMUM_VNDK_VERSION = 28 - +SOONG_INTERMEDIATES_DIR = 'out/soong/.intermediates' +GENERATED_HEADERS_DIR = 'generated-headers' def set_logging_config(verbose_level): verbose_map = (logging.WARNING, logging.INFO, logging.DEBUG)