.gn files in the API directories are part of the API too...
...since we can break users by changing the build targets they're
using.
BUG=webrtc:8445
Change-Id: Iaa549ce9802bd99639d8b966807ae2db43e7f14b
Reviewed-on: https://webrtc-review.googlesource.com/16460
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20471}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index c72fc19..a6d41c6 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -157,18 +157,19 @@
def CheckNativeApiHeaderChanges(input_api, output_api):
"""Checks to remind proper changing of native APIs."""
files = []
- for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
- if f.LocalPath().endswith('.h'):
- for path in API_DIRS:
- 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)
+ source_file_filter = lambda x: input_api.FilterSourceFile(
+ x, white_list=[r'.+\.(gn|gni|h)$'])
+ for f in input_api.AffectedSourceFiles(source_file_filter):
+ for path in API_DIRS:
+ 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)]