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

Unified Diff: PRESUBMIT.py

Issue 2179113002: Mojo C++ bindings: add a presubmit check to disallow adding new mojom targets with use_new_wrapper_… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 2fad49d17a0218adb806f415e9ff3f74b1f63e42..2eb9eec6c84423886bab29117a84fba51e9ffd48 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1498,6 +1498,32 @@ def _CheckIpcOwners(input_api, output_api):
return results
+def _CheckMojoUsesNewWrapperTypes(input_api, output_api):
+ """Checks to make sure that all newly added mojom targets map array/map/string
+ to STL (for chromium) or WTF (for blink) types.
+ TODO(yzshen): remove this check once crbug.com/624136 is completed.
+ """
+ files = []
+ pattern = input_api.re.compile(r'use_new_wrapper_types.*false',
+ input_api.re.MULTILINE)
+
+ for f in input_api.AffectedFiles():
+ if not f.LocalPath().endswith(('.gyp', '.gypi', 'gn', 'gni')):
+ continue
+
+ for _, line in f.ChangedContents():
+ if pattern.search(line):
+ files.append(f)
+ break
+
+ if len(files):
+ return [output_api.PresubmitError(
+ 'Do not introduce new mojom targets with use_new_wrapper_types set to '
+ 'false. The mode is deprecated and will be removed soon.',
+ files)]
+ return []
+
+
def _CheckAndroidToastUsage(input_api, output_api):
"""Checks that code uses org.chromium.ui.widget.Toast instead of
android.widget.Toast (Chromium Toast doesn't force hardware
@@ -1962,6 +1988,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckPydepsNeedsUpdating(input_api, output_api))
results.extend(_CheckJavaStyle(input_api, output_api))
results.extend(_CheckIpcOwners(input_api, output_api))
+ results.extend(_CheckMojoUsesNewWrapperTypes(input_api, output_api))
if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
« 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