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:
parent
479689912e
commit
d82ef86b79
6
DEPS
6
DEPS
|
@ -101,12 +101,6 @@ deps = {
|
||||||
'condition': 'dawn_standalone',
|
'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.
|
# Khronos Vulkan headers, validation layers and loader.
|
||||||
'third_party/vulkan-headers': {
|
'third_party/vulkan-headers': {
|
||||||
'url': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Headers@4c079bf40c2587220dbf157d825d3185c9adc896',
|
'url': '{chromium_git}/external/github.com/KhronosGroup/Vulkan-Headers@4c079bf40c2587220dbf157d825d3185c9adc896',
|
||||||
|
|
27
PRESUBMIT.py
27
PRESUBMIT.py
|
@ -17,8 +17,13 @@ import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
def _DoClangFormat(input_api, output_api):
|
def _DoClangFormat(input_api, output_api):
|
||||||
# Our binary clang-format is a linux binary compiled for x64
|
if platform.system() == 'Linux' and platform.architecture()[0] == '64bit':
|
||||||
if platform.system() != 'Linux' or 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')]
|
return [output_api.PresubmitNotifyResult('Skipping clang-format')]
|
||||||
|
|
||||||
# We need to know which commit to diff against. It doesn't seem to be exposed anywhere
|
# 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 = [
|
lint_cmd = [
|
||||||
'scripts/lint_clang_format.sh',
|
'scripts/lint_clang_format.sh',
|
||||||
'third_party/clang-format/clang-format',
|
clang_format_path,
|
||||||
upstream_commit
|
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
|
# Call the linting script and forward the output as a notification or as an error
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(lint_cmd, env=env);
|
output = subprocess.check_output(lint_cmd)
|
||||||
return [output_api.PresubmitNotifyResult(output)]
|
return [output_api.PresubmitNotifyResult(output)]
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
return [output_api.PresubmitError(e.output)]
|
return [output_api.PresubmitError(e.output)]
|
||||||
|
|
Loading…
Reference in New Issue