summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/format.py6
-rwxr-xr-xtools/setup.py1
-rw-r--r--tools/third_party.py23
3 files changed, 21 insertions, 9 deletions
diff --git a/tools/format.py b/tools/format.py
index 51bf2c1fb..85dbf2d4d 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import os
-from third_party import third_party_path, fix_symlinks, google_env
+from third_party import third_party_path, fix_symlinks, google_env, clang_format_path
from util import root_path, run, find_exts
fix_symlinks()
@@ -12,8 +12,8 @@ rustfmt_config = os.path.join(tools_path, "rustfmt.toml")
os.chdir(root_path)
-# TODO(ry) Use third_party/depot_tools/clang-format.
-run(["clang-format", "-i", "-style", "Google"] + find_exts("src", ".cc", ".h"))
+run([clang_format_path, "-i", "-style", "Google"] +
+ find_exts("src", ".cc", ".h"))
for fn in ["BUILD.gn", ".gn"] + find_exts("build_extra", ".gn", ".gni"):
run(["third_party/depot_tools/gn", "format", fn], env=google_env())
diff --git a/tools/setup.py b/tools/setup.py
index 930f1b690..883270ad1 100755
--- a/tools/setup.py
+++ b/tools/setup.py
@@ -7,6 +7,7 @@ import distutils.spawn
third_party.fix_symlinks()
third_party.download_gn()
+third_party.download_clang_format()
third_party.download_clang()
third_party.maybe_download_sysroot()
diff --git a/tools/third_party.py b/tools/third_party.py
index 1bc687b85..0a053fbcd 100644
--- a/tools/third_party.py
+++ b/tools/third_party.py
@@ -21,6 +21,7 @@ third_party_path = tp()
depot_tools_path = tp("depot_tools")
rust_crates_path = tp("rust_crates")
gn_path = tp(depot_tools_path, "gn")
+clang_format_path = tp(depot_tools_path, "clang-format")
ninja_path = tp(depot_tools_path, "ninja")
@@ -141,27 +142,37 @@ def run_gclient_sync():
rmtree(depot_tools_temp_path)
-# Download gn from Google storage.
-def download_gn():
+# Download the given item from Google storage.
+def download_from_google_storage(item, bucket):
if sys.platform == 'win32':
- sha1_file = "v8/buildtools/win/gn.exe.sha1"
+ sha1_file = "v8/buildtools/win/%s.exe.sha1" % item
elif sys.platform == 'darwin':
- sha1_file = "v8/buildtools/mac/gn.sha1"
+ sha1_file = "v8/buildtools/mac/%s.sha1" % item
elif sys.platform.startswith('linux'):
- sha1_file = "v8/buildtools/linux64/gn.sha1"
+ sha1_file = "v8/buildtools/linux64/%s.sha1" % item
run([
"python",
tp('depot_tools/download_from_google_storage.py'),
'--platform=' + sys.platform,
'--no_auth',
- '--bucket=chromium-gn',
+ '--bucket=%s' % bucket,
'--sha1_file',
tp(sha1_file),
],
env=google_env())
+# Download gn from Google storage.
+def download_gn():
+ download_from_google_storage('gn', 'chromium-gn')
+
+
+# Download clang-format from Google storage.
+def download_clang_format():
+ download_from_google_storage('clang-format', 'chromium-clang-format')
+
+
# Download clang by calling the clang update script.
def download_clang():
run(['python',