Bug 1578825 - add a strict version check for the NDK version; r=nalexander

One less thing for configurations to vary is a good thing.  This change
also means that when we do NDK bumps that introduce some kind of weird
incompatible change, configuration with a newly-pulled tree and an old
NDK halts at configure, rather than giving weird build errors.

Differential Revision: https://phabricator.services.mozilla.com/D44705

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nathan Froyd 2019-09-04 19:20:39 +00:00
parent 32f8c059bc
commit 18e78c6b0d

View file

@ -81,6 +81,7 @@ add_old_configure_assignment('android_ndk', ndk)
@depends(ndk)
@checking('for android ndk version')
@imports(_from='__builtin__', _import='open')
@imports(_from='mozboot.android', _import='NDK_VERSION')
def ndk_version(ndk):
if not ndk:
# Building 'js/src' for non-Android.
@ -100,6 +101,20 @@ def ndk_version(ndk):
if not major or not minor:
die('Unexpected NDK version string: ' + version)
# source.properties contains a $MAJOR.$MINOR.$PATCH revision number,
# but the more common nomenclature that Google uses is alphanumeric
# version strings like "r20" or "r19c". Convert the source.properties
# notation into an alphanumeric string.
int_minor = int(minor)
alphas = "abcdefghijklmnop"
ascii_minor = alphas[int_minor] if int_minor > 0 else ''
human = "r%s%s" % (major, ascii_minor)
if NDK_VERSION != human:
die('The only supported version of the NDK is %s (have %s)\n'
'Please run |mach bootstrap| '
'to install the correct NDK.' % (NDK_VERSION, human))
return namespace(
major=major,
minor=minor,