Add possibility to skip check_includes presubmit check.
Bug: webrtc:9419 Change-Id: I0fd8fb37cd2d000f0e1f488bf98d39b5ee5e9305 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157963 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29576}
This commit is contained in:

committed by
Commit Bot

parent
33678af88d
commit
05691ddbd2
@ -539,7 +539,7 @@ def CheckPublicDepsIsNotUsed(gn_files, input_api, output_api):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def CheckCheckIncludesIsNotUsed(gn_files, output_api):
|
def CheckCheckIncludesIsNotUsed(gn_files, input_api, output_api):
|
||||||
result = []
|
result = []
|
||||||
error_msg = ('check_includes overrides are not allowed since it can cause '
|
error_msg = ('check_includes overrides are not allowed since it can cause '
|
||||||
'incorrect dependencies to form. It effectively means that your '
|
'incorrect dependencies to form. It effectively means that your '
|
||||||
@ -548,9 +548,12 @@ def CheckCheckIncludesIsNotUsed(gn_files, output_api):
|
|||||||
'this is allowed: if so, get approval from a .gn owner in the '
|
'this is allowed: if so, get approval from a .gn owner in the '
|
||||||
'root OWNERS file.\n'
|
'root OWNERS file.\n'
|
||||||
'Used in: %s (line %d).')
|
'Used in: %s (line %d).')
|
||||||
|
no_presubmit_re = input_api.re.compile(
|
||||||
|
r'# no-presubmit-check TODO\(bugs\.webrtc\.org/\d+\)')
|
||||||
for affected_file in gn_files:
|
for affected_file in gn_files:
|
||||||
for (line_number, affected_line) in affected_file.ChangedContents():
|
for (line_number, affected_line) in affected_file.ChangedContents():
|
||||||
if 'check_includes' in affected_line:
|
if ('check_includes' in affected_line
|
||||||
|
and not no_presubmit_re.search(affected_line)):
|
||||||
result.append(
|
result.append(
|
||||||
output_api.PresubmitError(error_msg % (affected_file.LocalPath(),
|
output_api.PresubmitError(error_msg % (affected_file.LocalPath(),
|
||||||
line_number)))
|
line_number)))
|
||||||
@ -573,7 +576,7 @@ def CheckGnChanges(input_api, output_api):
|
|||||||
result.extend(CheckNoPackageBoundaryViolations(input_api, gn_files,
|
result.extend(CheckNoPackageBoundaryViolations(input_api, gn_files,
|
||||||
output_api))
|
output_api))
|
||||||
result.extend(CheckPublicDepsIsNotUsed(gn_files, input_api, output_api))
|
result.extend(CheckPublicDepsIsNotUsed(gn_files, input_api, output_api))
|
||||||
result.extend(CheckCheckIncludesIsNotUsed(gn_files, output_api))
|
result.extend(CheckCheckIncludesIsNotUsed(gn_files, input_api, output_api))
|
||||||
result.extend(CheckNoWarningSuppressionFlagsAreAdded(gn_files, input_api,
|
result.extend(CheckNoWarningSuppressionFlagsAreAdded(gn_files, input_api,
|
||||||
output_api))
|
output_api))
|
||||||
return result
|
return result
|
||||||
|
Reference in New Issue
Block a user