зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578471 - consolidate NDK version detection; r=nalexander
We have an `ndk_version_major` and an `ndk_version_minor` that have a lot of duplicated code in them. We could factor them into a single function, but it seems better to just pull their logic into `ndk_version` directly, rearranging that function to be IMHO more understandable. Differential Revision: https://phabricator.services.mozilla.com/D44506 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3607d54634
Коммит
f29b892aa0
|
@ -86,42 +86,28 @@ def ndk_version(ndk):
|
|||
# Building 'js/src' for non-Android.
|
||||
return
|
||||
with open(os.path.join(ndk, 'source.properties'), 'r') as f:
|
||||
for line in f:
|
||||
if not line.startswith('Pkg.Revision'):
|
||||
continue
|
||||
(_, version) = line.split('=')
|
||||
if version:
|
||||
return version.strip()
|
||||
revision = [line for line in f if line.startswith('Pkg.Revision')]
|
||||
if not revision:
|
||||
die('Cannot determine NDK version from source.properties')
|
||||
if len(revision) != 1:
|
||||
die('Too many Pkg.Revision lines in source.properties')
|
||||
|
||||
(_, version) = revision[0].split('=')
|
||||
if not version:
|
||||
die('Unexpected Pkg.Revision line in source.properties')
|
||||
die('Cannot determine NDK version from source.properties')
|
||||
|
||||
(major, minor, revision) = version.strip().split('.')
|
||||
if not major or not minor:
|
||||
die('Unexpected NDK version string: ' + version)
|
||||
|
||||
return namespace(
|
||||
major=major,
|
||||
minor=minor,
|
||||
)
|
||||
|
||||
|
||||
@depends(ndk_version)
|
||||
def ndk_major_version(ndk_version):
|
||||
if not ndk_version:
|
||||
# Building 'js/src' for non-Android.
|
||||
return
|
||||
(major, minor, revision) = ndk_version.split('.')
|
||||
if major:
|
||||
return major
|
||||
die('Unexpected NDK version string: ' + ndk_version)
|
||||
|
||||
|
||||
set_config('ANDROID_NDK_MAJOR_VERSION', ndk_major_version)
|
||||
|
||||
|
||||
@depends(ndk_version)
|
||||
def ndk_minor_version(ndk_version):
|
||||
if not ndk_version:
|
||||
# Building 'js/src' for non-Android.
|
||||
return
|
||||
(major, minor, revision) = ndk_version.split('.')
|
||||
if minor:
|
||||
return minor
|
||||
die('Unexpected NDK version string: ' + ndk_version)
|
||||
|
||||
|
||||
set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version)
|
||||
set_config('ANDROID_NDK_MAJOR_VERSION', ndk_version.major)
|
||||
set_config('ANDROID_NDK_MINOR_VERSION', ndk_version.minor)
|
||||
|
||||
|
||||
@depends(target, android_version, ndk)
|
||||
|
|
Загрузка…
Ссылка в новой задаче