OLD | NEW |
1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 not exclusion_pattern.search(line)): | 209 not exclusion_pattern.search(line)): |
210 problems.append( | 210 problems.append( |
211 '%s:%d\n %s' % (local_path, line_number, line.strip())) | 211 '%s:%d\n %s' % (local_path, line_number, line.strip())) |
212 | 212 |
213 if problems: | 213 if problems: |
214 return [output_api.PresubmitPromptOrNotify(_TEST_ONLY_WARNING, problems)] | 214 return [output_api.PresubmitPromptOrNotify(_TEST_ONLY_WARNING, problems)] |
215 else: | 215 else: |
216 return [] | 216 return [] |
217 | 217 |
218 | 218 |
| 219 def _CheckMissingFiles(input_api, output_api): |
| 220 """Runs verify_source_deps.py to ensure no files were added that are not in |
| 221 GN. |
| 222 """ |
| 223 # We need to wait until we have an input_api object and use this |
| 224 # roundabout construct to import checkdeps because this file is |
| 225 # eval-ed and thus doesn't have __file__. |
| 226 original_sys_path = sys.path |
| 227 try: |
| 228 sys.path = sys.path + [input_api.os_path.join( |
| 229 input_api.PresubmitLocalPath(), 'tools')] |
| 230 from verify_source_deps import missing_gn_files, missing_gyp_files |
| 231 finally: |
| 232 # Restore sys.path to what it was before. |
| 233 sys.path = original_sys_path |
| 234 |
| 235 gn_files = missing_gn_files() |
| 236 gyp_files = missing_gyp_files() |
| 237 results = [] |
| 238 if gn_files: |
| 239 results.append(output_api.PresubmitError( |
| 240 "You added one or more source files but didn't update the\n" |
| 241 "corresponding BUILD.gn files:\n", |
| 242 gn_files)) |
| 243 if gyp_files: |
| 244 results.append(output_api.PresubmitError( |
| 245 "You added one or more source files but didn't update the\n" |
| 246 "corresponding gyp files:\n", |
| 247 gyp_files)) |
| 248 return results |
| 249 |
| 250 |
219 def _CommonChecks(input_api, output_api): | 251 def _CommonChecks(input_api, output_api): |
220 """Checks common to both upload and commit.""" | 252 """Checks common to both upload and commit.""" |
221 results = [] | 253 results = [] |
222 results.extend(input_api.canned_checks.CheckOwners( | 254 results.extend(input_api.canned_checks.CheckOwners( |
223 input_api, output_api, source_file_filter=None)) | 255 input_api, output_api, source_file_filter=None)) |
224 results.extend(input_api.canned_checks.CheckPatchFormatted( | 256 results.extend(input_api.canned_checks.CheckPatchFormatted( |
225 input_api, output_api)) | 257 input_api, output_api)) |
226 results.extend(input_api.canned_checks.CheckGenderNeutral( | 258 results.extend(input_api.canned_checks.CheckGenderNeutral( |
227 input_api, output_api)) | 259 input_api, output_api)) |
228 results.extend(_V8PresubmitChecks(input_api, output_api)) | 260 results.extend(_V8PresubmitChecks(input_api, output_api)) |
229 results.extend(_CheckUnwantedDependencies(input_api, output_api)) | 261 results.extend(_CheckUnwantedDependencies(input_api, output_api)) |
230 results.extend( | 262 results.extend( |
231 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) | 263 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) |
232 results.extend( | 264 results.extend( |
233 _CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api)) | 265 _CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api)) |
| 266 results.extend(_CheckMissingFiles(input_api, output_api)) |
234 return results | 267 return results |
235 | 268 |
236 | 269 |
237 def _SkipTreeCheck(input_api, output_api): | 270 def _SkipTreeCheck(input_api, output_api): |
238 """Check the env var whether we want to skip tree check. | 271 """Check the env var whether we want to skip tree check. |
239 Only skip if include/v8-version.h has been updated.""" | 272 Only skip if include/v8-version.h has been updated.""" |
240 src_version = 'include/v8-version.h' | 273 src_version = 'include/v8-version.h' |
241 if not input_api.AffectedSourceFiles( | 274 if not input_api.AffectedSourceFiles( |
242 lambda file: file.LocalPath() == src_version): | 275 lambda file: file.LocalPath() == src_version): |
243 return False | 276 return False |
244 return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' | 277 return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip' |
245 | 278 |
246 | 279 |
247 def CheckChangeOnUpload(input_api, output_api): | 280 def CheckChangeOnUpload(input_api, output_api): |
248 results = [] | 281 results = [] |
249 results.extend(_CommonChecks(input_api, output_api)) | 282 results.extend(_CommonChecks(input_api, output_api)) |
250 return results | 283 return results |
251 | 284 |
252 | 285 |
253 def CheckChangeOnCommit(input_api, output_api): | 286 def CheckChangeOnCommit(input_api, output_api): |
254 results = [] | 287 results = [] |
255 results.extend(_CommonChecks(input_api, output_api)) | 288 results.extend(_CommonChecks(input_api, output_api)) |
256 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 289 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
257 input_api, output_api)) | 290 input_api, output_api)) |
258 if not _SkipTreeCheck(input_api, output_api): | 291 if not _SkipTreeCheck(input_api, output_api): |
259 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 292 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
260 input_api, output_api, | 293 input_api, output_api, |
261 json_url='http://v8-status.appspot.com/current?format=json')) | 294 json_url='http://v8-status.appspot.com/current?format=json')) |
262 return results | 295 return results |
OLD | NEW |