blob: 6d8f3304dd791a26a5aa05e9a5259ae331150f88 [file] [log] [blame]
andrew@webrtc.org2442de12012-01-23 17:45:41 +00001# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
2#
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
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
niklase@google.comda159d62011-05-30 11:51:34 +00008
kjellander@webrtc.orgaefe61a2014-12-08 13:00:30 +00009import os
kjellander@webrtc.org85759802013-10-22 16:47:40 +000010import re
kjellander@webrtc.org3bd41562014-09-01 11:06:37 +000011import sys
kjellander@webrtc.org85759802013-10-22 16:47:40 +000012
13
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000014def _CheckNoIOStreamInHeaders(input_api, output_api):
15 """Checks to make sure no .h files include <iostream>."""
16 files = []
17 pattern = input_api.re.compile(r'^#include\s*<iostream>',
18 input_api.re.MULTILINE)
19 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
20 if not f.LocalPath().endswith('.h'):
21 continue
22 contents = input_api.ReadFile(f)
23 if pattern.search(contents):
24 files.append(f)
25
26 if len(files):
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020027 return [output_api.PresubmitError(
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000028 'Do not #include <iostream> in header files, since it inserts static ' +
29 'initialization into every file including the header. Instead, ' +
30 '#include <ostream>. See http://crbug.com/94794',
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020031 files)]
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000032 return []
33
kjellander@webrtc.orge4158642014-08-06 09:11:18 +000034
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000035def _CheckNoFRIEND_TEST(input_api, output_api):
36 """Make sure that gtest's FRIEND_TEST() macro is not used, the
37 FRIEND_TEST_ALL_PREFIXES() macro from testsupport/gtest_prod_util.h should be
38 used instead since that allows for FLAKY_, FAILS_ and DISABLED_ prefixes."""
39 problems = []
40
41 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.h'))
42 for f in input_api.AffectedFiles(file_filter=file_filter):
43 for line_num, line in f.ChangedContents():
44 if 'FRIEND_TEST(' in line:
45 problems.append(' %s:%d' % (f.LocalPath(), line_num))
46
47 if not problems:
48 return []
49 return [output_api.PresubmitPromptWarning('WebRTC\'s code should not use '
50 'gtest\'s FRIEND_TEST() macro. Include testsupport/gtest_prod_util.h and '
51 'use FRIEND_TEST_ALL_PREFIXES() instead.\n' + '\n'.join(problems))]
52
kjellander@webrtc.orge4158642014-08-06 09:11:18 +000053
mflodman@webrtc.org2a452092012-07-01 05:55:23 +000054def _CheckApprovedFilesLintClean(input_api, output_api,
55 source_file_filter=None):
56 """Checks that all new or whitelisted .cc and .h files pass cpplint.py.
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000057 This check is based on _CheckChangeLintsClean in
58 depot_tools/presubmit_canned_checks.py but has less filters and only checks
59 added files."""
60 result = []
61
62 # Initialize cpplint.
63 import cpplint
64 # Access to a protected member _XX of a client class
65 # pylint: disable=W0212
66 cpplint._cpplint_state.ResetErrorCounts()
67
68 # Justifications for each filter:
69 #
70 # - build/header_guard : WebRTC coding style says they should be prefixed
71 # with WEBRTC_, which is not possible to configure in
72 # cpplint.py.
73 cpplint._SetFilters('-build/header_guard')
74
75 # Use the strictest verbosity level for cpplint.py (level 1) which is the
76 # default when running cpplint.py from command line.
77 # To make it possible to work with not-yet-converted code, we're only applying
mflodman@webrtc.org2a452092012-07-01 05:55:23 +000078 # it to new (or moved/renamed) files and files listed in LINT_FOLDERS.
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000079 verbosity_level = 1
80 files = []
81 for f in input_api.AffectedSourceFiles(source_file_filter):
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020082 # Note that moved/renamed files also count as added.
83 if f.Action() == 'A':
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000084 files.append(f.AbsoluteLocalPath())
mflodman@webrtc.org2a452092012-07-01 05:55:23 +000085
kjellander@webrtc.org51198f12012-02-21 17:53:46 +000086 for file_name in files:
87 cpplint.ProcessFile(file_name, verbosity_level)
88
89 if cpplint._cpplint_state.error_count > 0:
90 if input_api.is_committing:
91 # TODO(kjellander): Change back to PresubmitError below when we're
92 # confident with the lint settings.
93 res_type = output_api.PresubmitPromptWarning
94 else:
95 res_type = output_api.PresubmitPromptWarning
96 result = [res_type('Changelist failed cpplint.py check.')]
97
98 return result
99
henrike@webrtc.org83fe69d2014-09-30 21:54:26 +0000100def _CheckNoRtcBaseDeps(input_api, gyp_files, output_api):
101 pattern = input_api.re.compile(r"base.gyp:rtc_base\s*'")
102 violating_files = []
103 for f in gyp_files:
henrike@webrtc.org36b0c1a2014-10-01 14:40:58 +0000104 gyp_exceptions = (
105 'base_tests.gyp',
106 'desktop_capture.gypi',
107 'libjingle.gyp',
henrike@webrtc.org28af6412014-11-04 15:11:46 +0000108 'libjingle_tests.gyp',
kjellander@webrtc.orge7237282015-02-26 11:12:17 +0000109 'p2p.gyp',
henrike@webrtc.org36b0c1a2014-10-01 14:40:58 +0000110 'sound.gyp',
111 'webrtc_test_common.gyp',
112 'webrtc_tests.gypi',
113 )
114 if f.LocalPath().endswith(gyp_exceptions):
115 continue
henrike@webrtc.org83fe69d2014-09-30 21:54:26 +0000116 contents = input_api.ReadFile(f)
117 if pattern.search(contents):
118 violating_files.append(f)
119 if violating_files:
120 return [output_api.PresubmitError(
121 'Depending on rtc_base is not allowed. Change your dependency to '
122 'rtc_base_approved and possibly sanitize and move the desired source '
123 'file(s) to rtc_base_approved.\nChanged GYP files:',
124 items=violating_files)]
125 return []
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000126
kjellander@webrtc.orgf68ffca2015-01-27 13:13:24 +0000127def _CheckNoSourcesAboveGyp(input_api, gyp_files, output_api):
128 # Disallow referencing source files with paths above the GYP file location.
129 source_pattern = input_api.re.compile(r'sources.*?\[(.*?)\]',
130 re.MULTILINE | re.DOTALL)
kjellander@webrtc.orga33f05e2015-01-29 14:29:45 +0000131 file_pattern = input_api.re.compile(r"'((\.\./.*?)|(<\(webrtc_root\).*?))'")
kjellander@webrtc.orgf68ffca2015-01-27 13:13:24 +0000132 violating_gyp_files = set()
133 violating_source_entries = []
134 for gyp_file in gyp_files:
135 contents = input_api.ReadFile(gyp_file)
136 for source_block_match in source_pattern.finditer(contents):
kjellander@webrtc.orgc98f6f32015-03-04 07:08:11 +0000137 # Find all source list entries starting with ../ in the source block
138 # (exclude overrides entries).
kjellander@webrtc.orgf68ffca2015-01-27 13:13:24 +0000139 for file_list_match in file_pattern.finditer(source_block_match.group(0)):
kjellander@webrtc.orgc98f6f32015-03-04 07:08:11 +0000140 source_file = file_list_match.group(0)
141 if 'overrides/' not in source_file:
142 violating_source_entries.append(source_file)
143 violating_gyp_files.add(gyp_file)
kjellander@webrtc.orgf68ffca2015-01-27 13:13:24 +0000144 if violating_gyp_files:
145 return [output_api.PresubmitError(
146 'Referencing source files above the directory of the GYP file is not '
147 'allowed. Please introduce new GYP targets and/or GYP files in the '
148 'proper location instead.\n'
149 'Invalid source entries:\n'
150 '%s\n'
151 'Violating GYP files:' % '\n'.join(violating_source_entries),
152 items=violating_gyp_files)]
153 return []
154
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000155def _CheckGypChanges(input_api, output_api):
156 source_file_filter = lambda x: input_api.FilterSourceFile(
157 x, white_list=(r'.+\.(gyp|gypi)$',))
158
159 gyp_files = []
160 for f in input_api.AffectedSourceFiles(source_file_filter):
kjellander@webrtc.org3398a4a2014-11-24 10:05:37 +0000161 if f.LocalPath().startswith('webrtc'):
162 gyp_files.append(f)
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000163
164 result = []
165 if gyp_files:
166 result.append(output_api.PresubmitNotifyResult(
167 'As you\'re changing GYP files: please make sure corresponding '
168 'BUILD.gn files are also updated.\nChanged GYP files:',
169 items=gyp_files))
henrike@webrtc.org83fe69d2014-09-30 21:54:26 +0000170 result.extend(_CheckNoRtcBaseDeps(input_api, gyp_files, output_api))
kjellander@webrtc.orgf68ffca2015-01-27 13:13:24 +0000171 result.extend(_CheckNoSourcesAboveGyp(input_api, gyp_files, output_api))
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000172 return result
173
kjellander@webrtc.org3bd41562014-09-01 11:06:37 +0000174def _CheckUnwantedDependencies(input_api, output_api):
175 """Runs checkdeps on #include statements added in this
176 change. Breaking - rules is an error, breaking ! rules is a
177 warning.
178 """
179 # Copied from Chromium's src/PRESUBMIT.py.
180
181 # We need to wait until we have an input_api object and use this
182 # roundabout construct to import checkdeps because this file is
183 # eval-ed and thus doesn't have __file__.
184 original_sys_path = sys.path
185 try:
kjellander@webrtc.orgaefe61a2014-12-08 13:00:30 +0000186 checkdeps_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
187 'buildtools', 'checkdeps')
188 if not os.path.exists(checkdeps_path):
189 return [output_api.PresubmitError(
190 'Cannot find checkdeps at %s\nHave you run "gclient sync" to '
191 'download Chromium and setup the symlinks?' % checkdeps_path)]
192 sys.path.append(checkdeps_path)
kjellander@webrtc.org3bd41562014-09-01 11:06:37 +0000193 import checkdeps
194 from cpp_checker import CppChecker
195 from rules import Rule
196 finally:
197 # Restore sys.path to what it was before.
198 sys.path = original_sys_path
199
200 added_includes = []
201 for f in input_api.AffectedFiles():
202 if not CppChecker.IsCppFile(f.LocalPath()):
203 continue
204
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200205 changed_lines = [line for _, line in f.ChangedContents()]
kjellander@webrtc.org3bd41562014-09-01 11:06:37 +0000206 added_includes.append([f.LocalPath(), changed_lines])
207
208 deps_checker = checkdeps.DepsChecker(input_api.PresubmitLocalPath())
209
210 error_descriptions = []
211 warning_descriptions = []
212 for path, rule_type, rule_description in deps_checker.CheckAddedCppIncludes(
213 added_includes):
214 description_with_path = '%s\n %s' % (path, rule_description)
215 if rule_type == Rule.DISALLOW:
216 error_descriptions.append(description_with_path)
217 else:
218 warning_descriptions.append(description_with_path)
219
220 results = []
221 if error_descriptions:
222 results.append(output_api.PresubmitError(
223 'You added one or more #includes that violate checkdeps rules.',
224 error_descriptions))
225 if warning_descriptions:
226 results.append(output_api.PresubmitPromptOrNotify(
227 'You added one or more #includes of files that are temporarily\n'
228 'allowed but being removed. Can you avoid introducing the\n'
229 '#include? See relevant DEPS file(s) for details and contacts.',
230 warning_descriptions))
231 return results
232
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000233
Henrik Kjellander8d3ad822015-05-26 19:52:05 +0200234def _RunPythonTests(input_api, output_api):
235 def join(*args):
236 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)
237
238 test_directories = [
239 join('tools', 'autoroller', 'unittests'),
240 ]
241
242 tests = []
243 for directory in test_directories:
244 tests.extend(
245 input_api.canned_checks.GetUnitTestsInDirectory(
246 input_api,
247 output_api,
248 directory,
249 whitelist=[r'.+_test\.py$']))
250 return input_api.RunTests(tests, parallel=True)
251
252
andrew@webrtc.org53df1362012-01-26 21:24:23 +0000253def _CommonChecks(input_api, output_api):
254 """Checks common to both upload and commit."""
niklase@google.comda159d62011-05-30 11:51:34 +0000255 results = []
phoglund@webrtc.org5d3713932013-03-07 09:59:43 +0000256 results.extend(input_api.canned_checks.RunPylint(input_api, output_api,
257 black_list=(r'^.*gviz_api\.py$',
258 r'^.*gaeunit\.py$',
fischman@webrtc.org33584f92013-07-25 16:43:30 +0000259 # Embedded shell-script fakes out pylint.
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000260 r'^build/.*\.py$',
261 r'^buildtools/.*\.py$',
kjellander@webrtc.org89256622014-08-20 12:10:11 +0000262 r'^chromium/.*\.py$',
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000263 r'^out.*/.*\.py$',
phoglund@webrtc.org5d3713932013-03-07 09:59:43 +0000264 r'^testing/.*\.py$',
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000265 r'^third_party/.*\.py$',
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000266 r'^tools/clang/.*\.py$',
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000267 r'^tools/gn/.*\.py$',
phoglund@webrtc.org5d3713932013-03-07 09:59:43 +0000268 r'^tools/gyp/.*\.py$',
phoglund@webrtc.org6d07ad92013-05-14 09:42:39 +0000269 r'^tools/protoc_wrapper/.*\.py$',
phoglund@webrtc.org5d3713932013-03-07 09:59:43 +0000270 r'^tools/python/.*\.py$',
271 r'^tools/python_charts/data/.*\.py$',
kjellander@webrtc.org33654222013-08-22 07:57:00 +0000272 r'^tools/refactoring/.*\.py$',
kjellander@webrtc.orgf9bdbe32013-12-11 13:37:12 +0000273 r'^tools/swarming_client/.*\.py$',
phoglund@webrtc.org5d3713932013-03-07 09:59:43 +0000274 # TODO(phoglund): should arguably be checked.
275 r'^tools/valgrind-webrtc/.*\.py$',
276 r'^tools/valgrind/.*\.py$',
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000277 r'^xcodebuild.*/.*\.py$',),
phoglund@webrtc.org5d3713932013-03-07 09:59:43 +0000278 disabled_warnings=['F0401', # Failed to import x
279 'E0611', # No package y in x
280 'W0232', # Class has no __init__ method
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200281 ],
282 pylintrc='pylintrc'))
283 # WebRTC can't use the presubmit_canned_checks.PanProjectChecks function since
284 # we need to have different license checks in talk/ and webrtc/ directories.
285 # Instead, hand-picked checks are included below.
andrew@webrtc.org2442de12012-01-23 17:45:41 +0000286 results.extend(input_api.canned_checks.CheckLongLines(
pbos@webrtc.orgf2e7bc62013-04-08 15:46:07 +0000287 input_api, output_api, maxlen=80))
andrew@webrtc.org2442de12012-01-23 17:45:41 +0000288 results.extend(input_api.canned_checks.CheckChangeHasNoTabs(
289 input_api, output_api))
andrew@webrtc.org53df1362012-01-26 21:24:23 +0000290 results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
291 input_api, output_api))
292 results.extend(input_api.canned_checks.CheckChangeTodoHasOwner(
293 input_api, output_api))
mflodman@webrtc.org2a452092012-07-01 05:55:23 +0000294 results.extend(_CheckApprovedFilesLintClean(input_api, output_api))
kjellander@webrtc.org51198f12012-02-21 17:53:46 +0000295 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api))
296 results.extend(_CheckNoFRIEND_TEST(input_api, output_api))
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000297 results.extend(_CheckGypChanges(input_api, output_api))
kjellander@webrtc.org3bd41562014-09-01 11:06:37 +0000298 results.extend(_CheckUnwantedDependencies(input_api, output_api))
Henrik Kjellander8d3ad822015-05-26 19:52:05 +0200299 results.extend(_RunPythonTests(input_api, output_api))
andrew@webrtc.org53df1362012-01-26 21:24:23 +0000300 return results
andrew@webrtc.org2442de12012-01-23 17:45:41 +0000301
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000302
andrew@webrtc.org53df1362012-01-26 21:24:23 +0000303def CheckChangeOnUpload(input_api, output_api):
304 results = []
305 results.extend(_CommonChecks(input_api, output_api))
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200306 results.extend(
307 input_api.canned_checks.CheckGNFormatted(input_api, output_api))
niklase@google.comda159d62011-05-30 11:51:34 +0000308 return results
309
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000310
andrew@webrtc.org2442de12012-01-23 17:45:41 +0000311def CheckChangeOnCommit(input_api, output_api):
niklase@google.com1198db92011-06-09 07:07:24 +0000312 results = []
andrew@webrtc.org53df1362012-01-26 21:24:23 +0000313 results.extend(_CommonChecks(input_api, output_api))
niklase@google.com1198db92011-06-09 07:07:24 +0000314 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
andrew@webrtc.org53df1362012-01-26 21:24:23 +0000315 results.extend(input_api.canned_checks.CheckChangeWasUploaded(
316 input_api, output_api))
317 results.extend(input_api.canned_checks.CheckChangeHasDescription(
318 input_api, output_api))
kjellander@webrtc.org51198f12012-02-21 17:53:46 +0000319 results.extend(input_api.canned_checks.CheckChangeHasBugField(
320 input_api, output_api))
321 results.extend(input_api.canned_checks.CheckChangeHasTestField(
322 input_api, output_api))
kjellander@webrtc.org12cb88c2014-02-13 11:53:43 +0000323 results.extend(input_api.canned_checks.CheckTreeIsOpen(
324 input_api, output_api,
325 json_url='http://webrtc-status.appspot.com/current?format=json'))
niklase@google.com1198db92011-06-09 07:07:24 +0000326 return results
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000327
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000328
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000329def GetDefaultTryConfigs(bots=None):
330 """Returns a list of ('bot', set(['tests']), optionally filtered by [bots].
331
332 For WebRTC purposes, we always return an empty list of tests, since we want
333 to run all tests by default on all our trybots.
334 """
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200335 return {'tryserver.webrtc': dict((bot, []) for bot in bots)}
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000336
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000337
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000338# pylint: disable=W0613
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000339def GetPreferredTryMasters(project, change):
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000340 files = change.LocalPaths()
341
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000342 android_gn_bots = [
343 'android_gn',
344 'android_gn_rel',
345 ]
kjellander@webrtc.orgcf2b3ac2013-12-20 21:20:42 +0000346 android_bots = [
347 'android',
Henrik Kjellander36fc1ba2015-04-15 15:37:46 +0200348 'android_arm64_rel',
kjellander@webrtc.orgcf2b3ac2013-12-20 21:20:42 +0000349 'android_rel',
350 'android_clang',
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000351 ] + android_gn_bots
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000352 ios_bots = [
353 'ios',
kjellander@webrtc.orgd91d3592014-12-08 07:05:38 +0000354 'ios_arm64',
355 'ios_arm64_rel',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000356 'ios_rel',
Henrik Kjellanderd43ba892015-04-20 08:58:18 +0200357 'ios32_sim',
358 'ios64_sim',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000359 ]
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000360 linux_gn_bots = [
361 'linux_gn',
362 'linux_gn_rel',
363 ]
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000364 linux_bots = [
365 'linux',
366 'linux_asan',
kjellander@webrtc.org570bc3d2014-01-22 19:00:01 +0000367 'linux_baremetal',
kjellander@webrtc.org3b839d02014-10-24 21:41:24 +0000368 'linux_msan',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000369 'linux_rel',
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000370 'linux_tsan2',
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000371 ] + linux_gn_bots
kjellander@webrtc.org1592df72015-01-09 15:38:29 +0000372 mac_gn_bots = [
373 'mac_x64_gn',
374 'mac_x64_gn_rel',
375 ]
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000376 mac_bots = [
377 'mac',
378 'mac_asan',
kjellander@webrtc.org570bc3d2014-01-22 19:00:01 +0000379 'mac_baremetal',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000380 'mac_rel',
kjellander@webrtc.orgc0fc4dd2015-02-17 08:30:29 +0000381 'mac_x64',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000382 'mac_x64_rel',
kjellander@webrtc.org1592df72015-01-09 15:38:29 +0000383 ] + mac_gn_bots
384 win_gn_bots = [
385 'win_x64_gn',
386 'win_x64_gn_rel',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000387 ]
388 win_bots = [
389 'win',
kjellander@webrtc.org570bc3d2014-01-22 19:00:01 +0000390 'win_baremetal',
kjellander@webrtc.orga956ec22014-04-14 08:38:27 +0000391 'win_drmemory_light',
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000392 'win_rel',
393 'win_x64_rel',
kjellander@webrtc.org1592df72015-01-09 15:38:29 +0000394 ] + win_gn_bots
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000395 if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files):
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000396 return {}
kjellander@webrtc.orge4158642014-08-06 09:11:18 +0000397 if all(re.search(r'[\\/]BUILD.gn$', f) for f in files):
kjellander@webrtc.org1592df72015-01-09 15:38:29 +0000398 return GetDefaultTryConfigs(android_gn_bots + linux_gn_bots + mac_gn_bots +
399 win_gn_bots)
Henrik Kjellandere982a702015-05-25 16:33:54 +0200400 if all(re.search('[/_]mac[/_.]', f) for f in files):
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000401 return GetDefaultTryConfigs(mac_bots)
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000402 if all(re.search('(^|[/_])win[/_.]', f) for f in files):
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000403 return GetDefaultTryConfigs(win_bots)
404 if all(re.search('(^|[/_])android[/_.]', f) for f in files):
405 return GetDefaultTryConfigs(android_bots)
406 if all(re.search('[/_]ios[/_.]', f) for f in files):
407 return GetDefaultTryConfigs(ios_bots)
kjellander@webrtc.org85759802013-10-22 16:47:40 +0000408
kjellander@webrtc.orgc7b8b2f2014-04-03 20:19:36 +0000409 return GetDefaultTryConfigs(android_bots + ios_bots + linux_bots + mac_bots +
410 win_bots)