Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 if (any("js_protocol.json" in path for path in local_paths) or | |
| 19 any("compile-scripts.py" in path for path in local_paths) or | |
| 20 any("InjectedScriptSource.js" in path for path in local_paths) or | |
| 21 any("debugger_script_exters.js" in path for path in local_paths) or | |
|
dgozman
2016/09/22 16:50:00
typo: exter_n_s
kozy
2016/09/23 20:22:46
Done.
| |
| 22 any("injected_script_externs.js" in path for path in local_paths) or | |
| 23 any("DebuggerScript.js" in path for path in local_paths)): | |
| 24 lint_path = input_api.os_path.join(input_api.PresubmitLocalPath(), | |
| 25 "build", "compile-scripts.py") | |
| 26 out, _ = input_api.subprocess.Popen( | |
| 27 [input_api.python_executable, lint_path], | |
| 28 stdout=input_api.subprocess.PIPE, | |
| 29 stderr=input_api.subprocess.STDOUT).communicate() | |
| 30 if "ERROR" in out or "WARNING" in out: | |
| 31 return [output_api.PresubmitError(out)] | |
| 32 if "NOTE" in out: | |
| 33 return [output_api.PresubmitPromptWarning(out + compile_note)] | |
| 34 return [] | |
| 35 | |
| 36 | |
| 37 def CheckChangeOnUpload(input_api, output_api): | |
| 38 results = [] | |
| 39 results.extend(_CompileScripts(input_api, output_api)) | |
| 40 return results | |
| 41 | |
| 42 | |
| 43 def CheckChangeOnCommit(input_api, output_api): | |
| 44 results = [] | |
| 45 results.extend(_CompileScripts(input_api, output_api)) | |
|
dgozman
2016/09/22 16:50:00
Running on commit requires bots to have java, righ
kozy
2016/09/23 20:22:46
Removed.
| |
| 46 return results | |
| OLD | NEW |