Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: PRESUBMIT.py

Issue 2065253003: PRESUBMIT: Fix bug in sources-above-target check. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license 3 # Use of this source code is governed by a BSD-style license
4 # that can be found in the LICENSE file in the root of the source 4 # that can be found in the LICENSE file in the root of the source
5 # tree. An additional intellectual property rights grant can be found 5 # tree. An additional intellectual property rights grant can be found
6 # in the file PATENTS. All contributing project authors may 6 # in the file PATENTS. All contributing project authors may
7 # be found in the AUTHORS file in the root of the source tree. 7 # be found in the AUTHORS file in the root of the source tree.
8 8
9 import json 9 import json
10 import os 10 import os
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 if violating_files: 250 if violating_files:
251 return [output_api.PresubmitError( 251 return [output_api.PresubmitError(
252 'Depending on rtc_base is not allowed. Change your dependency to ' 252 'Depending on rtc_base is not allowed. Change your dependency to '
253 'rtc_base_approved and possibly sanitize and move the desired source ' 253 'rtc_base_approved and possibly sanitize and move the desired source '
254 'file(s) to rtc_base_approved.\nChanged GYP files:', 254 'file(s) to rtc_base_approved.\nChanged GYP files:',
255 items=violating_files)] 255 items=violating_files)]
256 return [] 256 return []
257 257
258 def _CheckNoSourcesAboveGyp(input_api, gyp_files, output_api): 258 def _CheckNoSourcesAboveGyp(input_api, gyp_files, output_api):
259 # Disallow referencing source files with paths above the GYP file location. 259 # Disallow referencing source files with paths above the GYP file location.
260 source_pattern = input_api.re.compile(r'sources.*?\[(.*?)\]', 260 source_pattern = input_api.re.compile(r'\'sources\'.*?\[(.*?)\]',
261 re.MULTILINE | re.DOTALL) 261 re.MULTILINE | re.DOTALL)
262 file_pattern = input_api.re.compile(r"'((\.\./.*?)|(<\(webrtc_root\).*?))'") 262 file_pattern = input_api.re.compile(r"'((\.\./.*?)|(<\(webrtc_root\).*?))'")
263 violating_gyp_files = set() 263 violating_gyp_files = set()
264 violating_source_entries = [] 264 violating_source_entries = []
265 for gyp_file in gyp_files: 265 for gyp_file in gyp_files:
266 if 'supplement.gypi' in gyp_file.LocalPath(): 266 if 'supplement.gypi' in gyp_file.LocalPath():
267 # Exclude supplement.gypi from this check, as the LSan and TSan 267 # Exclude supplement.gypi from this check, as the LSan and TSan
268 # suppression files are located in a different location. 268 # suppression files are located in a different location.
269 continue 269 continue
270 contents = input_api.ReadFile(gyp_file) 270 contents = input_api.ReadFile(gyp_file)
271 for source_block_match in source_pattern.finditer(contents): 271 for source_block_match in source_pattern.finditer(contents):
272 # Find all source list entries starting with ../ in the source block 272 # Find all source list entries starting with ../ in the source block
273 # (exclude overrides entries). 273 # (exclude overrides entries).
274 for file_list_match in file_pattern.finditer(source_block_match.group(0)): 274 for file_list_match in file_pattern.finditer(source_block_match.group(1)):
275 source_file = file_list_match.group(0) 275 source_file = file_list_match.group(1)
276 if 'overrides/' not in source_file: 276 if 'overrides/' not in source_file:
277 violating_source_entries.append(source_file) 277 violating_source_entries.append(source_file)
278 violating_gyp_files.add(gyp_file) 278 violating_gyp_files.add(gyp_file)
279 if violating_gyp_files: 279 if violating_gyp_files:
280 return [output_api.PresubmitError( 280 return [output_api.PresubmitError(
281 'Referencing source files above the directory of the GYP file is not ' 281 'Referencing source files above the directory of the GYP file is not '
282 'allowed. Please introduce new GYP targets and/or GYP files in the ' 282 'allowed. Please introduce new GYP targets and/or GYP files in the '
283 'proper location instead.\n' 283 'proper location instead.\n'
284 'Invalid source entries:\n' 284 'Invalid source entries:\n'
285 '%s\n' 285 '%s\n'
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 for builder in masters[master]: 535 for builder in masters[master]:
536 if 'presubmit' in builder: 536 if 'presubmit' in builder:
537 # Do not trigger presubmit builders, since they're likely to fail 537 # Do not trigger presubmit builders, since they're likely to fail
538 # (e.g. OWNERS checks before finished code review), and we're running 538 # (e.g. OWNERS checks before finished code review), and we're running
539 # local presubmit anyway. 539 # local presubmit anyway.
540 pass 540 pass
541 else: 541 else:
542 try_config[master][builder] = ['defaulttests'] 542 try_config[master][builder] = ['defaulttests']
543 543
544 return try_config 544 return try_config
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698