OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 """Logic to generate lists of DEPS used by various parts of | 6 """Logic to generate lists of DEPS used by various parts of |
7 the android_webview continuous integration (buildbot) infrastructure. | 7 the android_webview continuous integration (buildbot) infrastructure. |
8 | 8 |
9 Note: The root Chromium project (which is not explicitly listed here) | 9 Note: The root Chromium project (which is not explicitly listed here) |
10 has a couple of third_party libraries checked in directly into it. This means | 10 has a couple of third_party libraries checked in directly into it. This means |
11 that the list of third parties present in this file is not a comprehensive | 11 that the list of third parties present in this file is not a comprehensive |
12 list of third party android_webview dependencies. | 12 list of third party android_webview dependencies. |
13 """ | 13 """ |
14 | 14 |
15 import argparse | 15 import argparse |
16 import json | 16 import json |
17 import logging | 17 import logging |
18 import os | 18 import os |
19 import sys | 19 import sys |
20 | 20 |
21 # Add android_webview/tools to path to get at known_issues. | |
22 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'tools')) | |
23 import known_issues | |
24 | |
21 | 25 |
22 class DepsWhitelist(object): | 26 class DepsWhitelist(object): |
23 def __init__(self): | 27 def __init__(self): |
24 # If a new DEPS entry is needed for the AOSP bot to compile please add it | 28 # If a new DEPS entry is needed for the AOSP bot to compile please add it |
25 # here first. | 29 # here first. |
26 # This is a staging area for deps that are accepted by the android_webview | 30 # This is a staging area for deps that are accepted by the android_webview |
27 # team and are in the process of having the required branches being created | 31 # team and are in the process of having the required branches being created |
28 # in the Android tree. | 32 # in the Android tree. |
29 self._compile_but_not_snapshot_dependencies = [ | 33 self._compile_but_not_snapshot_dependencies = [ |
30 ] | 34 ] |
(...skipping 25 matching lines...) Expand all Loading... | |
56 'third_party/skia', | 60 'third_party/skia', |
57 'third_party/smhasher/src', | 61 'third_party/smhasher/src', |
58 'third_party/usrsctp/usrsctplib', | 62 'third_party/usrsctp/usrsctplib', |
59 'third_party/webrtc', | 63 'third_party/webrtc', |
60 'third_party/yasm/source/patched-yasm', | 64 'third_party/yasm/source/patched-yasm', |
61 'tools/grit', | 65 'tools/grit', |
62 'tools/gyp', | 66 'tools/gyp', |
63 'v8', | 67 'v8', |
64 ] | 68 ] |
65 | 69 |
70 self._uneeded_for_building_android = [ | |
mkosiba (inactive)
2014/06/11 09:38:38
maybe _prune_from_rsync_build ? And add a comment
hjd
2014/06/11 09:59:25
Done.
| |
71 'third_party/WebKit/LayoutTests', | |
72 ] | |
73 | |
66 # Dependencies required to build android_webview. | 74 # Dependencies required to build android_webview. |
67 self._compile_dependencies = (self._snapshot_into_android_dependencies + | 75 self._compile_dependencies = (self._snapshot_into_android_dependencies + |
68 self._compile_but_not_snapshot_dependencies) | 76 self._compile_but_not_snapshot_dependencies) |
69 | 77 |
70 # Dependencies required to run android_webview tests but not required to | 78 # Dependencies required to run android_webview tests but not required to |
71 # compile. | 79 # compile. |
72 self._test_data_dependencies = [ | 80 self._test_data_dependencies = [ |
73 'chrome/test/data/perf/third_party/octane', | 81 'chrome/test/data/perf/third_party/octane', |
74 ] | 82 ] |
75 | 83 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 'Var': var.Lookup, | 125 'Var': var.Lookup, |
118 'deps_os': {}, | 126 'deps_os': {}, |
119 } | 127 } |
120 execfile(deps_file_path, global_scope, local_scope) | 128 execfile(deps_file_path, global_scope, local_scope) |
121 deps = local_scope.get('deps', {}) | 129 deps = local_scope.get('deps', {}) |
122 deps_os = local_scope.get('deps_os', {}) | 130 deps_os = local_scope.get('deps_os', {}) |
123 for os_specific_deps in deps_os.itervalues(): | 131 for os_specific_deps in deps_os.itervalues(): |
124 deps.update(os_specific_deps) | 132 deps.update(os_specific_deps) |
125 return deps.keys() | 133 return deps.keys() |
126 | 134 |
135 def _get_known_issues(self): | |
136 issues = [] | |
137 for root, paths in known_issues.KNOWN_INCOMPATIBLE.items(): | |
138 for path in paths: | |
139 # The leading dot seems to confuse rsync. | |
mkosiba (inactive)
2014/06/11 09:38:38
maybe use os.path.normpath instead of a special ca
hjd
2014/06/11 09:59:25
Done.
| |
140 if root == '.': | |
141 issues.append(path) | |
142 else: | |
143 issues.append(os.path.join(root, path)) | |
144 return issues | |
145 | |
127 def _make_gclient_blacklist(self, deps_file_path, whitelisted_deps): | 146 def _make_gclient_blacklist(self, deps_file_path, whitelisted_deps): |
128 """Calculates the list of deps that need to be excluded from the deps_file | 147 """Calculates the list of deps that need to be excluded from the deps_file |
129 so that the only deps left are the one in the whitelist.""" | 148 so that the only deps left are the one in the whitelist.""" |
130 all_deps = self._read_deps_file(deps_file_path) | 149 all_deps = self._read_deps_file(deps_file_path) |
131 # The list of deps read from the DEPS file are prefixed with the source | 150 # The list of deps read from the DEPS file are prefixed with the source |
132 # tree root, which is 'src' for Chromium. | 151 # tree root, which is 'src' for Chromium. |
133 def prepend_root(path): | 152 def prepend_root(path): |
134 return os.path.join('src', path) | 153 return os.path.join('src', path) |
135 whitelisted_deps = map(prepend_root, whitelisted_deps) | 154 whitelisted_deps = map(prepend_root, whitelisted_deps) |
136 deps_blacklist = set(all_deps).difference(set(whitelisted_deps)) | 155 deps_blacklist = set(all_deps).difference(set(whitelisted_deps)) |
137 return dict(map(lambda(x): (x, None), deps_blacklist)) | 156 return dict(map(lambda(x): (x, None), deps_blacklist)) |
138 | 157 |
158 def _make_blacklist(self, deps_file_path, whitelisted_deps): | |
159 """Calculates the list of paths we should exclude """ | |
160 all_deps = self._read_deps_file(deps_file_path) | |
161 def remove_src_prefix(path): | |
162 return path.replace('src/', '', 1) | |
163 all_deps = map(remove_src_prefix, all_deps) | |
164 # Ignore all deps except those whitelisted. | |
165 blacklist = set(all_deps).difference(whitelisted_deps) | |
166 # Ignore the 'known issues'. Typically these are the licence incompatible | |
167 # things checked directly into Chromium. | |
168 blacklist = blacklist.union(self._get_known_issues()) | |
169 # Ignore any other non-deps, non-licence paths we don't like. | |
170 blacklist = blacklist.union(self._uneeded_for_building_android) | |
171 return list(blacklist) | |
172 | |
139 def get_deps_for_android_build(self, deps_file_path): | 173 def get_deps_for_android_build(self, deps_file_path): |
140 """This is used to calculate the custom_deps list for the Android bot. | 174 """This is used to calculate the custom_deps list for the Android bot. |
141 """ | 175 """ |
142 if not deps_file_path: | 176 if not deps_file_path: |
143 raise Exception('You need to specify a DEPS file path.') | 177 raise Exception('You need to specify a DEPS file path.') |
144 return self._make_gclient_blacklist(deps_file_path, | 178 return self._make_gclient_blacklist(deps_file_path, |
145 self._compile_dependencies) | 179 self._compile_dependencies) |
146 | 180 |
147 def get_deps_for_android_build_and_test(self, deps_file_path): | 181 def get_deps_for_android_build_and_test(self, deps_file_path): |
148 """This is used to calculate the custom_deps list for the Android perf bot. | 182 """This is used to calculate the custom_deps list for the Android perf bot. |
149 """ | 183 """ |
150 if not deps_file_path: | 184 if not deps_file_path: |
151 raise Exception('You need to specify a DEPS file path.') | 185 raise Exception('You need to specify a DEPS file path.') |
152 return self._make_gclient_blacklist(deps_file_path, | 186 return self._make_gclient_blacklist(deps_file_path, |
153 self._compile_dependencies + | 187 self._compile_dependencies + |
154 self._test_data_dependencies) | 188 self._test_data_dependencies) |
155 | 189 |
190 def get_blacklist_for_android_build(self, deps_file_path): | |
191 """Calculates the list of paths we should exclude when building Android | |
192 either because of license compatibility or because they are large and | |
193 uneeded. | |
194 """ | |
195 if not deps_file_path: | |
196 raise Exception('You need to specify a DEPS file path.') | |
197 return self._make_blacklist(deps_file_path, self._compile_dependencies) | |
198 | |
156 def get_deps_for_android_merge(self, _): | 199 def get_deps_for_android_merge(self, _): |
157 """Calculates the list of deps that need to be merged into the Android tree | 200 """Calculates the list of deps that need to be merged into the Android tree |
158 in order to build the C++ and Java android_webview code.""" | 201 in order to build the C++ and Java android_webview code.""" |
159 return self._snapshot_into_android_dependencies | 202 return self._snapshot_into_android_dependencies |
160 | 203 |
161 def get_deps_for_license_check(self, _): | 204 def get_deps_for_license_check(self, _): |
162 """Calculates the list of deps that need to be checked for Android license | 205 """Calculates the list of deps that need to be checked for Android license |
163 compatibility""" | 206 compatibility""" |
164 return self._compile_dependencies | 207 return self._compile_dependencies |
165 | 208 |
209 | |
166 def execute_method(self, method_name, deps_file_path): | 210 def execute_method(self, method_name, deps_file_path): |
167 methods = { | 211 methods = { |
168 'android_build': self.get_deps_for_android_build, | 212 'android_build': self.get_deps_for_android_build, |
169 'android_build_and_test': | 213 'android_build_and_test': |
170 self.get_deps_for_android_build_and_test, | 214 self.get_deps_for_android_build_and_test, |
171 'android_merge': self.get_deps_for_android_merge, | 215 'android_merge': self.get_deps_for_android_merge, |
172 'license_check': self.get_deps_for_license_check | 216 'license_check': self.get_deps_for_license_check, |
217 'android_build_blacklist': self.get_blacklist_for_android_build, | |
mkosiba (inactive)
2014/06/11 09:38:38
maybe android_rsync_build ?
hjd
2014/06/11 09:59:25
Done.
| |
173 } | 218 } |
174 if not method_name in methods: | 219 if not method_name in methods: |
175 raise Exception('Method name %s is not valid. Valid choices are %s' % | 220 raise Exception('Method name %s is not valid. Valid choices are %s' % |
176 (method_name, methods.keys())) | 221 (method_name, methods.keys())) |
177 return methods[method_name](deps_file_path) | 222 return methods[method_name](deps_file_path) |
178 | 223 |
179 def main(): | 224 def main(): |
180 parser = argparse.ArgumentParser() | 225 parser = argparse.ArgumentParser() |
181 parser.add_argument('--method', help='Method to use to fetch from whitelist.', | 226 parser.add_argument('--method', help='Method to use to fetch from whitelist.', |
182 required=True) | 227 required=True) |
(...skipping 14 matching lines...) Expand all Loading... | |
197 with open(opts.output_json, 'w') as output_json_file: | 242 with open(opts.output_json, 'w') as output_json_file: |
198 json.dump(output_dict, output_json_file) | 243 json.dump(output_dict, output_json_file) |
199 else: | 244 else: |
200 print blacklist | 245 print blacklist |
201 | 246 |
202 return 0 | 247 return 0 |
203 | 248 |
204 | 249 |
205 if __name__ == '__main__': | 250 if __name__ == '__main__': |
206 sys.exit(main()) | 251 sys.exit(main()) |
OLD | NEW |