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

Unified Diff: ppapi/PRESUBMIT.py

Issue 10443119: Add presubmit check for unversioned PPB interface macros in C++ wrappers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase & address review comments. Created 8 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/PRESUBMIT.py
diff --git a/ppapi/PRESUBMIT.py b/ppapi/PRESUBMIT.py
index 20d9e6c27fe41c5ab685ed64d767405f42336c0a..b350003a0b06eb77438c429efa16e85861e313f7 100644
--- a/ppapi/PRESUBMIT.py
+++ b/ppapi/PRESUBMIT.py
@@ -91,6 +91,37 @@ def CheckTODO(input_api, output_api):
long_text='\n'.join(todo))]
return []
+# Verify that no CPP wrappers use un-versioned PPB interface name macros.
+RE_UNVERSIONED_PPB = re.compile(r'\bPPB_\w+_INTERFACE\b')
+def CheckUnversionedPPB(input_api, output_api):
+ files = input_api.LocalPaths()
+ todo = []
+
+ for filename in files:
+ name, ext = os.path.splitext(filename)
+ name_parts = name.split(os.sep)
+
+ # Only check C++ sources.
+ if ext not in ['.cc']:
+ continue
+
+ # Only examine the public plugin facing ppapi/cpp directory.
+ if name_parts[0:2] != ['ppapi', 'cpp']:
+ continue
+
+ # Only examine public stable and trusted interfaces.
+ if name_parts[2] in ['dev', 'private']:
+ continue
+
+ filepath = os.path.join('..', filename)
+ if RE_UNVERSIONED_PPB.search(open(filepath, 'rb').read()):
+ todo.append(filename)
+
+ if todo:
+ return [output_api.PresubmitError(
+ 'Unversioned PPB interface references found in PPAPI C++ wrappers:',
+ long_text='\n'.join(todo))]
+ return []
def CheckChange(input_api, output_api):
results = []
@@ -100,6 +131,9 @@ def CheckChange(input_api, output_api):
results.extend(RunUnittests(input_api, output_api))
results.extend(CheckTODO(input_api, output_api))
+
+ results.extend(CheckUnversionedPPB(input_api, output_api))
+
# Verify all modified *.idl have a matching *.h
files = input_api.LocalPaths()
h_files = []
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698