chore: download clang-format from google storage

This commit is contained in:
Yoshiya Hinosawa 2018-08-17 12:44:55 +09:00 committed by Ryan Dahl
parent 565a21eb0e
commit 67d89ff692
3 changed files with 21 additions and 9 deletions

View file

@ -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())

View file

@ -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()

View file

@ -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',