Merge changes If1ccc3d9,I198bf3e1,I0d903c16 am: a12115812c am: 00e22d110d
Original change: https://android-review.googlesource.com/c/platform/development/+/2152453 Change-Id: I9bb847ae5ccd95c14cd92f24eac7b130805abe77 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -20,6 +20,22 @@ PREBUILTS_ABI_DUMPS_DEFAULT = os.path.join(AOSP_DIR, 'prebuilts', 'abi-dumps')
|
|||||||
SOONG_DIR = os.path.join(AOSP_DIR, 'out', 'soong', '.intermediates')
|
SOONG_DIR = os.path.join(AOSP_DIR, 'out', 'soong', '.intermediates')
|
||||||
|
|
||||||
|
|
||||||
|
class GetRefDumpDirStem:
|
||||||
|
def __init__(self, ref_dump_dir, chosen_vndk_version,
|
||||||
|
chosen_platform_version, binder_bitness):
|
||||||
|
self.ref_dump_dir = ref_dump_dir
|
||||||
|
self.chosen_vndk_version = chosen_vndk_version
|
||||||
|
self.chosen_platform_version = chosen_platform_version
|
||||||
|
self.binder_bitness = binder_bitness
|
||||||
|
|
||||||
|
def __call__(self, category, arch):
|
||||||
|
version_stem = (self.chosen_vndk_version
|
||||||
|
if category == 'vndk'
|
||||||
|
else self.chosen_platform_version)
|
||||||
|
return os.path.join(self.ref_dump_dir, category, version_stem,
|
||||||
|
self.binder_bitness, arch)
|
||||||
|
|
||||||
|
|
||||||
def choose_vndk_version(version, platform_vndk_version, board_vndk_version):
|
def choose_vndk_version(version, platform_vndk_version, board_vndk_version):
|
||||||
if version is None:
|
if version is None:
|
||||||
# This logic must be in sync with the logic for reference ABI dumps
|
# This logic must be in sync with the logic for reference ABI dumps
|
||||||
@@ -38,12 +54,6 @@ def make_libs_for_product(libs, product, variant, vndk_version, targets):
|
|||||||
make_tree(product, variant)
|
make_tree(product, variant)
|
||||||
|
|
||||||
|
|
||||||
def get_ref_dump_dir_stem(ref_dump_dir, category, chosen_vndk_version,
|
|
||||||
binder_bitness, arch):
|
|
||||||
return os.path.join(ref_dump_dir, category, chosen_vndk_version,
|
|
||||||
binder_bitness, arch)
|
|
||||||
|
|
||||||
|
|
||||||
def find_and_remove_path(root_path, file_name=None):
|
def find_and_remove_path(root_path, file_name=None):
|
||||||
if file_name is not None:
|
if file_name is not None:
|
||||||
root_path = os.path.join(root_path, 'source-based', file_name)
|
root_path = os.path.join(root_path, 'source-based', file_name)
|
||||||
@@ -56,13 +66,11 @@ def find_and_remove_path(root_path, file_name=None):
|
|||||||
shutil.rmtree(root_path)
|
shutil.rmtree(root_path)
|
||||||
|
|
||||||
|
|
||||||
def remove_references_for_all_arches(ref_dump_dir, chosen_vndk_version,
|
def remove_references_for_all_arches(get_ref_dump_dir_stem, targets, libs):
|
||||||
binder_bitness, targets, libs):
|
|
||||||
for target in targets:
|
for target in targets:
|
||||||
for category in ('ndk', 'platform', 'vndk'):
|
for category in ('ndk', 'platform', 'vndk'):
|
||||||
dir_to_remove = get_ref_dump_dir_stem(
|
dir_to_remove = get_ref_dump_dir_stem(category,
|
||||||
ref_dump_dir, category, chosen_vndk_version, binder_bitness,
|
target.get_arch_str())
|
||||||
target.get_arch_str())
|
|
||||||
if libs:
|
if libs:
|
||||||
for lib in libs:
|
for lib in libs:
|
||||||
find_and_remove_path(dir_to_remove,
|
find_and_remove_path(dir_to_remove,
|
||||||
@@ -76,31 +84,29 @@ def remove_references_for_all_arches(ref_dump_dir, chosen_vndk_version,
|
|||||||
def tag_to_dir_name(tag):
|
def tag_to_dir_name(tag):
|
||||||
if tag == 'NDK':
|
if tag == 'NDK':
|
||||||
return 'ndk'
|
return 'ndk'
|
||||||
if tag == 'PLATFORM':
|
if tag in ('PLATFORM', 'LLNDK'):
|
||||||
return 'platform'
|
return 'platform'
|
||||||
if tag.startswith('VNDK') or tag == 'LLNDK':
|
if tag.startswith('VNDK'):
|
||||||
return 'vndk'
|
return 'vndk'
|
||||||
raise ValueError(tag + 'is not a known tag.')
|
raise ValueError(tag + 'is not a known tag.')
|
||||||
|
|
||||||
|
|
||||||
def find_and_copy_lib_lsdumps(ref_dump_dir, chosen_vndk_version,
|
def find_and_copy_lib_lsdumps(get_ref_dump_dir_stem, target, libs,
|
||||||
binder_bitness, target, libs, lsdump_paths,
|
lsdump_paths, compress):
|
||||||
compress):
|
|
||||||
arch_lsdump_paths = find_lib_lsdumps(lsdump_paths, libs, target)
|
arch_lsdump_paths = find_lib_lsdumps(lsdump_paths, libs, target)
|
||||||
|
|
||||||
num_created = 0
|
num_created = 0
|
||||||
for tag, path in arch_lsdump_paths:
|
for tag, path in arch_lsdump_paths:
|
||||||
ref_dump_dir_stem = get_ref_dump_dir_stem(
|
ref_dump_dir_stem = get_ref_dump_dir_stem(tag_to_dir_name(tag),
|
||||||
ref_dump_dir, tag_to_dir_name(tag), chosen_vndk_version,
|
target.get_arch_str())
|
||||||
binder_bitness, target.get_arch_str())
|
|
||||||
copy_reference_dump(
|
copy_reference_dump(
|
||||||
path, os.path.join(ref_dump_dir_stem, 'source-based'), compress)
|
path, os.path.join(ref_dump_dir_stem, 'source-based'), compress)
|
||||||
num_created += 1
|
num_created += 1
|
||||||
return num_created
|
return num_created
|
||||||
|
|
||||||
|
|
||||||
def create_source_abi_reference_dumps(args, chosen_vndk_version,
|
def create_source_abi_reference_dumps(args, get_ref_dump_dir_stem,
|
||||||
binder_bitness, lsdump_paths, targets):
|
lsdump_paths, targets):
|
||||||
num_libs_copied = 0
|
num_libs_copied = 0
|
||||||
for target in targets:
|
for target in targets:
|
||||||
assert target.primary_arch != ''
|
assert target.primary_arch != ''
|
||||||
@@ -108,8 +114,8 @@ def create_source_abi_reference_dumps(args, chosen_vndk_version,
|
|||||||
f'primary arch: {target.primary_arch}')
|
f'primary arch: {target.primary_arch}')
|
||||||
|
|
||||||
num_libs_copied += find_and_copy_lib_lsdumps(
|
num_libs_copied += find_and_copy_lib_lsdumps(
|
||||||
args.ref_dump_dir, chosen_vndk_version, binder_bitness, target,
|
get_ref_dump_dir_stem, target, args.libs, lsdump_paths,
|
||||||
args.libs, lsdump_paths, args.compress)
|
args.compress)
|
||||||
return num_libs_copied
|
return num_libs_copied
|
||||||
|
|
||||||
|
|
||||||
@@ -120,11 +126,14 @@ def create_source_abi_reference_dumps_for_all_products(args):
|
|||||||
|
|
||||||
for product in args.products:
|
for product in args.products:
|
||||||
build_vars = get_build_vars_for_product(
|
build_vars = get_build_vars_for_product(
|
||||||
['PLATFORM_VNDK_VERSION', 'BOARD_VNDK_VERSION', 'BINDER32BIT'],
|
['PLATFORM_VNDK_VERSION', 'BOARD_VNDK_VERSION', 'BINDER32BIT',
|
||||||
|
'PLATFORM_VERSION_CODENAME', 'PLATFORM_SDK_VERSION'],
|
||||||
product, args.build_variant)
|
product, args.build_variant)
|
||||||
|
|
||||||
platform_vndk_version = build_vars[0]
|
platform_vndk_version = build_vars[0]
|
||||||
board_vndk_version = build_vars[1]
|
board_vndk_version = build_vars[1]
|
||||||
|
platform_version_codename = build_vars[3]
|
||||||
|
platform_sdk_version = build_vars[4]
|
||||||
if build_vars[2] == 'true':
|
if build_vars[2] == 'true':
|
||||||
binder_bitness = '32'
|
binder_bitness = '32'
|
||||||
else:
|
else:
|
||||||
@@ -132,15 +141,24 @@ def create_source_abi_reference_dumps_for_all_products(args):
|
|||||||
|
|
||||||
chosen_vndk_version = choose_vndk_version(
|
chosen_vndk_version = choose_vndk_version(
|
||||||
args.version, platform_vndk_version, board_vndk_version)
|
args.version, platform_vndk_version, board_vndk_version)
|
||||||
|
# chosen_vndk_version is expected to be the finalized
|
||||||
|
# PLATFORM_SDK_VERSION if the codename is REL.
|
||||||
|
chosen_platform_version = (platform_sdk_version
|
||||||
|
if platform_version_codename == 'REL'
|
||||||
|
else 'current')
|
||||||
|
|
||||||
|
get_ref_dump_dir_stem = GetRefDumpDirStem(args.ref_dump_dir,
|
||||||
|
chosen_vndk_version,
|
||||||
|
chosen_platform_version,
|
||||||
|
binder_bitness)
|
||||||
|
|
||||||
targets = [t for t in (Target(True, product), Target(False, product))
|
targets = [t for t in (Target(True, product), Target(False, product))
|
||||||
if t.arch]
|
if t.arch]
|
||||||
# Remove reference ABI dumps specified in `args.libs` (or remove all of
|
# Remove reference ABI dumps specified in `args.libs` (or remove all of
|
||||||
# them if none of them are specified) so that we may build these
|
# them if none of them are specified) so that we may build these
|
||||||
# libraries successfully.
|
# libraries successfully.
|
||||||
remove_references_for_all_arches(
|
remove_references_for_all_arches(get_ref_dump_dir_stem, targets,
|
||||||
args.ref_dump_dir, chosen_vndk_version, binder_bitness, targets,
|
args.libs)
|
||||||
args.libs)
|
|
||||||
|
|
||||||
if not args.no_make_lib:
|
if not args.no_make_lib:
|
||||||
# Build all the specified libs, or build `findlsdumps` if no libs
|
# Build all the specified libs, or build `findlsdumps` if no libs
|
||||||
@@ -153,7 +171,7 @@ def create_source_abi_reference_dumps_for_all_products(args):
|
|||||||
build=False)
|
build=False)
|
||||||
|
|
||||||
num_processed += create_source_abi_reference_dumps(
|
num_processed += create_source_abi_reference_dumps(
|
||||||
args, chosen_vndk_version, binder_bitness, lsdump_paths, targets)
|
args, get_ref_dump_dir_stem, lsdump_paths, targets)
|
||||||
|
|
||||||
return num_processed
|
return num_processed
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user