Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 compile_note = "Be sure to run your patch with Source/devtools/scripts/compile_f rontend.py script prior to committing!" | |
|
dgozman
2017/02/17 01:20:18
Drop this.
chenwilliam
2017/02/17 02:17:31
Done.
| |
| 6 | |
| 7 | |
| 8 def _CompileDevtoolsFrontend(input_api, output_api): | |
| 9 # Need to get all affected files from change (not just within this subtree) | |
| 10 local_paths = [f.LocalPath() for f in input_api.change.AffectedFiles()] | |
| 11 devtools = input_api.os_path.join("third_party", "WebKit", "Source", "devtoo ls") | |
|
dgozman
2017/02/17 01:20:18
I wonder whether we should instead have a single p
chenwilliam
2017/02/17 02:17:31
I considered it and it would reduce code duplicati
| |
| 12 | |
| 13 # If a devtools file is changed, the PRESUBMIT hook in Source/devtools | |
| 14 # will run closure compiler | |
| 15 if (any("browser_protocol.json" in path for path in local_paths) and | |
| 16 all(devtools not in path for path in local_paths)): | |
| 17 compile_path = input_api.os_path.join(input_api.PresubmitLocalPath(), ". .", "..", "devtools", "scripts", "compile_frontend.py") | |
| 18 out, _ = input_api.subprocess.Popen( | |
| 19 [input_api.python_executable, compile_path], stdout=input_api.subpro cess.PIPE, | |
| 20 stderr=input_api.subprocess.STDOUT).communicate() | |
| 21 if "ERROR" in out or "WARNING" in out: | |
| 22 return [output_api.PresubmitError(out)] | |
| 23 if "NOTE" in out: | |
| 24 return [output_api.PresubmitPromptWarning(out + compile_note)] | |
| 25 return [] | |
| 26 | |
| 27 | |
| 28 def CheckChangeOnUpload(input_api, output_api): | |
| 29 results = [] | |
| 30 results.extend(_CompileDevtoolsFrontend(input_api, output_api)) | |
| 31 return results | |
| 32 | |
| 33 | |
| 34 def CheckChangeOnCommit(input_api, output_api): | |
| 35 return [] | |
| OLD | NEW |