1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/android: Fix aapt discovery with unexpected structure

If there is an additional file or directory in the `build_tools` directory
then WA can fail to find a working version of aapt(2), ensure that at least
one of the binaries is a valid file path.
This commit is contained in:
Marc Bonnici 2021-01-05 11:56:19 +00:00 committed by setrofim
parent b32f15bbdb
commit c0a5765da5

View File

@ -734,11 +734,13 @@ def _discover_aapt(env):
aapt2_path = '' aapt2_path = ''
versions = os.listdir(env.build_tools) versions = os.listdir(env.build_tools)
for version in reversed(sorted(versions)): for version in reversed(sorted(versions)):
if not aapt2_path and not os.path.isfile(aapt2_path): if not os.path.isfile(aapt2_path):
aapt2_path = os.path.join(env.build_tools, version, 'aapt2') aapt2_path = os.path.join(env.build_tools, version, 'aapt2')
if not aapt_path and not os.path.isfile(aapt_path): if not os.path.isfile(aapt_path):
aapt_path = os.path.join(env.build_tools, version, 'aapt') aapt_path = os.path.join(env.build_tools, version, 'aapt')
aapt_version = 1 aapt_version = 1
# Use latest available version for aapt/appt2 but ensure at least one is valid.
if os.path.isfile(aapt2_path) or os.path.isfile(aapt_path):
break break
# Use aapt2 only if present and we have a suitable version # Use aapt2 only if present and we have a suitable version