Adding pre-submit check to avoid usage of public_deps in the future.
Example of an error: ** Presubmit ERRORS ** public_deps is not allowed in WebRTC BUILD.gn files because it doesn't map well to downstream build systems. Used in: call/BUILD.gn (line 12). Bug: webrtc:8603 Change-Id: I3b785b295ffb018cb9dfc2e14ae816d3e5e29a69 No-Try: True Reviewed-on: https://webrtc-review.googlesource.com/30262 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21224}
This commit is contained in:

committed by
Commit Bot

parent
f39659cb26
commit
5c1ad597c8
16
PRESUBMIT.py
16
PRESUBMIT.py
@ -405,10 +405,23 @@ def CheckNoPackageBoundaryViolations(input_api, gn_files, output_api):
|
||||
long_text='\n\n'.join(str(err) for err in errors))]
|
||||
return []
|
||||
|
||||
def CheckPublicDepsIsNotUsed(gn_files, output_api):
|
||||
result = []
|
||||
error_msg = ('public_deps is not allowed in WebRTC BUILD.gn files because '
|
||||
'it doesn\'t map well to downstream build systems.\n'
|
||||
'Used in: %s (line %d).')
|
||||
for affected_file in gn_files:
|
||||
for (line_number, affected_line) in affected_file.ChangedContents():
|
||||
if 'public_deps' in affected_line:
|
||||
result.append(
|
||||
output_api.PresubmitError(error_msg % (affected_file.LocalPath(),
|
||||
line_number)))
|
||||
return result
|
||||
|
||||
def CheckGnChanges(input_api, output_api):
|
||||
source_file_filter = lambda x: input_api.FilterSourceFile(
|
||||
x, white_list=(r'.+\.(gn|gni)$',),
|
||||
black_list=r'.*/presubmit_checks_lib/testdata/.*')
|
||||
black_list=(r'.*/presubmit_checks_lib/testdata/.*',))
|
||||
|
||||
gn_files = []
|
||||
for f in input_api.AffectedSourceFiles(source_file_filter):
|
||||
@ -420,6 +433,7 @@ def CheckGnChanges(input_api, output_api):
|
||||
result.extend(CheckNoMixingSources(input_api, gn_files, output_api))
|
||||
result.extend(CheckNoPackageBoundaryViolations(input_api, gn_files,
|
||||
output_api))
|
||||
result.extend(CheckPublicDepsIsNotUsed(gn_files, output_api))
|
||||
return result
|
||||
|
||||
def CheckGnGen(input_api, output_api):
|
||||
|
Reference in New Issue
Block a user