Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: android_webview/buildbot/deps_whitelist.py

Issue 14669003: [android_webview] Deps whitelist and scripts for AOSP builder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/buildbot/OWNERS ('k') | android_webview/buildbot/generate_local_manifest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5 #
6 """Logic to generate lists of DEPS used by various parts of
7 the android_webview continuous integration (buildbot) infrastructure.
8
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
11 that the list of third parties present in this file is not a comprehensive
12 list of third party android_webview dependencies.
13 """
14
15 import argparse
16 import json
17 import logging
18 import os
19 import sys
20
21
22 class DepsWhitelist(object):
23 def __init__(self):
24 # Dependencies required to build android_webview.
25 self._compile_dependencies = [
26 'googleurl',
27 'sdch/open-vcdiff',
28 'testing/gtest',
29 'third_party/WebKit',
30 'third_party/angle',
31 ('third_party/eyesfree/src/android/java/src/com/googlecode/eyesfree/'
32 'braille'),
33 'third_party/freetype',
34 'third_party/icu',
35 'third_party/leveldatabase/src',
36 'third_party/libjingle/source',
37 'third_party/libphonenumber/src/phonenumbers',
38 'third_party/libphonenumber/src/resources',
39 'third_party/openssl',
40 'third_party/opus/src',
41 'third_party/ots',
42 'third_party/skia/gyp',
43 'third_party/skia/include',
44 'third_party/skia/src',
45 'third_party/smhasher/src',
46 'third_party/v8-i18n',
47 'third_party/yasm/source/patched-yasm',
48 'tools/grit',
49 'tools/gyp',
50 'v8',
51 ]
52
53 # Dependencies that need to be merged into the Android tree.
54 self._snapshot_into_android_dependencies = self._compile_dependencies
55
56 # Dependencies required to run android_webview tests but not required to
57 # compile.
58 self._test_data_dependencies = [
59 'chrome/test/data/perf/third_party/octane',
60 ]
61
62 @staticmethod
63 def _read_deps_file(deps_file_path):
64 class FileImplStub(object):
65 """Stub for the File syntax."""
66 def __init__(self, file_location):
67 pass
68
69 @staticmethod
70 def GetPath():
71 return ''
72
73 @staticmethod
74 def GetFilename():
75 return ''
76
77 @staticmethod
78 def GetRevision():
79 return None
80
81 def from_stub(__, _=None):
82 """Stub for the From syntax."""
83 return ''
84
85 class VarImpl(object):
86 def __init__(self, custom_vars, local_scope):
87 self._custom_vars = custom_vars
88 self._local_scope = local_scope
89
90 def Lookup(self, var_name):
91 """Implements the Var syntax."""
92 if var_name in self._custom_vars:
93 return self._custom_vars[var_name]
94 elif var_name in self._local_scope.get("vars", {}):
95 return self._local_scope["vars"][var_name]
96 raise Exception("Var is not defined: %s" % var_name)
97
98 local_scope = {}
99 var = VarImpl({}, local_scope)
100 global_scope = {
101 'File': FileImplStub,
102 'From': from_stub,
103 'Var': var.Lookup,
104 'deps_os': {},
105 }
106 execfile(deps_file_path, global_scope, local_scope)
107 deps = local_scope.get('deps', {})
108 deps_os = local_scope.get('deps_os', {})
109 for os_specific_deps in deps_os.itervalues():
110 deps.update(os_specific_deps)
111 return deps.keys()
112
113 def _make_gclient_blacklist(self, deps_file_path, whitelisted_deps):
114 """Calculates the list of deps that need to be excluded from the deps_file
115 so that the only deps left are the one in the whitelist."""
116 all_deps = self._read_deps_file(deps_file_path)
117 # The list of deps read from the DEPS file are prefixed with the source
118 # tree root, which is 'src' for Chromium.
119 def prepend_root(path):
120 return os.path.join('src', path)
121 whitelisted_deps = map(prepend_root, whitelisted_deps)
122 deps_blacklist = set(all_deps).difference(set(whitelisted_deps))
123 return dict(map(lambda(x): (x, None), deps_blacklist))
124
125 def get_deps_for_android_build(self, deps_file_path):
126 """This is used to calculate the custom_deps list for the Android bot.
127 """
128 if not deps_file_path:
129 raise Exception('You need to specify a DEPS file path.')
130 return self._make_gclient_blacklist(deps_file_path,
131 self._compile_dependencies)
132
133 def get_deps_for_android_build_and_test(self, deps_file_path):
134 """This is used to calculate the custom_deps list for the Android perf bot.
135 """
136 if not deps_file_path:
137 raise Exception('You need to specify a DEPS file path.')
138 return self._make_gclient_blacklist(deps_file_path,
139 self._compile_dependencies +
140 self._test_data_dependencies)
141
142 def get_deps_for_android_merge(self, _):
143 """Calculates the list of deps that need to be merged into the Android tree
144 in order to build the C++ and Java android_webview code."""
145 return self._snapshot_into_android_dependencies
146
147 def get_deps_for_license_check(self, _):
148 """Calculates the list of deps that need to be checked for Android license
149 compatibility"""
150 return self._snapshot_into_android_dependencies
151
152 def execute_method(self, method_name, deps_file_path):
153 methods = {
154 'android_build': self.get_deps_for_android_build,
155 'android_build_and_test':
156 self.get_deps_for_android_build_and_test,
157 'android_merge': self.get_deps_for_android_merge,
158 'license_check': self.get_deps_for_license_check
159 }
160 if not method_name in methods:
161 raise Exception('Method name %s is not valid. Valid choices are %s' %
162 (method_name, methods.keys()))
163 return methods[method_name](deps_file_path)
164
165 def main():
166 parser = argparse.ArgumentParser()
167 parser.add_argument('--method', help='Method to use to fetch from whitelist.',
168 required=True)
169 parser.add_argument('--path-to-deps', help='Path to DEPS file.')
170 parser.add_argument('--output-json', help='Name of file to write output to.')
171 parser.add_argument('verbose', action='store_true', default=False)
172 opts = parser.parse_args()
173
174 logging.getLogger().setLevel(logging.DEBUG if opts.verbose else logging.WARN)
175
176 deps_whitelist = DepsWhitelist()
177 blacklist = deps_whitelist.execute_method(opts.method, opts.path_to_deps)
178
179 if (opts.output_json):
180 output_dict = {
181 'blacklist' : blacklist
182 }
183 with open(opts.output_json, 'w') as output_json_file:
184 json.dump(output_dict, output_json_file)
185 else:
186 print blacklist
187
188 return 0
189
190
191 if __name__ == '__main__':
192 sys.exit(main())
OLDNEW
« no previous file with comments | « android_webview/buildbot/OWNERS ('k') | android_webview/buildbot/generate_local_manifest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698