Index: src/inspector/PRESUBMIT.py |
diff --git a/src/inspector/PRESUBMIT.py b/src/inspector/PRESUBMIT.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2e54d81b0eff6bd5bd3669a32cb130dfdf7d845e |
--- /dev/null |
+++ b/src/inspector/PRESUBMIT.py |
@@ -0,0 +1,46 @@ |
+#!/usr/bin/env python |
+# |
+# Copyright 2016 the V8 project authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+"""v8_inspect presubmit script |
+ |
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
+for more details about the presubmit API built into gcl. |
+""" |
+ |
+compile_note = "Be sure to run your patch by the compile-scripts.py script prior to committing!" |
+ |
+ |
+def _CompileScripts(input_api, output_api): |
+ local_paths = [f.LocalPath() for f in input_api.AffectedFiles()] |
+ if (any("js_protocol.json" in path for path in local_paths) or |
+ any("compile-scripts.py" in path for path in local_paths) or |
+ any("InjectedScriptSource.js" in path for path in local_paths) or |
+ 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.
|
+ any("injected_script_externs.js" in path for path in local_paths) or |
+ any("DebuggerScript.js" in path for path in local_paths)): |
+ lint_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
+ "build", "compile-scripts.py") |
+ out, _ = input_api.subprocess.Popen( |
+ [input_api.python_executable, lint_path], |
+ stdout=input_api.subprocess.PIPE, |
+ stderr=input_api.subprocess.STDOUT).communicate() |
+ if "ERROR" in out or "WARNING" in out: |
+ return [output_api.PresubmitError(out)] |
+ if "NOTE" in out: |
+ return [output_api.PresubmitPromptWarning(out + compile_note)] |
+ return [] |
+ |
+ |
+def CheckChangeOnUpload(input_api, output_api): |
+ results = [] |
+ results.extend(_CompileScripts(input_api, output_api)) |
+ return results |
+ |
+ |
+def CheckChangeOnCommit(input_api, output_api): |
+ results = [] |
+ 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.
|
+ return results |