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

Unified Diff: base/PRESUBMIT.py

Issue 10554009: Simplify PRESUBMITs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/PRESUBMIT.py
diff --git a/base/PRESUBMIT.py b/base/PRESUBMIT.py
index 6b04b8262ab5061a2b0289d8a05f92c65ab747e9..7d6fc0944af02fad150f2d7408d12a45c6d69df2 100644
--- a/base/PRESUBMIT.py
+++ b/base/PRESUBMIT.py
@@ -8,6 +8,44 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into gcl.
"""
+def _CheckNoInterfacesInBase(input_api, output_api):
+ """Checks to make sure no files in libbase.a have |@interface|."""
+ pattern = input_api.re.compile(r'^\s*@interface', input_api.re.MULTILINE)
+ files = []
+ for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
+ if (f.LocalPath().startswith('base/') and
+ not f.LocalPath().endswith('_unittest.mm')):
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
+ files.append(f)
+
+ if len(files):
+ return [ output_api.PresubmitError(
+ 'Objective-C interfaces or categories are forbidden in libbase. ' +
+ 'See http://groups.google.com/a/chromium.org/group/chromium-dev/' +
+ 'browse_thread/thread/efb28c10435987fd',
+ files) ]
+ return []
+
+
+def _CommonChecks(input_api, output_api):
+ """Checks common to both upload and commit."""
+ results = []
+ results.extend(_CheckNoInterfacesInBase(input_api, output_api))
+ return results
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ results.extend(_CommonChecks(input_api, output_api))
+ return results
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ results = []
+ results.extend(_CommonChecks(input_api, output_api))
+ return results
+
+
def GetPreferredTrySlaves():
return [
'linux_rel:sync_integration_tests',
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698