Set ANDROID_HOME in run_gradle.py (flutter/engine#27371)

This commit is contained in:
Dan Field 2021-07-13 14:36:13 -07:00 committed by GitHub
parent 233a06b114
commit b15aea39f1

View File

@ -11,13 +11,21 @@ import os
import sys
import subprocess
SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
ANDROID_HOME = os.path.join(SCRIPT_PATH, '..', '..', '..', '..', 'third_party',
'android_tools', 'sdk')
def main():
if not os.path.isdir(ANDROID_HOME):
raise Exception('%s (ANDROID_HOME) is not a directory' % ANDROID_HOME)
BAT = '.bat' if sys.platform.startswith(('cygwin', 'win')) else ''
android_dir = os.path.abspath(os.path.dirname(__file__))
gradle_bin = os.path.join('.', 'gradlew%s' % BAT)
result = subprocess.check_output(
args=[gradle_bin] + sys.argv[1:],
cwd=android_dir,
env=dict(os.environ, ANDROID_HOME=ANDROID_HOME),
)
return 0