Skip to content

Commit e8db96e

Browse files
wwwillchenCommit bot
authored and
Commit bot
committed
DevTools: add PRESUBMIT hook for browser_protocol.json in Source/core/inspector
Previously, if you only changed browser_protocol.json, there would be no PRESUBMIT hook that ran closure compiler. This simplifies the logic in Source/devtools so it always runs closure compiler. It's much faster now and the previous way of whitelisting files made it error-prone. BUG=none Review-Url: https://codereview.chromium.org/2699803005 Cr-Original-Commit-Position: refs/heads/master@{#451508} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 202dea0022d76d633088ca326452b87b69da768c
1 parent 1230067 commit e8db96e

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

PRESUBMIT.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
from collections import namedtuple
3535
import sys
3636

37-
compile_note = "Be sure to run your patch by the compile_frontend.py script prior to committing!"
38-
3937
CheckOutput = namedtuple('CheckOutput', ['results', 'has_errors'])
4038

4139

@@ -112,26 +110,14 @@ def _CheckDevtoolsStyle(input_api, output_api):
112110

113111

114112
def _CompileDevtoolsFrontend(input_api, output_api):
115-
local_paths = [f.LocalPath() for f in input_api.AffectedFiles()]
116-
117-
# FIXME: The compilation does not actually run if injected script-related files
118-
# have changed, as they reside in core/inspector, which is not affected
119-
# by this presubmit.
120-
# Once this is fixed, injected_script_externs.js
121-
# should be added to the list of triggers.
122-
devtools_front_end = input_api.os_path.join("devtools", "front_end")
123-
if (any(devtools_front_end in path for path in local_paths) or any("_protocol.json" in path for path in local_paths) or
124-
any("compile_frontend.py" in path for path in local_paths) or any("InjectedScriptSource.js" in path
125-
for path in local_paths) or
126-
any("DebuggerScript.js" in path for path in local_paths)):
127-
lint_path = input_api.os_path.join(input_api.PresubmitLocalPath(), "scripts", "compile_frontend.py")
128-
out, _ = input_api.subprocess.Popen(
129-
[input_api.python_executable, lint_path], stdout=input_api.subprocess.PIPE,
130-
stderr=input_api.subprocess.STDOUT).communicate()
131-
if "ERROR" in out or "WARNING" in out:
132-
return [output_api.PresubmitError(out)]
133-
if "NOTE" in out:
134-
return [output_api.PresubmitPromptWarning(out + compile_note)]
113+
compile_path = input_api.os_path.join(input_api.PresubmitLocalPath(), "scripts", "compile_frontend.py")
114+
out, _ = input_api.subprocess.Popen(
115+
[input_api.python_executable, compile_path], stdout=input_api.subprocess.PIPE,
116+
stderr=input_api.subprocess.STDOUT).communicate()
117+
if "ERROR" in out or "WARNING" in out:
118+
return [output_api.PresubmitError(out)]
119+
if "NOTE" in out:
120+
return [output_api.PresubmitPromptWarning(out)]
135121
return []
136122

137123

0 commit comments

Comments
 (0)