Use buildtools clang-format

Previously, buildtools' copy of clang-format was stuck at 6.0, so we
used a custom built of 7.0. Now, buildtools' version is 11.0.

Bug: none
Change-Id: I8964bcfbea2d40284249427395c8d417fc77b18d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24640
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Kai Ninomiya 2020-07-10 17:49:18 +00:00 committed by Commit Bot service account
parent 479689912e
commit d82ef86b79
2 changed files with 9 additions and 24 deletions

6
DEPS
View File

@ -101,12 +101,6 @@ deps = {
'condition': 'dawn_standalone',
},
# Our own pre-compiled Linux clang-format 7.0 for presubmit
'third_party/clang-format': {
'url': '{dawn_git}/clang-format@2451c56cd368676cdb230fd5ad11731ab859f1a3',
'condition': 'dawn_standalone and checkout_linux',
},
# Khronos Vulkan headers, validation layers and loader.
'third_party/vulkan-headers': {
'url': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Headers@4c079bf40c2587220dbf157d825d3185c9adc896',

View File

@ -17,8 +17,13 @@ import platform
import subprocess
def _DoClangFormat(input_api, output_api):
# Our binary clang-format is a linux binary compiled for x64
if platform.system() != 'Linux' or platform.architecture()[0] != '64bit':
if platform.system() == 'Linux' and platform.architecture()[0] == '64bit':
clang_format_path = 'buildtools/linux64/clang-format'
elif platform.system() == 'Mac':
clang_format_path = 'buildtools/mac/clang-format'
elif platform.system() == 'Windows':
clang_format_path = 'buildtools/win/clang-format.exe'
else:
return [output_api.PresubmitNotifyResult('Skipping clang-format')]
# We need to know which commit to diff against. It doesn't seem to be exposed anywhere
@ -30,27 +35,13 @@ def _DoClangFormat(input_api, output_api):
lint_cmd = [
'scripts/lint_clang_format.sh',
'third_party/clang-format/clang-format',
clang_format_path,
upstream_commit
]
# Make clang-format use our linux x64 sysroot because it is compiled with a version of
# stdlibc++ that's incompatible with the old libraries present on the bots.
env = {
'LD_LIBRARY_PATH': os.path.join(
os.getcwd(),
'build',
'linux',
'debian_sid_amd64-sysroot',
'usr',
'lib',
'x86_64-linux-gnu'
)
}
# Call the linting script and forward the output as a notification or as an error
try:
output = subprocess.check_output(lint_cmd, env=env);
output = subprocess.check_output(lint_cmd)
return [output_api.PresubmitNotifyResult(output)]
except subprocess.CalledProcessError as e:
return [output_api.PresubmitError(e.output)]