Bug 1557855 - Change how --with-android-sdk is handled. r=nalexander

We make it have a default value only if the corresponding directory exists,
and make it throw a more explicit error when the explicitly given directory
doesn't exist.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-06-07 22:20:48 +00:00
Родитель 4b49193e14
Коммит 177ad5806d
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -15,10 +15,10 @@ def default_android_sdk_root(host, mozbuild_state_path, _):
'Linux': 'android-sdk-linux',
'WINNT': 'android-sdk-windows',
}.get(host.kernel)
if sdk_basename is None:
log.warning("%s is unsupported host" % host.kernel)
return None
return os.path.join(mozbuild_state_path, sdk_basename)
if sdk_basename:
path = os.path.join(mozbuild_state_path, sdk_basename)
if os.path.isdir(path):
return path
option('--with-android-sdk', nargs=1,
@ -29,7 +29,10 @@ option('--with-android-sdk', nargs=1,
@depends('--with-android-sdk')
@imports(_from='os.path', _import='isdir')
def android_sdk_root(value):
if value and isdir(value[0]):
if value:
if not isdir(value[0]):
die("The path you specified with --with-android-sdk (%s) is not "
"a directory" % value[0])
return value[0]
die("You must specify --with-android-sdk=/path/to/sdk when targeting Android, "