aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/assets/android_ndk_darwin/create.py
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-08-26 11:22:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-26 11:22:54 -0700
commitf0f489062a509dbf9212478894f690b00ed7ceb7 (patch)
treee244d5999fafc048435ae0fc94ceb3c6a24e4925 /infra/bots/assets/android_ndk_darwin/create.py
parentce3bfb1ed155880585b2d0bb0a8d3e43306e23f2 (diff)
Add Mac NDK asset, and fetch NDK on Android compile bots.
Diffstat (limited to 'infra/bots/assets/android_ndk_darwin/create.py')
-rwxr-xr-xinfra/bots/assets/android_ndk_darwin/create.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/infra/bots/assets/android_ndk_darwin/create.py b/infra/bots/assets/android_ndk_darwin/create.py
new file mode 100755
index 0000000000..818ec5ac37
--- /dev/null
+++ b/infra/bots/assets/android_ndk_darwin/create.py
@@ -0,0 +1,39 @@
+#!/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
+
+NDK_VER = "android-ndk-r12b"
+NDK_URL = \
+ "https://dl.google.com/android/repository/%s-darwin-x86_64.zip" % NDK_VER
+
+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()