| 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 # We can save some time by not rsyncing code we don't use. |
| 71 self._prune_from_rsync_build = [ |
| 72 'third_party/WebKit/LayoutTests', |
| 73 ] |
| 74 |
| 66 # Dependencies required to build android_webview. | 75 # Dependencies required to build android_webview. |
| 67 self._compile_dependencies = (self._snapshot_into_android_dependencies + | 76 self._compile_dependencies = (self._snapshot_into_android_dependencies + |
| 68 self._compile_but_not_snapshot_dependencies) | 77 self._compile_but_not_snapshot_dependencies) |
| 69 | 78 |
| 70 # Dependencies required to run android_webview tests but not required to | 79 # Dependencies required to run android_webview tests but not required to |
| 71 # compile. | 80 # compile. |
| 72 self._test_data_dependencies = [ | 81 self._test_data_dependencies = [ |
| 73 'chrome/test/data/perf/third_party/octane', | 82 'chrome/test/data/perf/third_party/octane', |
| 74 ] | 83 ] |
| 75 | 84 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 'Var': var.Lookup, | 126 'Var': var.Lookup, |
| 118 'deps_os': {}, | 127 'deps_os': {}, |
| 119 } | 128 } |
| 120 execfile(deps_file_path, global_scope, local_scope) | 129 execfile(deps_file_path, global_scope, local_scope) |
| 121 deps = local_scope.get('deps', {}) | 130 deps = local_scope.get('deps', {}) |
| 122 deps_os = local_scope.get('deps_os', {}) | 131 deps_os = local_scope.get('deps_os', {}) |
| 123 for os_specific_deps in deps_os.itervalues(): | 132 for os_specific_deps in deps_os.itervalues(): |
| 124 deps.update(os_specific_deps) | 133 deps.update(os_specific_deps) |
| 125 return deps.keys() | 134 return deps.keys() |
| 126 | 135 |
| 136 def _get_known_issues(self): |
| 137 issues = [] |
| 138 for root, paths in known_issues.KNOWN_INCOMPATIBLE.items(): |
| 139 for path in paths: |
| 140 issues.append(os.path.normpath(os.path.join(root, path))) |
| 141 return issues |
| 142 |
| 127 def _make_gclient_blacklist(self, deps_file_path, whitelisted_deps): | 143 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 | 144 """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.""" | 145 so that the only deps left are the one in the whitelist.""" |
| 130 all_deps = self._read_deps_file(deps_file_path) | 146 all_deps = self._read_deps_file(deps_file_path) |
| 131 # The list of deps read from the DEPS file are prefixed with the source | 147 # The list of deps read from the DEPS file are prefixed with the source |
| 132 # tree root, which is 'src' for Chromium. | 148 # tree root, which is 'src' for Chromium. |
| 133 def prepend_root(path): | 149 def prepend_root(path): |
| 134 return os.path.join('src', path) | 150 return os.path.join('src', path) |
| 135 whitelisted_deps = map(prepend_root, whitelisted_deps) | 151 whitelisted_deps = map(prepend_root, whitelisted_deps) |
| 136 deps_blacklist = set(all_deps).difference(set(whitelisted_deps)) | 152 deps_blacklist = set(all_deps).difference(set(whitelisted_deps)) |
| 137 return dict(map(lambda(x): (x, None), deps_blacklist)) | 153 return dict(map(lambda(x): (x, None), deps_blacklist)) |
| 138 | 154 |
| 155 def _make_blacklist(self, deps_file_path, whitelisted_deps): |
| 156 """Calculates the list of paths we should exclude """ |
| 157 all_deps = self._read_deps_file(deps_file_path) |
| 158 def remove_src_prefix(path): |
| 159 return path.replace('src/', '', 1) |
| 160 all_deps = map(remove_src_prefix, all_deps) |
| 161 # Ignore all deps except those whitelisted. |
| 162 blacklist = set(all_deps).difference(whitelisted_deps) |
| 163 # Ignore the 'known issues'. Typically these are the licence incompatible |
| 164 # things checked directly into Chromium. |
| 165 blacklist = blacklist.union(self._get_known_issues()) |
| 166 # Ignore any other non-deps, non-licence paths we don't like. |
| 167 blacklist = blacklist.union(self._prune_from_rsync_build) |
| 168 return list(blacklist) |
| 169 |
| 139 def get_deps_for_android_build(self, deps_file_path): | 170 def get_deps_for_android_build(self, deps_file_path): |
| 140 """This is used to calculate the custom_deps list for the Android bot. | 171 """This is used to calculate the custom_deps list for the Android bot. |
| 141 """ | 172 """ |
| 142 if not deps_file_path: | 173 if not deps_file_path: |
| 143 raise Exception('You need to specify a DEPS file path.') | 174 raise Exception('You need to specify a DEPS file path.') |
| 144 return self._make_gclient_blacklist(deps_file_path, | 175 return self._make_gclient_blacklist(deps_file_path, |
| 145 self._compile_dependencies) | 176 self._compile_dependencies) |
| 146 | 177 |
| 147 def get_deps_for_android_build_and_test(self, deps_file_path): | 178 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. | 179 """This is used to calculate the custom_deps list for the Android perf bot. |
| 149 """ | 180 """ |
| 150 if not deps_file_path: | 181 if not deps_file_path: |
| 151 raise Exception('You need to specify a DEPS file path.') | 182 raise Exception('You need to specify a DEPS file path.') |
| 152 return self._make_gclient_blacklist(deps_file_path, | 183 return self._make_gclient_blacklist(deps_file_path, |
| 153 self._compile_dependencies + | 184 self._compile_dependencies + |
| 154 self._test_data_dependencies) | 185 self._test_data_dependencies) |
| 155 | 186 |
| 187 def get_blacklist_for_android_rsync_build(self, deps_file_path): |
| 188 """Calculates the list of paths we should exclude when building Android |
| 189 either because of license compatibility or because they are large and |
| 190 uneeded. |
| 191 """ |
| 192 if not deps_file_path: |
| 193 raise Exception('You need to specify a DEPS file path.') |
| 194 return self._make_blacklist(deps_file_path, self._compile_dependencies) |
| 195 |
| 156 def get_deps_for_android_merge(self, _): | 196 def get_deps_for_android_merge(self, _): |
| 157 """Calculates the list of deps that need to be merged into the Android tree | 197 """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.""" | 198 in order to build the C++ and Java android_webview code.""" |
| 159 return self._snapshot_into_android_dependencies | 199 return self._snapshot_into_android_dependencies |
| 160 | 200 |
| 161 def get_deps_for_license_check(self, _): | 201 def get_deps_for_license_check(self, _): |
| 162 """Calculates the list of deps that need to be checked for Android license | 202 """Calculates the list of deps that need to be checked for Android license |
| 163 compatibility""" | 203 compatibility""" |
| 164 return self._compile_dependencies | 204 return self._compile_dependencies |
| 165 | 205 |
| 206 |
| 166 def execute_method(self, method_name, deps_file_path): | 207 def execute_method(self, method_name, deps_file_path): |
| 167 methods = { | 208 methods = { |
| 168 'android_build': self.get_deps_for_android_build, | 209 'android_build': self.get_deps_for_android_build, |
| 169 'android_build_and_test': | 210 'android_build_and_test': |
| 170 self.get_deps_for_android_build_and_test, | 211 self.get_deps_for_android_build_and_test, |
| 171 'android_merge': self.get_deps_for_android_merge, | 212 'android_merge': self.get_deps_for_android_merge, |
| 172 'license_check': self.get_deps_for_license_check | 213 'license_check': self.get_deps_for_license_check, |
| 214 'android_rsync_build': self.get_blacklist_for_android_rsync_build, |
| 173 } | 215 } |
| 174 if not method_name in methods: | 216 if not method_name in methods: |
| 175 raise Exception('Method name %s is not valid. Valid choices are %s' % | 217 raise Exception('Method name %s is not valid. Valid choices are %s' % |
| 176 (method_name, methods.keys())) | 218 (method_name, methods.keys())) |
| 177 return methods[method_name](deps_file_path) | 219 return methods[method_name](deps_file_path) |
| 178 | 220 |
| 179 def main(): | 221 def main(): |
| 180 parser = argparse.ArgumentParser() | 222 parser = argparse.ArgumentParser() |
| 181 parser.add_argument('--method', help='Method to use to fetch from whitelist.', | 223 parser.add_argument('--method', help='Method to use to fetch from whitelist.', |
| 182 required=True) | 224 required=True) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 197 with open(opts.output_json, 'w') as output_json_file: | 239 with open(opts.output_json, 'w') as output_json_file: |
| 198 json.dump(output_dict, output_json_file) | 240 json.dump(output_dict, output_json_file) |
| 199 else: | 241 else: |
| 200 print blacklist | 242 print blacklist |
| 201 | 243 |
| 202 return 0 | 244 return 0 |
| 203 | 245 |
| 204 | 246 |
| 205 if __name__ == '__main__': | 247 if __name__ == '__main__': |
| 206 sys.exit(main()) | 248 sys.exit(main()) |
| OLD | NEW |