Primiano Tucci | 34bc559 | 2021-02-19 17:53:36 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 2 | # Copyright (C) 2017 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | import argparse |
| 17 | import hashlib |
| 18 | import logging |
| 19 | import os |
| 20 | import shutil |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 21 | import subprocess |
Primiano Tucci | 857ed73 | 2020-12-19 18:11:42 +0100 | [diff] [blame] | 22 | import stat |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 23 | import sys |
Sami Kyostila | c7ddac7 | 2019-06-05 21:43:40 +0100 | [diff] [blame] | 24 | import tempfile |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 25 | import zipfile |
| 26 | |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 27 | from collections import namedtuple |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 28 | from platform import system, machine |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 29 | |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 30 | # The format for the deps below is the following: |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 31 | # (target_folder, source_url, sha1, target_os, target_arch) |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 32 | # |source_url| can be either a git repo or a http url. |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 33 | # If a git repo, |checksum| is the SHA1 committish that will be checked out. |
| 34 | # If a http url, |checksum| is the SHA256 of the downloaded file. |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 35 | # If the url is a .zip or .tgz file it will be automatically deflated under |
| 36 | # |target_folder|, taking care of stripping the root folder if it's a single |
| 37 | # root (to avoid ending up with buildtools/protobuf/protobuf-1.2.3/... and have |
| 38 | # instead just buildtools/protobuf). |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 39 | # |target_os| is either 'darwin', 'linux', 'windows' or 'all' |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 40 | # |target_arch| is either 'x64', 'arm64' or 'all' |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 41 | # in both cases the dep only applies on matching platforms |
| 42 | # |target_arch| can be 'all' when 'target_os' is not 'all' for example in the |
| 43 | # case of MacOS universal binaries. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 44 | Dependency = namedtuple( |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 45 | 'Dependency', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 46 | ['target_folder', 'source_url', 'checksum', 'target_os', 'target_arch']) |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 47 | |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 48 | # This is to remove old directories when build tools get {re,}moved. This is to |
| 49 | # avoid accidentally referring to stale dir in custom user scripts. |
| 50 | CLEANUP_OLD_DIRS = [ |
| 51 | 'buildtools/nodejs', # Moved to buildtools/{mac,linux64}/nodejs |
| 52 | 'buildtools/emsdk', # Moved to buildtools/{mac,linux64}/emsdk |
| 53 | 'buildtools/test_data', # Moved to test/data by r.android.com/1539381 . |
| 54 | 'buildtools/d8', # Removed by r.android.com/1424334 . |
| 55 | ] |
| 56 | |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 57 | # Dependencies required to build code on the host or when targeting desktop OS. |
Florian Mayer | 54c4e38 | 2021-04-20 15:51:23 +0100 | [diff] [blame] | 58 | BUILD_DEPS_TOOLCHAIN_HOST = [ |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 59 | # GN. From https://chrome-infra-packages.appspot.com/dl/gn/gn/. |
Primiano Tucci | d8afe87 | 2022-02-07 23:18:59 +0000 | [diff] [blame] | 60 | # git_revision:0725d7827575b239594fbc8fd5192873a1d62f44 . |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 61 | Dependency( |
| 62 | 'buildtools/mac/gn', |
Primiano Tucci | d8afe87 | 2022-02-07 23:18:59 +0000 | [diff] [blame] | 63 | 'https://storage.googleapis.com/perfetto/gn-mac-1968-0725d782', |
| 64 | '9ced623a664560bba38bbadb9b91158ca4186358c847e17ab7d982b351373c2e', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 65 | 'darwin', 'x64'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 66 | Dependency( |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 67 | 'buildtools/mac/gn', |
| 68 | 'https://storage.googleapis.com/perfetto/gn-mac-arm64-1968-0725d782', |
| 69 | 'd22336b5210b4dad5e36e8c28ce81187f491822cf4d8fd0a257b30d6bee3fd3f', |
| 70 | 'darwin', 'arm64'), |
| 71 | Dependency( |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 72 | 'buildtools/linux64/gn', |
Primiano Tucci | d8afe87 | 2022-02-07 23:18:59 +0000 | [diff] [blame] | 73 | 'https://storage.googleapis.com/perfetto/gn-linux64-1968-0725d782', |
| 74 | 'f706aaa0676e3e22f5fc9ca482295d7caee8535d1869f99efa2358177b64f5cd', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 75 | 'linux', 'x64'), |
Primiano Tucci | e644010 | 2020-12-01 12:41:03 +0100 | [diff] [blame] | 76 | Dependency( |
| 77 | 'buildtools/win/gn.exe', |
Primiano Tucci | d8afe87 | 2022-02-07 23:18:59 +0000 | [diff] [blame] | 78 | 'https://storage.googleapis.com/perfetto/gn-win-1968-0725d782', |
| 79 | '001f777f023c7a6959c778fb3a6b6cfc63f6baef953410ecdeaec350fb12285b', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 80 | 'windows', 'x64'), |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 81 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 82 | # clang-format |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 83 | # From https://chromium.googlesource.com/chromium/src/buildtools/+/refs/heads/master/mac/clang-format.sha1 |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 84 | Dependency( |
| 85 | 'buildtools/mac/clang-format', |
Primiano Tucci | 4e8d6c9 | 2020-09-23 14:40:33 +0200 | [diff] [blame] | 86 | 'https://storage.googleapis.com/chromium-clang-format/62bde1baa7196ad9df969fc1f06b66360b1a927b', |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 87 | '6df686a937443cbe6efc013467a7ba5f98d3f187eb7765bb7abc6ce47626cf66', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 88 | 'darwin', 'all'), |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 89 | # From https://chromium.googlesource.com/chromium/src/buildtools/+/refs/heads/master/linux64/clang-format.sha1 |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 90 | Dependency( |
| 91 | 'buildtools/linux64/clang-format', |
Primiano Tucci | 4e8d6c9 | 2020-09-23 14:40:33 +0200 | [diff] [blame] | 92 | 'https://storage.googleapis.com/chromium-clang-format/1baf0089e895c989a311b6a38ed94d0e8be4c0a7', |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 93 | 'd02a97a87e8c28898033aaf5986967b24dc47ebd5b376e1cd93e5009f22cd75e', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 94 | 'linux', 'x64'), |
Primiano Tucci | e644010 | 2020-12-01 12:41:03 +0100 | [diff] [blame] | 95 | # From https://chromium.googlesource.com/chromium/src/buildtools/+/refs/heads/master/win/clang-format.exe.sha1 |
| 96 | Dependency( |
| 97 | 'buildtools/win/clang-format.exe', |
| 98 | 'https://storage.googleapis.com/chromium-clang-format/d4afd4eba27022f5f6d518133aebde57281677c9', |
| 99 | '2ba1b4d3ade90ea80316890b598ab5fc16777572be26afec6ce23117da121b80', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 100 | 'windows', 'x64'), |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 101 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 102 | # Keep the SHA1 in sync with |clang_format_rev| in chromium //buildtools/DEPS. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 103 | Dependency( |
| 104 | 'buildtools/clang_format/script', |
| 105 | 'https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 106 | '96636aa0e9f047f17447f2d45a094d0b59ed7917', 'all', 'all'), |
Primiano Tucci | 104bd6d | 2017-10-12 00:10:24 +0200 | [diff] [blame] | 107 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 108 | # Ninja |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 109 | Dependency( |
| 110 | 'buildtools/mac/ninja', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 111 | 'https://storage.googleapis.com/perfetto/ninja-mac-x64_and_arm64-182', |
| 112 | '36e8b7aaa06911e1334feb664dd731a1cd69a15eb916a231a3d10ff65fca2c73', |
| 113 | 'darwin', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 114 | Dependency( |
| 115 | 'buildtools/linux64/ninja', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 116 | 'https://storage.googleapis.com/perfetto/ninja-linux64-182', |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 117 | '54ac6a01362190aaabf4cf276f9c8982cdf11b225438940fdde3339be0f2ecdc', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 118 | 'linux', 'x64'), |
Primiano Tucci | e644010 | 2020-12-01 12:41:03 +0100 | [diff] [blame] | 119 | Dependency( |
| 120 | 'buildtools/win/ninja.exe', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 121 | 'https://storage.googleapis.com/perfetto/ninja-win-182', |
| 122 | '09ced0fcd1a4dec7d1b798a2cf9ce5d20e5d2fbc2337343827f192ce47d0f491', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 123 | 'windows', 'x64'), |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 124 | |
Florian Mayer | 54c4e38 | 2021-04-20 15:51:23 +0100 | [diff] [blame] | 125 | # Keep the revision in sync with Chrome's PACKAGE_VERSION in |
| 126 | # tools/clang/scripts/update.py. |
| 127 | Dependency( |
| 128 | 'buildtools/linux64/clang.tgz', |
Primiano Tucci | 8652a85 | 2021-09-08 14:56:19 +0100 | [diff] [blame] | 129 | 'https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/clang-llvmorg-14-init-3191-g0e03450a-1.tgz', |
| 130 | 'dd7479d43ce61401e057a5dee8b7e32bc2bd0d0e15d4f46c6858daf9170c9978', |
Florian Mayer | 54c4e38 | 2021-04-20 15:51:23 +0100 | [diff] [blame] | 131 | 'linux', 'x64'), |
| 132 | Dependency( |
| 133 | 'buildtools/win/clang.tgz', |
Primiano Tucci | 434f1f8 | 2021-10-05 10:17:22 +0100 | [diff] [blame] | 134 | 'https://commondatastorage.googleapis.com/chromium-browser-clang/Win/clang-llvmorg-14-init-3191-g0e03450a-1.tgz', |
| 135 | '4292d191742e7120200c63224f02e1f2f2a7be8b57c0f18edf6ca0955bdd43df', |
Florian Mayer | 54c4e38 | 2021-04-20 15:51:23 +0100 | [diff] [blame] | 136 | 'windows', 'x64'), |
| 137 | ] |
| 138 | |
| 139 | BUILD_DEPS_HOST = [ |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 140 | # Keep in sync with Android's //external/googletest/README.version. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 141 | Dependency( |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 142 | 'buildtools/googletest', |
| 143 | 'https://android.googlesource.com/platform/external/googletest.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 144 | '3f05f651ae3621db58468153e32016bc1397800b', 'all', 'all'), |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 145 | |
Primiano Tucci | f550b25 | 2019-12-03 11:06:02 +0000 | [diff] [blame] | 146 | # Keep in sync with Chromium's //third_party/protobuf. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 147 | Dependency( |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 148 | 'buildtools/protobuf', |
| 149 | 'https://chromium.googlesource.com/external/github.com/google/protobuf.git', |
| 150 | '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', # refs/tags/v3.9.0 |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 151 | 'all', |
| 152 | 'all'), |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 153 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 154 | # libc++, libc++abi and libunwind for Linux where we need to rebuild the C++ |
| 155 | # lib from sources. Keep the SHA1s in sync with Chrome's src/buildtools/DEPS. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 156 | Dependency( |
| 157 | 'buildtools/libcxx', |
Primiano Tucci | 4e8d6c9 | 2020-09-23 14:40:33 +0200 | [diff] [blame] | 158 | 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 159 | 'd9040c75cfea5928c804ab7c235fed06a63f743a', 'all', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 160 | Dependency( |
| 161 | 'buildtools/libcxxabi', |
Primiano Tucci | 4e8d6c9 | 2020-09-23 14:40:33 +0200 | [diff] [blame] | 162 | 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 163 | '196ba1aaa8ac285d94f4ea8d9836390a45360533', 'all', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 164 | Dependency( |
| 165 | 'buildtools/libunwind', |
Primiano Tucci | 4e8d6c9 | 2020-09-23 14:40:33 +0200 | [diff] [blame] | 166 | 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 167 | 'd999d54f4bca789543a2eb6c995af2d9b5a1f3ed', 'all', 'all'), |
Hector Dearman | 88a1011 | 2017-10-12 11:07:10 +0100 | [diff] [blame] | 168 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 169 | # Keep in sync with chromium DEPS. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 170 | Dependency( |
| 171 | 'buildtools/libfuzzer', |
| 172 | 'https://chromium.googlesource.com/chromium/llvm-project/compiler-rt/lib/fuzzer.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 173 | 'debe7d2d1982e540fbd6bd78604bf001753f9e74', 'linux', 'all'), |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 174 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 175 | # Benchmarking tool. |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 176 | Dependency( |
| 177 | 'buildtools/benchmark', |
| 178 | 'https://chromium.googlesource.com/external/github.com/google/benchmark.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 179 | '090faecb454fbd6e6e17a75ef8146acb037118d4', 'all', 'all'), |
Primiano Tucci | 38faa6f | 2018-04-01 20:12:08 +0200 | [diff] [blame] | 180 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 181 | # Libbacktrace, for stacktraces in Linux/Android debug builds. |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 182 | # From https://github.com/ianlancetaylor/libbacktrace/archive/177940370e4a6b2509e92a0aaa9749184e64af43.zip |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 183 | Dependency( |
| 184 | 'buildtools/libbacktrace.zip', |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 185 | 'https://storage.googleapis.com/perfetto/libbacktrace-177940370e4a6b2509e92a0aaa9749184e64af43.zip', |
| 186 | '21ac9a4209f7aeef766c482be53a7fa365063c031c7077e2070b491202983b31', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 187 | 'all', 'all'), |
Lalit Maganti | 6fe26e6 | 2018-05-23 12:14:38 +0100 | [diff] [blame] | 188 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 189 | # Sqlite for the trace processing library. |
| 190 | # This is the amalgamated source whose compiled output is meant to be faster. |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 191 | # We still pull the full source for the extensions (which are not available |
| 192 | # in the amalgamation). |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 193 | Dependency( |
| 194 | 'buildtools/sqlite.zip', |
Lalit Maganti | f9a98e6 | 2021-04-09 14:17:37 +0100 | [diff] [blame] | 195 | 'https://storage.googleapis.com/perfetto/sqlite-amalgamation-3350400.zip', |
| 196 | 'f3bf0df69f5de0675196f4644e05d07dbc698d674dc563a12eff17d5b215cdf5', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 197 | 'all', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 198 | Dependency( |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 199 | 'buildtools/sqlite_src', |
| 200 | 'https://chromium.googlesource.com/external/github.com/sqlite/sqlite.git', |
| 201 | 'ee3686eb50c0e3dbb087c9a0976f7e37e1b014ae', # refs/tags/version-3.32.3. |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 202 | 'all', |
| 203 | 'all'), |
Primiano Tucci | 0d72a31 | 2018-08-07 14:42:45 +0100 | [diff] [blame] | 204 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 205 | # JsonCpp for legacy json import. Used only by the trace processor in |
| 206 | # standalone builds. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 207 | Dependency( |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 208 | 'buildtools/jsoncpp', |
| 209 | 'https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git', |
| 210 | '6aba23f4a8628d599a9ef7fa4811c4ff6e4070e2', # refs/tags/1.9.3. |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 211 | 'all', |
| 212 | 'all'), |
Florian Mayer | 475bd7e | 2018-08-07 20:04:03 +0100 | [diff] [blame] | 213 | |
Ryan Savitski | e65c405 | 2022-03-24 18:22:19 +0000 | [diff] [blame^] | 214 | # Archive with only the demangling sources from llvm-project. |
| 215 | # See tools/repackage_llvm_demangler.sh on how to update this. |
| 216 | # File suffix is the git reference to the commit at which we rearchived the |
| 217 | # sources, as hosted on https://llvm.googlesource.com/llvm-project. |
| 218 | # If updating the version, also update bazel/deps.bzl. |
| 219 | Dependency( |
| 220 | 'buildtools/llvm-project.tgz', |
| 221 | 'https://storage.googleapis.com/perfetto/llvm-project-3b4c59c156919902c785ce3cbae0eee2ee53064d.tgz', |
| 222 | 'f4a52e7f36edd7cacc844d5ae0e5f60b6f57c5afc40683e99f295886c9ce8ff4', |
| 223 | 'all', 'all'), |
| 224 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 225 | # These dependencies are for libunwindstack, which is used by src/profiling. |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 226 | Dependency('buildtools/android-core', |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 227 | 'https://android.googlesource.com/platform/system/core.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 228 | '9e6cef7f07d8c11b3ea820938aeb7ff2e9dbaa52', 'all', 'all'), |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 229 | Dependency( |
| 230 | 'buildtools/android-unwinding', |
| 231 | 'https://android.googlesource.com/platform/system/unwinding.git', |
Daniele Di Proietto | 06d1177 | 2022-01-14 11:19:34 +0000 | [diff] [blame] | 232 | 'b61aebb7f7afaad9b775a59dcd0ea6289fc4325a', 'all', 'all'), |
Florian Mayer | e02b272 | 2020-11-12 10:50:43 +0000 | [diff] [blame] | 233 | Dependency('buildtools/android-logging', |
| 234 | 'https://android.googlesource.com/platform/system/logging.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 235 | '7b36b566c9113fc703d68f76e8f40c0c2432481c', 'all', 'all'), |
Florian Mayer | e02b272 | 2020-11-12 10:50:43 +0000 | [diff] [blame] | 236 | Dependency('buildtools/android-libbase', |
Florian Mayer | fd78c44 | 2020-08-14 12:48:29 +0100 | [diff] [blame] | 237 | 'https://android.googlesource.com/platform/system/libbase.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 238 | '78f1c2f83e625bdf66d55b48bdb3a301c20d2fb3', 'all', 'all'), |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 239 | Dependency( |
| 240 | 'buildtools/android-libprocinfo', |
| 241 | 'https://android.googlesource.com/platform/system/libprocinfo.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 242 | 'fd214c13ededecae97a3b15b5fccc8925a749a84', 'all', 'all'), |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 243 | Dependency('buildtools/lzma', |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 244 | 'https://android.googlesource.com/platform/external/lzma.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 245 | '7851dce6f4ca17f5caa1c93a4e0a45686b1d56c3', 'all', 'all'), |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 246 | Dependency('buildtools/zlib', |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 247 | 'https://android.googlesource.com/platform/external/zlib.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 248 | '5c85a2da4c13eda07f69d81a1579a5afddd35f59', 'all', 'all'), |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 249 | Dependency('buildtools/bionic', |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 250 | 'https://android.googlesource.com/platform/bionic.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 251 | '332065d57e734b65f56474d136d22d767e36cbcd', 'all', 'all'), |
Florian Mayer | 475bd7e | 2018-08-07 20:04:03 +0100 | [diff] [blame] | 252 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 253 | # Linenoise, used only by trace_processor in standalone builds. |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 254 | Dependency('buildtools/linenoise', |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 255 | 'https://fuchsia.googlesource.com/third_party/linenoise.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 256 | 'c894b9e59f02203dbe4e2be657572cf88c4230c3', 'all', 'all'), |
Hector Dearman | 74572bd | 2021-07-07 15:34:13 +0100 | [diff] [blame] | 257 | |
| 258 | # Bloaty, used to investigate binary size |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 259 | Dependency( |
| 260 | 'buildtools/bloaty.zip', |
| 261 | 'https://storage.googleapis.com/perfetto/bloaty-1.1-b3b829de35babc2fe831b9488ad2e50bca939412-mac.zip', |
| 262 | '2d301bd72a20e3f42888c9274ceb4dca76c103608053572322412c2c65ab8cb8', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 263 | 'darwin', 'all'), |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 264 | ] |
| 265 | |
| 266 | # Dependencies required to build Android code. |
| 267 | # URLs and SHA1s taken from: |
| 268 | # - https://dl.google.com/android/repository/repository-11.xml |
| 269 | # - https://dl.google.com/android/repository/sys-img/android/sys-img.xml |
| 270 | BUILD_DEPS_ANDROID = [ |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 271 | # Android NDK |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 272 | Dependency( |
| 273 | 'buildtools/ndk.zip', |
Florian Mayer | 5592685 | 2021-02-17 14:42:32 +0000 | [diff] [blame] | 274 | 'https://dl.google.com/android/repository/android-ndk-r21e-darwin-x86_64.zip', |
| 275 | '437278103a3db12632c05b1be5c41bbb8522791a67e415cc54411a65366f499d', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 276 | 'darwin', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 277 | Dependency( |
| 278 | 'buildtools/ndk.zip', |
Florian Mayer | 5592685 | 2021-02-17 14:42:32 +0000 | [diff] [blame] | 279 | 'https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip', |
| 280 | 'ad7ce5467e18d40050dc51b8e7affc3e635c85bd8c59be62de32352328ed467e', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 281 | 'linux', 'x64'), |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 282 | ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 283 | |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 284 | # Dependencies required to run Android tests. |
| 285 | TEST_DEPS_ANDROID = [ |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 286 | # Android emulator images. |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 287 | Dependency( |
| 288 | 'buildtools/aosp-arm.zip', |
| 289 | 'https://storage.googleapis.com/perfetto/aosp-02022018-arm.zip', |
| 290 | 'f5c7a3a22ad7aa0bd14ba467e8697e1e917d306699bd25622aa4419a413b9b67', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 291 | 'all', 'all'), |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 292 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 293 | # platform-tools.zip contains adb binaries. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 294 | Dependency( |
| 295 | 'buildtools/android_sdk/platform-tools.zip', |
| 296 | 'https://dl.google.com/android/repository/platform-tools_r26.0.0-darwin.zip', |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 297 | '98d392cbd21ca20d643c7e1605760cc49075611e317c534096b5564053f4ac8e', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 298 | 'darwin', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 299 | Dependency( |
| 300 | 'buildtools/android_sdk/platform-tools.zip', |
| 301 | 'https://dl.google.com/android/repository/platform-tools_r26.0.0-linux.zip', |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 302 | '90208207521d85abf0d46e3374aa4e04b7aff74e4f355c792ac334de7a77e50b', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 303 | 'linux', 'x64'), |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 304 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 305 | # Android emulator binaries. |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 306 | Dependency( |
| 307 | 'buildtools/emulator', |
| 308 | 'https://android.googlesource.com/platform/prebuilts/android-emulator.git', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 309 | '4b260028dc27bc92c39bee9129cb2ba839970956', 'all', 'x64'), |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 310 | ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 311 | |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 312 | # This variable is updated by tools/roll-catapult-trace-viewer. |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 313 | CATAPULT_SHA256 = 'b30108e05268ce6c65bb4126b65f6bfac165d17f5c1fd285046e7e6fd76c209f' |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 314 | |
Primiano Tucci | b82f357 | 2021-11-19 12:01:39 +0000 | [diff] [blame] | 315 | TYPEFACES_SHA256 = 'f5f78f8f4395db65cdf5fdc1bf51da65f2161e6d61a305091d6ea54d3094a1f0' |
Hector Dearman | 6177b75 | 2019-01-24 10:17:32 +0000 | [diff] [blame] | 316 | |
Primiano Tucci | 4bdc4c4 | 2018-05-10 15:52:33 +0100 | [diff] [blame] | 317 | UI_DEPS = [ |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 318 | Dependency( |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 319 | 'buildtools/mac/nodejs.tgz', |
| 320 | 'https://storage.googleapis.com/chromium-nodejs/14.15.4/17ba7216e09de1bffb9dc80b7ec617a1cee40330', |
| 321 | 'b81a466347d2ae34b1370b6681ba173e9fb082338170a41624b37be7a2052b7e', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 322 | 'darwin', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 323 | Dependency( |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 324 | 'buildtools/linux64/nodejs.tgz', |
| 325 | 'https://storage.googleapis.com/chromium-nodejs/14.15.4/b2e40ddbac04d05baafbb007f203c6663c9d4ca9', |
| 326 | '5aa88f1e2bf036950790277f3431634f64044ec78362f3e4f0dc8da28d61e9a4', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 327 | 'linux', 'x64'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 328 | Dependency( |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 329 | 'buildtools/mac/emsdk.tgz', |
| 330 | 'https://storage.googleapis.com/perfetto/emscripten-2.0.12-mac.tgz', |
| 331 | 'aa125f8c8ff8a386d43e18c8ea0c98c875cc19160a899403e8967a5478f96f31', |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 332 | 'darwin', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 333 | Dependency( |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 334 | 'buildtools/linux64/emsdk.tgz', |
| 335 | 'https://storage.googleapis.com/perfetto/emscripten-2.0.12-linux.tgz', |
| 336 | 'bfff9fb0326363c12e19b542f27a5f12cedbfc310f30621dc497c9af51d2d2e3', |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 337 | 'linux', 'x64'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 338 | Dependency( |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 339 | 'buildtools/catapult_trace_viewer.tgz', |
| 340 | 'https://storage.googleapis.com/perfetto/catapult_trace_viewer-%s.tar.gz' |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 341 | % CATAPULT_SHA256, CATAPULT_SHA256, 'all', 'all'), |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 342 | Dependency( |
| 343 | 'buildtools/typefaces.tgz', |
| 344 | 'https://storage.googleapis.com/perfetto/typefaces-%s.tar.gz' % |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 345 | TYPEFACES_SHA256, TYPEFACES_SHA256, 'all', 'all') |
Primiano Tucci | 4bdc4c4 | 2018-05-10 15:52:33 +0100 | [diff] [blame] | 346 | ] |
| 347 | |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 348 | # Sysroots required to cross-compile Linux targets (linux-arm{,64}). |
| 349 | # These are taken from Chromium's build/linux/sysroot_scripts/sysroots.json. |
| 350 | BUILD_DEPS_LINUX_CROSS_SYSROOTS = [ |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 351 | Dependency( |
| 352 | 'buildtools/debian_sid_arm-sysroot.tgz', |
| 353 | 'https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/11d6f690ca49e8ba01a1d8c5346cedad2cf308fd/debian_sid_arm_sysroot.tar.xz', |
| 354 | 'ff192fe073d140d836c9ca1e68f7200d558bb9aa6c5c8f4f76f794f82890f99a', |
| 355 | 'linux', 'all'), |
| 356 | Dependency( |
| 357 | 'buildtools/debian_sid_arm64-sysroot.tgz', |
| 358 | 'https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2befe8ce3e88be6080e4fb7e6d412278ea6a7625/debian_sid_arm64_sysroot.tar.xz', |
| 359 | 'e4389eab2fe363f3fbdfa4d3ce9d94457d78fd2c0e62171a7534867623eadc90', |
| 360 | 'linux', 'all'), |
| 361 | ] |
| 362 | |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 363 | ALL_DEPS = ( |
| 364 | BUILD_DEPS_HOST + BUILD_DEPS_ANDROID + BUILD_DEPS_LINUX_CROSS_SYSROOTS + |
| 365 | TEST_DEPS_ANDROID + UI_DEPS) |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 366 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 367 | ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 368 | UI_DIR = os.path.join(ROOT_DIR, 'ui') |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 369 | TOOLS_DIR = os.path.join(ROOT_DIR, 'tools') |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 370 | NODE_MODULES_STATUS_FILE = os.path.join(UI_DIR, 'node_modules', '.last_install') |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 371 | TEST_DATA_SCRIPT = os.path.join(TOOLS_DIR, 'test_data') |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 372 | |
| 373 | |
Primiano Tucci | 585b7e8 | 2020-05-14 11:19:10 +0100 | [diff] [blame] | 374 | def DownloadURL(url, out_file): |
Primiano Tucci | 9ff392c | 2020-05-15 22:35:38 +0100 | [diff] [blame] | 375 | subprocess.check_call(['curl', '-L', '-#', '-o', out_file, url]) |
Primiano Tucci | 585b7e8 | 2020-05-14 11:19:10 +0100 | [diff] [blame] | 376 | |
| 377 | |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 378 | def GetArch(): |
| 379 | arch = machine() |
Primiano Tucci | 0e7915d | 2022-02-08 15:25:49 +0000 | [diff] [blame] | 380 | if arch == 'arm64': |
| 381 | return 'arm64' |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 382 | else: |
| 383 | # Assume everything else is x64 matching previous behaviour. |
| 384 | return 'x64' |
| 385 | |
| 386 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 387 | def ReadFile(path): |
| 388 | if not os.path.exists(path): |
| 389 | return None |
| 390 | with open(path) as f: |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 391 | return f.read().strip() |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 392 | |
| 393 | |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 394 | def MkdirRecursive(path): |
| 395 | # Works with both relative and absolute paths |
| 396 | cwd = '/' if path.startswith('/') else ROOT_DIR |
| 397 | for part in path.split('/'): |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 398 | cwd = os.path.join(cwd, part) |
| 399 | if not os.path.exists(cwd): |
| 400 | os.makedirs(cwd) |
| 401 | else: |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 402 | assert (os.path.isdir(cwd)) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 403 | |
| 404 | |
| 405 | def HashLocalFile(path): |
| 406 | if not os.path.exists(path): |
| 407 | return None |
| 408 | with open(path, 'rb') as f: |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 409 | return hashlib.sha256(f.read()).hexdigest() |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 410 | |
| 411 | |
| 412 | def ExtractZipfilePreservePermissions(zf, info, path): |
| 413 | zf.extract(info.filename, path=path) |
| 414 | target_path = os.path.join(path, info.filename) |
| 415 | min_acls = 0o755 if info.filename.endswith('/') else 0o644 |
Matthew Clarkson | 9a5dfa5 | 2019-10-03 09:54:04 +0100 | [diff] [blame] | 416 | os.chmod(target_path, (info.external_attr >> 16) | min_acls) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 417 | |
| 418 | |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 419 | def IsGitRepoCheckoutOutAtRevision(path, revision): |
| 420 | return ReadFile(os.path.join(path, '.git', 'HEAD')) == revision |
| 421 | |
| 422 | |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 423 | def RmtreeIfExists(path): |
Primiano Tucci | 857ed73 | 2020-12-19 18:11:42 +0100 | [diff] [blame] | 424 | # Git creates read-only files on windows, which cause failures with rmtree. |
| 425 | # This seems the socially accepted way to deal with it. |
| 426 | # See https://bugs.python.org/issue19643 . |
| 427 | def del_read_only_for_windows(_action, name, _exc): |
| 428 | os.chmod(name, stat.S_IWRITE) |
| 429 | os.remove(name) |
| 430 | |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 431 | if not os.path.exists(path): |
| 432 | return |
| 433 | buildtools_path = os.path.abspath(os.path.join(ROOT_DIR, 'buildtools')) |
Florian Mayer | 83d683f | 2021-01-29 16:57:16 +0000 | [diff] [blame] | 434 | test_path = os.path.abspath(os.path.join(ROOT_DIR, 'test', 'data')) |
| 435 | if (not os.path.abspath(path).startswith(buildtools_path) and |
| 436 | not os.path.abspath(path).startswith(test_path)): |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 437 | # Safety check to prevent that some merge confilct ends up doing some |
| 438 | # rm -rf / or similar. |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 439 | logging.fatal('Cannot remove %s: outside of buildtools and test/data', path) |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 440 | sys.exit(1) |
| 441 | logging.info('Removing %s' % path) |
| 442 | shutil.rmtree(path, onerror=del_read_only_for_windows) |
| 443 | |
| 444 | |
| 445 | def CheckoutGitRepo(path, git_url, revision, check_only): |
| 446 | if IsGitRepoCheckoutOutAtRevision(path, revision): |
| 447 | return False |
| 448 | if check_only: |
| 449 | return True |
| 450 | path = path.replace('/', os.sep) |
| 451 | RmtreeIfExists(path) |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 452 | MkdirRecursive(path) |
| 453 | logging.info('Fetching %s @ %s into %s', git_url, revision, path) |
Lalit Maganti | 367fcd5 | 2018-02-05 16:06:13 +0000 | [diff] [blame] | 454 | subprocess.check_call(['git', 'init', path], cwd=path) |
| 455 | subprocess.check_call( |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 456 | ['git', 'fetch', '--quiet', '--depth', '1', git_url, revision], cwd=path) |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 457 | subprocess.check_call(['git', 'checkout', revision, '--quiet'], cwd=path) |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 458 | assert (IsGitRepoCheckoutOutAtRevision(path, revision)) |
Eric Seckler | 676421f | 2019-02-12 14:43:31 +0000 | [diff] [blame] | 459 | return True |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 460 | |
Sami Kyostila | c7ddac7 | 2019-06-05 21:43:40 +0100 | [diff] [blame] | 461 | |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 462 | def InstallNodeModules(force_clean=False): |
| 463 | if force_clean: |
| 464 | node_modules = os.path.join(UI_DIR, 'node_modules') |
| 465 | logging.info('Clearing %s', node_modules) |
| 466 | subprocess.check_call(['git', 'clean', '-qxffd', node_modules], |
| 467 | cwd=ROOT_DIR) |
Primiano Tucci | 73933a7 | 2021-06-04 00:14:38 +0100 | [diff] [blame] | 468 | logging.info("Running `npm ci` in {0}".format(UI_DIR)) |
| 469 | # `npm ci` is like `npm install` but respects package-lock.json. |
| 470 | subprocess.check_call([os.path.join(TOOLS_DIR, 'npm'), 'ci'], cwd=UI_DIR) |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 471 | # pbjs has the bad habit of installing extra packages on its first run. Run |
| 472 | # it here, so we avoid fetches while building. |
| 473 | node_bin = os.path.join(TOOLS_DIR, 'node') |
| 474 | pbjs = [node_bin, 'node_modules/.bin/pbjs', '/dev/null', '-o', '/dev/null'] |
| 475 | subprocess.call(pbjs, cwd=UI_DIR) |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 476 | with open(NODE_MODULES_STATUS_FILE, 'w') as f: |
| 477 | f.write(HashLocalFile(os.path.join(UI_DIR, 'package-lock.json'))) |
| 478 | |
| 479 | |
| 480 | def CheckNodeModules(): |
| 481 | """Returns True if the modules are up-to-date. |
| 482 | |
| 483 | There doesn't seem to be an easy way to check node modules versions. Instead |
| 484 | just check if package-lock.json changed since the last `npm install` call. |
| 485 | """ |
| 486 | if not os.path.exists(NODE_MODULES_STATUS_FILE): |
| 487 | return False |
| 488 | with open(NODE_MODULES_STATUS_FILE, 'r') as f: |
| 489 | actual = f.read() |
| 490 | expected = HashLocalFile(os.path.join(UI_DIR, 'package-lock.json')) |
| 491 | return expected == actual |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 492 | |
Sami Kyostila | c7ddac7 | 2019-06-05 21:43:40 +0100 | [diff] [blame] | 493 | |
| 494 | def CheckHashes(): |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 495 | for dep in ALL_DEPS: |
| 496 | if dep.source_url.endswith('.git'): |
| 497 | continue |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 498 | logging.info('Downloading %s for %s-%s', dep.source_url, dep.target_os, |
| 499 | dep.target_arch) |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 500 | with tempfile.NamedTemporaryFile(delete=False) as f: |
| 501 | f.close() |
| 502 | DownloadURL(dep.source_url, f.name) |
| 503 | actual_checksum = HashLocalFile(f.name) |
| 504 | os.unlink(f.name) |
| 505 | if (actual_checksum != dep.checksum): |
| 506 | logging.fatal('SHA-256 mismatch for {} expected {} was {}'.format( |
| 507 | dep.source_url, dep.checksum, actual_checksum)) |
Sami Kyostila | c7ddac7 | 2019-06-05 21:43:40 +0100 | [diff] [blame] | 508 | |
| 509 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 510 | def Main(): |
| 511 | parser = argparse.ArgumentParser() |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 512 | parser.add_argument( |
| 513 | '--android', |
| 514 | action='store_true', |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 515 | help='NDK and emulator images target_os="android"') |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 516 | parser.add_argument( |
| 517 | '--linux-arm', |
| 518 | action='store_true', |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 519 | help='Debian sysroots for target_os="linux" target_cpu="arm|arm64"') |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 520 | parser.add_argument( |
| 521 | '--ui', |
| 522 | action='store_true', |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 523 | help='Node and NPM packages to Build the Web-based UI via ./ui/build') |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 524 | parser.add_argument('--check-only') |
Primiano Tucci | cde1a8c | 2021-02-15 19:18:10 +0100 | [diff] [blame] | 525 | parser.add_argument('--filter', default='') |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 526 | parser.add_argument('--verify', help='Check all URLs', action='store_true') |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 527 | parser.add_argument( |
| 528 | '--no-toolchain', help='Do not download toolchain', action='store_true') |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 529 | args = parser.parse_args() |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 530 | if args.verify: |
Sami Kyostila | c7ddac7 | 2019-06-05 21:43:40 +0100 | [diff] [blame] | 531 | CheckHashes() |
| 532 | return 0 |
Lalit Maganti | 0830b60 | 2021-06-11 15:11:42 +0100 | [diff] [blame] | 533 | |
| 534 | target_os = system().lower() |
| 535 | if args.ui and target_os == 'windows': |
| 536 | print('Building the UI on Windows is unsupported') |
| 537 | return 1 |
| 538 | |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 539 | deps = BUILD_DEPS_HOST |
Florian Mayer | 54c4e38 | 2021-04-20 15:51:23 +0100 | [diff] [blame] | 540 | if not args.no_toolchain: |
| 541 | deps += BUILD_DEPS_TOOLCHAIN_HOST |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 542 | if args.android: |
Primiano Tucci | d775045 | 2017-09-29 14:38:51 +0100 | [diff] [blame] | 543 | deps += BUILD_DEPS_ANDROID + TEST_DEPS_ANDROID |
Primiano Tucci | b428d49 | 2021-08-02 19:01:29 +0100 | [diff] [blame] | 544 | if args.linux_arm: |
| 545 | deps += BUILD_DEPS_LINUX_CROSS_SYSROOTS |
Primiano Tucci | 4bdc4c4 | 2018-05-10 15:52:33 +0100 | [diff] [blame] | 546 | if args.ui: |
| 547 | deps += UI_DEPS |
Eric Seckler | 6e828f3 | 2019-01-02 11:10:56 +0000 | [diff] [blame] | 548 | deps_updated = False |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 549 | nodejs_updated = False |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 550 | |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 551 | for old_dir in CLEANUP_OLD_DIRS: |
| 552 | RmtreeIfExists(os.path.join(ROOT_DIR, old_dir)) |
| 553 | |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 554 | for dep in deps: |
Hector Dearman | adf5117 | 2021-04-09 16:09:45 +0100 | [diff] [blame] | 555 | target_arch = GetArch() |
| 556 | matches_os = dep.target_os == 'all' or target_os == dep.target_os |
| 557 | matches_arch = dep.target_arch == 'all' or target_arch == dep.target_arch |
| 558 | if not matches_os or not matches_arch: |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 559 | continue |
Primiano Tucci | cde1a8c | 2021-02-15 19:18:10 +0100 | [diff] [blame] | 560 | if args.filter and args.filter not in dep.target_folder: |
| 561 | continue |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 562 | local_path = os.path.join(ROOT_DIR, dep.target_folder) |
| 563 | if dep.source_url.endswith('.git'): |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 564 | deps_updated |= CheckoutGitRepo(local_path, dep.source_url, dep.checksum, |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 565 | args.check_only) |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 566 | continue |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 567 | is_zip = local_path.endswith('.zip') or local_path.endswith('.tgz') |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 568 | zip_target_dir = local_path[:-4] if is_zip else None |
| 569 | zip_dir_stamp = os.path.join(zip_target_dir, '.stamp') if is_zip else None |
| 570 | |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 571 | if ((not is_zip and HashLocalFile(local_path) == dep.checksum) or |
| 572 | (is_zip and ReadFile(zip_dir_stamp) == dep.checksum)): |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 573 | continue |
Eric Seckler | 6e828f3 | 2019-01-02 11:10:56 +0000 | [diff] [blame] | 574 | deps_updated = True |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 575 | if args.check_only: |
| 576 | continue |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 577 | MkdirRecursive(os.path.dirname(dep.target_folder)) |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 578 | if HashLocalFile(local_path) != dep.checksum: |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 579 | download_path = local_path + '.tmp' |
Jordan Bayles | 8c6a4bc | 2020-07-16 20:20:48 -0700 | [diff] [blame] | 580 | logging.info('Downloading %s from %s', local_path, dep.source_url) |
| 581 | DownloadURL(dep.source_url, download_path) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 582 | os.chmod(download_path, 0o755) |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 583 | actual_checksum = HashLocalFile(download_path) |
| 584 | if (actual_checksum != dep.checksum): |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 585 | os.remove(download_path) |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 586 | logging.fatal('SHA-256 mismatch for {} expected {} was {}'.format( |
| 587 | download_path, dep.checksum, actual_checksum)) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 588 | return 1 |
Primiano Tucci | e644010 | 2020-12-01 12:41:03 +0100 | [diff] [blame] | 589 | shutil.move(download_path, local_path) |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 590 | if 'nodejs' in dep.target_folder: |
| 591 | nodejs_updated = True |
| 592 | |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 593 | assert (HashLocalFile(local_path) == dep.checksum) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 594 | |
| 595 | if is_zip: |
| 596 | logging.info('Extracting %s into %s' % (local_path, zip_target_dir)) |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 597 | assert (os.path.commonprefix((ROOT_DIR, zip_target_dir)) == ROOT_DIR) |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 598 | RmtreeIfExists(zip_target_dir) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 599 | |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 600 | # Decompress the archive. |
| 601 | if local_path.endswith('.tgz'): |
| 602 | MkdirRecursive(zip_target_dir) |
Primiano Tucci | 4bdc4c4 | 2018-05-10 15:52:33 +0100 | [diff] [blame] | 603 | subprocess.check_call(['tar', '-xf', local_path], cwd=zip_target_dir) |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 604 | elif local_path.endswith('.zip'): |
| 605 | with zipfile.ZipFile(local_path, 'r') as zf: |
| 606 | for info in zf.infolist(): |
| 607 | ExtractZipfilePreservePermissions(zf, info, zip_target_dir) |
| 608 | |
| 609 | # If the zip contains one root folder, rebase one level up moving all |
| 610 | # its sub files and folders inside |target_dir|. |
| 611 | subdir = os.listdir(zip_target_dir) |
| 612 | if len(subdir) == 1: |
| 613 | subdir = os.path.join(zip_target_dir, subdir[0]) |
| 614 | if os.path.isdir(subdir): |
| 615 | for subf in os.listdir(subdir): |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 616 | shutil.move(os.path.join(subdir, subf), zip_target_dir) |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 617 | os.rmdir(subdir) |
| 618 | |
| 619 | # Create stamp and remove the archive. |
| 620 | with open(zip_dir_stamp, 'w') as stamp_file: |
Primiano Tucci | 15968b5 | 2020-10-28 15:30:40 +0100 | [diff] [blame] | 621 | stamp_file.write(dep.checksum) |
Primiano Tucci | b60d4b0 | 2017-11-10 11:03:00 +0000 | [diff] [blame] | 622 | os.remove(local_path) |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 623 | |
Deepanjan Roy | acf8c07 | 2018-07-13 11:37:04 -0400 | [diff] [blame] | 624 | if args.ui: |
| 625 | # Needs to happen after nodejs is installed above. |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 626 | if args.check_only: |
Primiano Tucci | c1aecf4 | 2021-04-13 22:22:19 +0100 | [diff] [blame] | 627 | deps_updated |= not CheckNodeModules() |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 628 | else: |
Primiano Tucci | 43f111a | 2020-07-27 20:37:52 +0200 | [diff] [blame] | 629 | InstallNodeModules(force_clean=nodejs_updated) |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 630 | |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 631 | cur_python_interpreter = sys.executable |
Primiano Tucci | 856f2be | 2022-03-17 17:25:12 +0000 | [diff] [blame] | 632 | test_data_synced = 0 == subprocess.call([ |
| 633 | cur_python_interpreter, TEST_DATA_SCRIPT, 'status', '--quiet', |
| 634 | '--ignore-new' |
| 635 | ]) |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 636 | if args.check_only: |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 637 | if not deps_updated and test_data_synced: |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 638 | with open(args.check_only, 'w') as f: |
| 639 | f.write('OK') # The content is irrelevant, just keep GN happy. |
| 640 | return 0 |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 641 | argz = ' '.join( |
| 642 | [x for x in sys.argv[1:] if not x.startswith('--check-only')]) |
Primiano Tucci | 7e9865c | 2021-01-10 23:55:15 +0100 | [diff] [blame] | 643 | print('\033[91mBuild deps are stale. ' + |
| 644 | 'Please run tools/install-build-deps %s\033[0m' % argz) |
Primiano Tucci | 856f2be | 2022-03-17 17:25:12 +0000 | [diff] [blame] | 645 | if not test_data_synced: |
| 646 | print('//test/data/ is out of sync. `tools/test_data status` for details') |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 647 | return 1 |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 648 | |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 649 | if not test_data_synced: |
Primiano Tucci | 5441890 | 2021-11-06 12:09:48 +0000 | [diff] [blame] | 650 | cmd = [cur_python_interpreter, TEST_DATA_SCRIPT, 'download', '--overwrite'] |
Primiano Tucci | 3d4217d | 2021-11-05 11:11:51 +0000 | [diff] [blame] | 651 | if not sys.stdout.isatty(): |
| 652 | cmd += ['--verbose'] # For CI bots |
| 653 | subprocess.check_call(cmd) |
| 654 | |
Eric Seckler | 6e828f3 | 2019-01-02 11:10:56 +0000 | [diff] [blame] | 655 | if deps_updated: |
| 656 | # Stale binary files may be compiled against old sysroot headers that aren't |
| 657 | # tracked by gn. |
Matthew Clarkson | 9a5dfa5 | 2019-10-03 09:54:04 +0100 | [diff] [blame] | 658 | logging.warning('Remember to run "gn clean <output_directory>" ' + |
| 659 | 'to avoid stale binary files.') |
Eric Seckler | 6e828f3 | 2019-01-02 11:10:56 +0000 | [diff] [blame] | 660 | |
Matthew Clarkson | 63028d6 | 2019-10-10 15:48:23 +0100 | [diff] [blame] | 661 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 662 | if __name__ == '__main__': |
| 663 | logging.basicConfig(level=logging.INFO) |
| 664 | sys.exit(Main()) |