Commit 74f7a26d authored by Alexander Schulze's avatar Alexander Schulze Committed by V8 LUCI CQ

[presubmit] Use DEPS version of depot tools

Currently, v8_presubmit uses the system version of depot_tools for C++
and JS linting. This is an issue for branches which rely on a specific
depot_tools version for linting. This CL proposes the use of the
depot_tools version defined in DEPS.

This change was evaluated in https://crrev.com/c/3571813. The first
v8_presubmit attempt uses the system-defined depot_tools version, while
the second attempt is rebased on this CL and uses the DEPS defined
version.

Bug: v8:12743
Change-Id: I87e14ea5c1e3dc20b34106ff56f608d55ec3253d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3571805Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Alexander Schulze <alexschulze@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79828}
parent 4e45eed9
......@@ -78,6 +78,9 @@ ASSERT_UNOPTIMIZED_PATTERN = re.compile("assertUnoptimized")
FLAGS_NO_ALWAYS_OPT = re.compile("//\s*Flags:.*--no-?always-opt.*\n")
TOOLS_PATH = dirname(abspath(__file__))
DEPS_DEPOT_TOOLS_PATH = abspath(
join(TOOLS_PATH, '..', 'third_party', 'depot_tools'))
def CppLintWorker(command):
try:
......@@ -106,7 +109,7 @@ def CppLintWorker(command):
process.kill()
except:
print('Error running cpplint.py. Please make sure you have depot_tools' +
' in your $PATH. Lint check skipped.')
' in your third_party directory. Lint check skipped.')
process.kill()
def TorqueLintWorker(command):
......@@ -153,8 +156,9 @@ def JSLintWorker(command):
except KeyboardInterrupt:
process.kill()
except Exception:
print('Error running clang-format. Please make sure you have depot_tools' +
' in your $PATH. Lint check skipped.')
print(
'Error running clang-format. Please make sure you have depot_tools' +
' in your third_party directory. Lint check skipped.')
process.kill()
rc = format_file(command)
......@@ -387,13 +391,9 @@ class CppLintProcessor(CacheableSourceFileProcessor):
def GetProcessorScript(self):
filters = ','.join([n for n in LINT_RULES])
arguments = ['--filter', filters]
for path in [TOOLS_PATH] + os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
cpplint = os.path.join(path, 'cpplint.py')
if os.path.isfile(cpplint):
return cpplint, arguments
return None, arguments
cpplint = os.path.join(DEPS_DEPOT_TOOLS_PATH, 'cpplint.py')
return cpplint, arguments
class TorqueLintProcessor(CacheableSourceFileProcessor):
......@@ -445,13 +445,9 @@ class JSLintProcessor(CacheableSourceFileProcessor):
return JSLintWorker
def GetProcessorScript(self):
for path in [TOOLS_PATH] + os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
clang_format = os.path.join(path, 'clang_format.py')
if os.path.isfile(clang_format):
return clang_format, []
jslint = os.path.join(DEPS_DEPOT_TOOLS_PATH, 'clang_format.py')
return jslint, []
return None, []
COPYRIGHT_HEADER_PATTERN = re.compile(
r'Copyright [\d-]*20[0-2][0-9] the V8 project authors. All rights reserved.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment