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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Top-level presubmit script for Chromium. 5 """Top-level presubmit script for Chromium.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools. 8 for more details about the presubmit API built into depot_tools.
9 """ 9 """
10 10
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 output = output_api.PresubmitError 1491 output = output_api.PresubmitError
1492 else: 1492 else:
1493 output = output_api.PresubmitPromptWarning 1493 output = output_api.PresubmitPromptWarning
1494 results.append(output( 1494 results.append(output(
1495 'Found changes to IPC files without a security OWNER!', 1495 'Found changes to IPC files without a security OWNER!',
1496 long_text='\n\n'.join(errors))) 1496 long_text='\n\n'.join(errors)))
1497 1497
1498 return results 1498 return results
1499 1499
1500 1500
1501 def _CheckMojoUsesNewWrapperTypes(input_api, output_api):
1502 """Checks to make sure that all newly added mojom targets map array/map/string
1503 to STL (for chromium) or WTF (for blink) types.
1504 TODO(yzshen): remove this check once crbug.com/624136 is completed.
1505 """
1506 files = []
1507 pattern = input_api.re.compile(r'use_new_wrapper_types.*false',
1508 input_api.re.MULTILINE)
1509
1510 for f in input_api.AffectedFiles():
1511 if not f.LocalPath().endswith(('.gyp', '.gypi', 'gn', 'gni')):
1512 continue
1513
1514 for _, line in f.ChangedContents():
1515 if pattern.search(line):
1516 files.append(f)
1517 break
1518
1519 if len(files):
1520 return [output_api.PresubmitError(
1521 'Do not introduce new mojom targets with use_new_wrapper_types set to '
1522 'false. The mode is deprecated and will be removed soon.',
1523 files)]
1524 return []
1525
1526
1501 def _CheckAndroidToastUsage(input_api, output_api): 1527 def _CheckAndroidToastUsage(input_api, output_api):
1502 """Checks that code uses org.chromium.ui.widget.Toast instead of 1528 """Checks that code uses org.chromium.ui.widget.Toast instead of
1503 android.widget.Toast (Chromium Toast doesn't force hardware 1529 android.widget.Toast (Chromium Toast doesn't force hardware
1504 acceleration on low-end devices, saving memory). 1530 acceleration on low-end devices, saving memory).
1505 """ 1531 """
1506 toast_import_pattern = input_api.re.compile( 1532 toast_import_pattern = input_api.re.compile(
1507 r'^import android\.widget\.Toast;$') 1533 r'^import android\.widget\.Toast;$')
1508 1534
1509 errors = [] 1535 errors = []
1510 1536
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 results.extend(_CheckNoDeprecatedJS(input_api, output_api)) 1981 results.extend(_CheckNoDeprecatedJS(input_api, output_api))
1956 results.extend(_CheckParseErrors(input_api, output_api)) 1982 results.extend(_CheckParseErrors(input_api, output_api))
1957 results.extend(_CheckForIPCRules(input_api, output_api)) 1983 results.extend(_CheckForIPCRules(input_api, output_api))
1958 results.extend(_CheckForCopyrightedCode(input_api, output_api)) 1984 results.extend(_CheckForCopyrightedCode(input_api, output_api))
1959 results.extend(_CheckForWindowsLineEndings(input_api, output_api)) 1985 results.extend(_CheckForWindowsLineEndings(input_api, output_api))
1960 results.extend(_CheckSingletonInHeaders(input_api, output_api)) 1986 results.extend(_CheckSingletonInHeaders(input_api, output_api))
1961 results.extend(_CheckNoDeprecatedCompiledResourcesGYP(input_api, output_api)) 1987 results.extend(_CheckNoDeprecatedCompiledResourcesGYP(input_api, output_api))
1962 results.extend(_CheckPydepsNeedsUpdating(input_api, output_api)) 1988 results.extend(_CheckPydepsNeedsUpdating(input_api, output_api))
1963 results.extend(_CheckJavaStyle(input_api, output_api)) 1989 results.extend(_CheckJavaStyle(input_api, output_api))
1964 results.extend(_CheckIpcOwners(input_api, output_api)) 1990 results.extend(_CheckIpcOwners(input_api, output_api))
1991 results.extend(_CheckMojoUsesNewWrapperTypes(input_api, output_api))
1965 1992
1966 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): 1993 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
1967 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( 1994 results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
1968 input_api, output_api, 1995 input_api, output_api,
1969 input_api.PresubmitLocalPath(), 1996 input_api.PresubmitLocalPath(),
1970 whitelist=[r'^PRESUBMIT_test\.py$'])) 1997 whitelist=[r'^PRESUBMIT_test\.py$']))
1971 return results 1998 return results
1972 1999
1973 2000
1974 def _CheckAuthorizedAuthor(input_api, output_api): 2001 def _CheckAuthorizedAuthor(input_api, output_api):
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 results.extend(input_api.canned_checks.CheckTreeIsOpen( 2247 results.extend(input_api.canned_checks.CheckTreeIsOpen(
2221 input_api, 2248 input_api,
2222 output_api, 2249 output_api,
2223 json_url='http://chromium-status.appspot.com/current?format=json')) 2250 json_url='http://chromium-status.appspot.com/current?format=json'))
2224 2251
2225 results.extend(input_api.canned_checks.CheckChangeHasBugField( 2252 results.extend(input_api.canned_checks.CheckChangeHasBugField(
2226 input_api, output_api)) 2253 input_api, output_api))
2227 results.extend(input_api.canned_checks.CheckChangeHasDescription( 2254 results.extend(input_api.canned_checks.CheckChangeHasDescription(
2228 input_api, output_api)) 2255 input_api, output_api))
2229 return results 2256 return results
OLDNEW
« 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