mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 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 | import subprocess |
| 9 | import sys |
| 10 | |
| 11 | def quiet(*cmd): |
| 12 | cmd = ' '.join(cmd).split() |
| 13 | subprocess.check_output(cmd) |
| 14 | |
| 15 | def loud(*cmd): |
| 16 | cmd = ' '.join(cmd).split() |
| 17 | ret = subprocess.call(cmd) |
| 18 | if ret != 0: |
| 19 | sys.exit(ret) |
| 20 | |
| 21 | def gn_path(): |
| 22 | if 'linux' in sys.platform: |
| 23 | return 'buildtools/linux64/gn' |
| 24 | if 'darwin' in sys.platform: |
| 25 | return 'buildtools/mac/gn' |
| 26 | return 'buildtools/win/gn.exe' |
| 27 | |
| 28 | # Make sure we've got an up-to-date GN and Clang, and sysroot on Linux. |
| 29 | quiet('download_from_google_storage', |
| 30 | '--no_resume --no_auth --bucket chromium-gn', |
| 31 | '-s ', gn_path() + '.sha1') |
| 32 | quiet('python tools/clang/scripts/update.py --if-needed') |
| 33 | if 'linux' in sys.platform: |
| 34 | quiet('python build/linux/sysroot_scripts/install-sysroot.py --arch=amd64') |
| 35 | |
| 36 | # Pass all our arguments over to the real GN binary. |
| 37 | loud(gn_path(), *sys.argv[1:]) |