• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# Copyright 2016 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""Create the asset."""
10
11
12import argparse
13import glob
14import os.path
15import shutil
16import subprocess
17
18NDK_VER = "android-ndk-r19-beta2"
19NDK_URL = \
20    "https://dl.google.com/android/repository/%s-windows-x86_64.zip" % NDK_VER
21
22def create_asset(target_dir):
23  """Create the asset."""
24  subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"])
25  subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir])
26  for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")):
27    shutil.move(f, target_dir)
28  subprocess.check_call(["rm", "ndk.zip"])
29
30  # Some of these files have paths that exceed 260 characters when downloaded
31  # as a CIPD package.  Luckily they're just tests.  We don't need them.
32  shutil.rmtree(os.path.join(target_dir,
33                             'sources', 'cxx-stl', 'llvm-libc++', 'test'))
34
35
36def main():
37  parser = argparse.ArgumentParser()
38  parser.add_argument('--target_dir', '-t', required=True)
39  args = parser.parse_args()
40  create_asset(args.target_dir)
41
42
43if __name__ == '__main__':
44  main()
45