Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/inspector/PRESUBMIT.py

Issue 2354263003: [inspector] add presubmit.py to compile inspector-related scripts (Closed)
Patch Set: addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/inspector/build/check_injected_script_source.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2016 the V8 project authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """v8_inspect presubmit script
8
9 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
10 for more details about the presubmit API built into gcl.
11 """
12
13 compile_note = "Be sure to run your patch by the compile-scripts.py script prior to committing!"
14
15
16 def _CompileScripts(input_api, output_api):
17 local_paths = [f.LocalPath() for f in input_api.AffectedFiles()]
18
19 compilation_related_files = [
20 "js_protocol.json"
21 "compile-scripts.js",
22 "injected-script-source.js",
23 "debugger_script_externs.js",
24 "injected_script_externs.js",
25 "check_injected_script_source.js",
26 "debugger-script.js"
27 ]
28
29 for file in compilation_related_files:
30 if (any(file in path for path in local_paths)):
31 script_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
32 "build", "compile-scripts.py")
33 proc = input_api.subprocess.Popen(
34 [input_api.python_executable, script_path],
35 stdout=input_api.subprocess.PIPE,
36 stderr=input_api.subprocess.STDOUT)
37 out, _ = proc.communicate()
38 if "ERROR" in out or "WARNING" in out or proc.returncode:
39 return [output_api.PresubmitError(out)]
40 if "NOTE" in out:
41 return [output_api.PresubmitPromptWarning(out + compile_note)]
42 return []
43 return []
44
45
46 def CheckChangeOnUpload(input_api, output_api):
47 results = []
48 results.extend(_CompileScripts(input_api, output_api))
49 return results
50
51
52 def CheckChangeOnCommit(input_api, output_api):
53 results = []
54 results.extend(_CompileScripts(input_api, output_api))
55 return results
OLDNEW
« no previous file with comments | « no previous file | src/inspector/build/check_injected_script_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698