Presubmit: Don't forget to warn when changing headers in subdirs of api/

Unlike all the other API directories, api/ is the root of an entire
tree of directories that are also API directories.

BUG=webrtc:8445

Change-Id: I218befe6fb6113b95599512f062ebe63abc98889
Reviewed-on: https://webrtc-review.googlesource.com/15321
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20427}
This commit is contained in:
Karl Wiberg
2017-10-25 13:20:03 +02:00
committed by Commit Bot
parent d71997941a
commit ef52d8b859

View File

@ -62,7 +62,7 @@ BLACKLIST_LINT_FILTERS = [
# webrtc-users@google.com (internal list).
# 4. (later) The deprecated APIs are removed.
NATIVE_API_DIRS = (
'api',
'api', # All subdirectories of api/ are included as well.
'media',
'modules/audio_device/include',
'pc',
@ -160,8 +160,15 @@ def CheckNativeApiHeaderChanges(input_api, output_api):
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
if f.LocalPath().endswith('.h'):
for path in API_DIRS:
if os.path.dirname(f.LocalPath()) == path:
files.append(f)
dn = os.path.dirname(f.LocalPath())
if path == 'api':
# Special case: Subdirectories included.
if dn == 'api' or dn.startswith('api/'):
files.append(f)
else:
# Normal case: Subdirectories not included.
if dn == path:
files.append(f)
if files:
return [output_api.PresubmitNotifyResult(API_CHANGE_MSG, files)]