2016-08-26 17:52:19 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
"""Create the asset."""
|
|
|
|
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import glob
|
|
|
|
import os.path
|
|
|
|
import shutil
|
|
|
|
import subprocess
|
|
|
|
|
2021-06-03 11:54:36 +00:00
|
|
|
|
2021-08-13 15:54:26 +00:00
|
|
|
NDK_VER = "android-ndk-r23"
|
2016-08-26 17:52:19 +00:00
|
|
|
NDK_URL = \
|
2021-08-13 15:54:26 +00:00
|
|
|
"https://dl.google.com/android/repository/%s-linux.zip" % NDK_VER
|
2016-08-26 17:52:19 +00:00
|
|
|
|
2021-06-03 11:54:36 +00:00
|
|
|
|
2016-08-26 17:52:19 +00:00
|
|
|
def create_asset(target_dir):
|
|
|
|
"""Create the asset."""
|
|
|
|
subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"])
|
|
|
|
subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir])
|
|
|
|
for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")):
|
|
|
|
shutil.move(f, target_dir)
|
|
|
|
subprocess.check_call(["rm", "ndk.zip"])
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('--target_dir', '-t', required=True)
|
|
|
|
args = parser.parse_args()
|
|
|
|
create_asset(args.target_dir)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|