aboutsummaryrefslogtreecommitdiff
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authorMirko Bonadei <mbonadei@webrtc.org>2017-12-12 11:52:27 +0100
committerCommit Bot <commit-bot@chromium.org>2017-12-12 10:57:27 +0000
commit5c1ad597c881c2484cb6b55a97d89cd30d7a080c (patch)
tree8771e7b6deebe5216c46ec6df82a11b2b72b5311 /PRESUBMIT.py
parentf39659cb26c75078c4280bcda04e14acf8e22ae4 (diff)
downloadwebrtc-5c1ad597c881c2484cb6b55a97d89cd30d7a080c.tar.gz
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}
Diffstat (limited to 'PRESUBMIT.py')
-rwxr-xr-xPRESUBMIT.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index ea7c6a2b9d..5b554b8187 100755
--- a/PRESUBMIT.py
+++ b/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):