| 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(
|
|
|