Merge "Add PLATFORM_VNDK_VERSION to the pattern of VNDK ABI dump paths"

This commit is contained in:
Hsin-Yi Chen
2019-10-17 05:26:41 +00:00
committed by Gerrit Code Review
2 changed files with 28 additions and 22 deletions

View File

@@ -30,10 +30,10 @@ def choose_vndk_version(version, platform_vndk_version, board_vndk_version):
return version
def make_libs_for_product(libs, product, variant, targets):
def make_libs_for_product(libs, product, variant, vndk_version, targets):
print('making libs for', product + '-' + variant)
if libs:
make_libraries(product, variant, targets, libs)
make_libraries(product, variant, vndk_version, targets, libs)
else:
make_tree(product, variant)
@@ -123,21 +123,24 @@ def create_source_abi_reference_dumps(args, chosen_vndk_version,
def create_source_abi_reference_dumps_for_all_products(args):
"""Create reference ABI dumps for all specified products."""
platform_vndk_version, board_vndk_version = get_build_vars_for_product(
['PLATFORM_VNDK_VERSION', 'BOARD_VNDK_VERSION'])
chosen_vndk_version = choose_vndk_version(
args.version, platform_vndk_version, board_vndk_version)
num_processed = 0
for product in args.products:
targets = [Target(True, product), Target(False, product)]
build_vars = get_build_vars_for_product(
['PLATFORM_VNDK_VERSION', 'BOARD_VNDK_VERSION', 'BINDER32BIT'],
product, args.build_variant)
if get_build_vars_for_product(['BINDER32BIT'], product)[0] == 'true':
platform_vndk_version = build_vars[0]
board_vndk_version = build_vars[1]
if build_vars[2] == 'true':
binder_bitness = '32'
else:
binder_bitness = '64'
chosen_vndk_version = choose_vndk_version(
args.version, platform_vndk_version, board_vndk_version)
targets = [Target(True, product), Target(False, product)]
# 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
# libraries successfully.
@@ -146,12 +149,13 @@ def create_source_abi_reference_dumps_for_all_products(args):
args.libs)
if not args.no_make_lib:
# Build all the specified libs (or build the 'vndk' target if none
# of them are specified.)
make_libs_for_product(args.libs, product,
args.build_variant, targets)
# Build all the specified libs, or build `findlsdumps` if no libs
# are specified.
make_libs_for_product(args.libs, product, args.build_variant,
platform_vndk_version, targets)
lsdump_paths = read_lsdump_paths(product, args.build_variant, targets,
lsdump_paths = read_lsdump_paths(product, args.build_variant,
platform_vndk_version, targets,
build=False)
num_processed += create_source_abi_reference_dumps(

View File

@@ -176,9 +176,10 @@ def make_tree(product, variant):
return make_targets(product, variant, ['findlsdumps'])
def make_libraries(product, variant, targets, libs):
def make_libraries(product, variant, vndk_version, targets, libs):
"""Build lsdump files for specific libs."""
lsdump_paths = read_lsdump_paths(product, variant, targets, build=True)
lsdump_paths = read_lsdump_paths(product, variant, vndk_version, targets,
build=True)
make_target_paths = []
for name in libs:
make_target_paths.extend(path for tag, path in
@@ -198,16 +199,16 @@ def _is_sanitizer_variation(variation):
return variation in {'asan', 'hwasan', 'tsan', 'intOverflow', 'cfi', 'scs'}
def _tag_to_variant_suffix(tag):
def _tag_to_variant_suffix(tag, vndk_version):
"""Map a tag to a variant suffix."""
if tag in ('LLNDK', 'NDK', 'PLATFORM'):
return '_core_shared'
if tag.startswith('VNDK'):
return '_vendor_shared'
return '_vendor.' + vndk_version + '_shared'
raise ValueError(tag + ' is not a known tag.')
def _read_lsdump_paths(lsdump_paths_file_path, targets):
def _read_lsdump_paths(lsdump_paths_file_path, vndk_version, targets):
"""Read lsdump paths from lsdump_paths.txt for each libname and variant.
This function returns a dictionary, {lib_name: {arch_cpu: (tag, path)}}.
@@ -227,7 +228,7 @@ def _read_lsdump_paths(lsdump_paths_file_path, targets):
with open(lsdump_paths_file_path, 'r') as lsdump_paths_file:
for line in lsdump_paths_file:
tag, path = (x.strip() for x in line.split(':', 1))
variant_suffix = _tag_to_variant_suffix(tag)
variant_suffix = _tag_to_variant_suffix(tag, vndk_version)
if not path:
continue
dirname, filename = os.path.split(path)
@@ -257,13 +258,14 @@ def _read_lsdump_paths(lsdump_paths_file_path, targets):
return lsdump_paths
def read_lsdump_paths(product, variant, targets, build=True):
def read_lsdump_paths(product, variant, vndk_version, targets, build=True):
"""Build lsdump_paths.txt and read the paths."""
lsdump_paths_file_path = get_lsdump_paths_file_path(product, variant)
if build:
make_targets(product, variant, [lsdump_paths_file_path])
lsdump_paths_file_abspath = os.path.join(AOSP_DIR, lsdump_paths_file_path)
return _read_lsdump_paths(lsdump_paths_file_abspath, targets)
return _read_lsdump_paths(lsdump_paths_file_abspath, vndk_version,
targets)
def find_lib_lsdumps(lsdump_paths, libs, target):