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

Unified Diff: third_party/WebKit/Source/core/inspector/PRESUBMIT.py

Issue 2699803005: DevTools: add PRESUBMIT hook for browser_protocol.json in Source/core/inspector (Closed)
Patch Set: fix Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/PRESUBMIT.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/inspector/PRESUBMIT.py
diff --git a/third_party/WebKit/Source/core/inspector/PRESUBMIT.py b/third_party/WebKit/Source/core/inspector/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..2eb753ee5cf1993c22ce078500d877d924b0daa6
--- /dev/null
+++ b/third_party/WebKit/Source/core/inspector/PRESUBMIT.py
@@ -0,0 +1,34 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+def _CompileDevtoolsFrontend(input_api, output_api):
+ # Need to get all affected files from change (not just within this subtree)
+ local_paths = [f.LocalPath() for f in input_api.change.AffectedFiles()]
+ devtools = input_api.os_path.join("third_party", "WebKit", "Source", "devtools")
dgozman 2017/02/17 21:38:46 Let's change this to |input_api.PresubmitLocalPath
chenwilliam 2017/02/17 23:51:58 Done.
+
+ # If a devtools file is changed, the PRESUBMIT hook in Source/devtools
+ # will run closure compiler
+ if (any("browser_protocol.json" in path for path in local_paths) and
+ all(devtools not in path for path in local_paths)):
+ compile_path = input_api.os_path.join(
+ input_api.PresubmitLocalPath(), "..", "..", "devtools", "scripts", "compile_frontend.py")
+ out, _ = input_api.subprocess.Popen(
+ [input_api.python_executable, compile_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)]
+ return []
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ results.extend(_CompileDevtoolsFrontend(input_api, output_api))
+ return results
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ return []
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698