| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import sys | 6 import sys |
| 7 import subprocess | 7 import subprocess |
| 8 | 8 |
| 9 def CheckChange(input_api, output_api): | 9 def CheckChange(input_api, output_api): |
| 10 results = [] | 10 results = [] |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 results.append( | 40 results.append( |
| 41 output_api.PresubmitPromptWarning('Missing matching PPAPI definition:', | 41 output_api.PresubmitPromptWarning('Missing matching PPAPI definition:', |
| 42 long_text='\n'.join(missing))) | 42 long_text='\n'.join(missing))) |
| 43 | 43 |
| 44 # Verify all *.h files match *.idl definitions, use: | 44 # Verify all *.h files match *.idl definitions, use: |
| 45 # --test to prevent output to disk | 45 # --test to prevent output to disk |
| 46 # --diff to generate a unified diff | 46 # --diff to generate a unified diff |
| 47 # --out to pick which files to examine (only the ones in the CL) | 47 # --out to pick which files to examine (only the ones in the CL) |
| 48 ppapi_dir = input_api.PresubmitLocalPath() | 48 ppapi_dir = input_api.PresubmitLocalPath() |
| 49 cmd = [ sys.executable, 'generator.py', | 49 cmd = [ sys.executable, 'generator.py', |
| 50 '--wnone', '--diff', '--test','--cgen', '--range=M13,M16'] | 50 '--wnone', '--diff', '--test','--cgen', '--range=M13,M17'] |
| 51 | 51 |
| 52 # Only generate output for IDL files references (as *.h or *.idl) in this CL | 52 # Only generate output for IDL files references (as *.h or *.idl) in this CL |
| 53 cmd.append('--out=' + ','.join([name + '.idl' for name in both])) | 53 cmd.append('--out=' + ','.join([name + '.idl' for name in both])) |
| 54 | 54 |
| 55 p = subprocess.Popen(cmd, cwd=os.path.join(ppapi_dir, 'generators'), | 55 p = subprocess.Popen(cmd, cwd=os.path.join(ppapi_dir, 'generators'), |
| 56 stdout=subprocess.PIPE, | 56 stdout=subprocess.PIPE, |
| 57 stderr=subprocess.PIPE) | 57 stderr=subprocess.PIPE) |
| 58 (p_stdout, p_stderr) = p.communicate() | 58 (p_stdout, p_stderr) = p.communicate() |
| 59 if p.returncode: | 59 if p.returncode: |
| 60 results.append( | 60 results.append( |
| 61 output_api.PresubmitError('PPAPI IDL Diff detected: Run the generator.', | 61 output_api.PresubmitError('PPAPI IDL Diff detected: Run the generator.', |
| 62 long_text=p_stderr)) | 62 long_text=p_stderr)) |
| 63 return results | 63 return results |
| 64 | 64 |
| 65 def CheckChangeOnUpload(input_api, output_api): | 65 def CheckChangeOnUpload(input_api, output_api): |
| 66 # return [] | 66 # return [] |
| 67 return CheckChange(input_api, output_api) | 67 return CheckChange(input_api, output_api) |
| 68 | 68 |
| 69 def CheckChangeOnCommit(input_api, output_api): | 69 def CheckChangeOnCommit(input_api, output_api): |
| 70 # return [] | 70 # return [] |
| 71 return CheckChange(input_api, output_api) | 71 return CheckChange(input_api, output_api) |
| 72 | |
| OLD | NEW |