blob: 1ae7fe75235a8715166501ae1cb81b5af99b1e1e [file] [log] [blame]
Avi Drissman04c79e102022-10-06 18:59:021# Copyright 2011 The Chromium Authors
thakis@chromium.org99f1a482011-04-12 00:11:232# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Dan Harringtonb60e1aa2019-11-20 08:48:545import os
6
Dan Le Febvre7c5784d2022-11-10 07:07:417PRESUBMIT_VERSION = '2.0.0'
8
Anne Redulla4f875512023-09-20 07:46:399
10def CheckThirdPartyMetadataFiles(input_api, output_api):
11 """Checks that third party metadata files are correctly formatted
12 and valid.
13 """
14 def readme_filter(f):
15 local_path = f.LocalPath()
16
17 # Limit to README.chromium files within //third_party/.
18 if (not local_path.endswith('README.chromium')
19 or not local_path.startswith('third_party' + input_api.os_path.sep)):
20 return False
21
22 # Some folders are currently exempt from being checked.
23 skip_dirs = (
24 ('third_party', 'blink'),
25 ('third_party', 'boringssl'),
26 ('third_party', 'closure_compiler', 'externs'),
27 ('third_party', 'closure_compiler', 'interfaces'),
28 ('third_party', 'feed_library'),
29 ('third_party', 'ipcz'),
Sam Maier2e942202024-01-24 17:52:5530 ('third_party', 'jni_zero'),
Anne Redulla4f875512023-09-20 07:46:3931 # TODO(danakj): We should look for the README.chromium file in
32 # third_party/rust/CRATE_NAME/vVERSION/.
33 ('third_party', 'rust'),
34 ('third_party', 'webxr_test_pages'),
35 )
36 for path in skip_dirs:
37 prefix = ''.join([dir_name + input_api.os_path.sep for dir_name in path])
38 if local_path.startswith(prefix):
39 return False
40
41 return True
42
43 return input_api.canned_checks.CheckChromiumDependencyMetadata(
44 input_api, output_api, file_filter=readme_filter)