8Invokes //gradle for building the Android apps from GN/Ninja.
16SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
18BAT =
'.bat' if sys.platform.startswith((
'cygwin',
'win'))
else ''
19GRADLE_BIN = os.path.normpath(
20 os.path.join(SCRIPT_PATH,
'..',
'..',
'third_party',
'gradle',
'bin',
'gradle%s' % BAT)
23ANDROID_HOME = os.path.normpath(
24 os.path.join(SCRIPT_PATH,
'..',
'..',
'third_party',
'android_tools',
'sdk')
27if platform.system() ==
'Darwin':
28 JAVA_HOME = os.path.normpath(
30 SCRIPT_PATH,
'..',
'..',
'..',
'third_party',
'java',
'openjdk',
'Contents',
'Home'
34 JAVA_HOME = os.path.normpath(
35 os.path.join(SCRIPT_PATH,
'..',
'..',
'..',
'third_party',
'java',
'openjdk')
40 if not os.path.isdir(ANDROID_HOME):
41 raise Exception(
'%s (ANDROID_HOME) is not a directory' % ANDROID_HOME)
43 android_dir = sys.argv[1]
44 subprocess.check_output(
45 args=[GRADLE_BIN] + sys.argv[2:],
47 env=dict(os.environ, ANDROID_HOME=ANDROID_HOME, JAVA_HOME=JAVA_HOME),
52if __name__ ==
'__main__':