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

Side by Side Diff: scripts/slave/recipe_modules/chromium_android/api.py

Issue 24737002: Add Paths as first-class types in configs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 2 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from slave import recipe_api 5 from slave import recipe_api
6 6
7 class AndroidApi(recipe_api.RecipeApi): 7 class AndroidApi(recipe_api.RecipeApi):
8 def __init__(self, **kwargs): 8 def __init__(self, **kwargs):
9 super(AndroidApi, self).__init__(**kwargs) 9 super(AndroidApi, self).__init__(**kwargs)
10 self._env = dict() 10 self._env = dict()
11 self._build_internal_android = None
12 self._internal_dir = None 11 self._internal_dir = None
13 12
14 def get_env(self): 13 def get_env(self):
15 env_dict = dict(self._env) 14 env_dict = dict(self._env)
16 for env_var, value in self.c.extra_env.iteritems(): 15 env_dict.update(self.c.extra_env)
17 if isinstance(value, list):
18 env_dict[env_var] = self.m.path.checkout(*value)
19 else:
20 env_dict[env_var] = value
21 # TODO(sivachandra): Use os.pathsep equivalent instead of ':' when it
22 # provided by one of the recipe modules.
23 env_dict['PATH'] = self.m.path.pathsep.join(filter(bool, ( 16 env_dict['PATH'] = self.m.path.pathsep.join(filter(bool, (
24 self._build_internal_android, 17 str(self.c.build_internal_android),
25 self._env.get('PATH',''), 18 self._env.get('PATH',''),
26 '%(PATH)s' 19 '%(PATH)s'
27 ))) 20 )))
28 return env_dict 21 return env_dict
29 22
30 def init_and_sync(self): 23 def init_and_sync(self):
31 internal = self.m.properties['internal'] 24 internal = self.m.properties['internal']
32 bot_id = self.m.properties['android_bot_id'] 25 bot_id = self.m.properties['android_bot_id']
33 target = self.m.properties.get('target', 'Debug') 26 target = self.m.properties.get('target', 'Debug')
34 repo_name = self.m.properties['repo_name'] 27 repo_name = self.m.properties['repo_name']
35 repo_url = self.m.properties['repo_url'] 28 repo_url = self.m.properties['repo_url']
36 revision = self.m.properties.get('revision') 29 revision = self.m.properties.get('revision')
37 gclient_custom_deps = self.m.properties.get('gclient_custom_deps') 30 gclient_custom_deps = self.m.properties.get('gclient_custom_deps')
38 31
39 if internal: 32 if internal:
40 self._internal_dir = repo_name.split('/', 1)[-1] 33 self._internal_dir = self.m.path.checkout(repo_name.split('/', 1)[-1])
41 34
42 self.set_config(bot_id, 35 self.set_config(bot_id,
43 INTERNAL=internal, 36 INTERNAL=internal,
44 REPO_NAME=repo_name, 37 REPO_NAME=repo_name,
45 REPO_URL=repo_url, 38 REPO_URL=repo_url,
46 BUILD_CONFIG=target) 39 BUILD_CONFIG=target)
47 40
48 # TODO(sivachandra): Move the setting of the gclient spec below to an 41 # TODO(sivachandra): Move the setting of the gclient spec below to an
49 # internal config extension when they are supported by the recipe system. 42 # internal config extension when they are supported by the recipe system.
50 spec = self.m.gclient.make_config('android_bare') 43 spec = self.m.gclient.make_config('android_bare')
51 spec.target_os = ['android'] 44 spec.target_os = ['android']
52 s = spec.solutions[0] 45 s = spec.solutions[0]
53 s.name = repo_name 46 s.name = repo_name
54 s.url = repo_url 47 s.url = repo_url
55 s.custom_deps = gclient_custom_deps or {} 48 s.custom_deps = gclient_custom_deps or {}
56 if revision: 49 if revision:
57 s.revision = revision 50 s.revision = revision
58 else: 51 else:
59 s.revision = 'refs/remotes/origin/master' 52 s.revision = 'refs/remotes/origin/master'
60 53
61 yield self.m.gclient.checkout(spec) 54 yield self.m.gclient.checkout(spec)
62 55
63 # TODO(sivachandra): Manufacture gclient spec such that it contains "src" 56 # TODO(sivachandra): Manufacture gclient spec such that it contains "src"
64 # solution + repo_name solution. Then checkout will be automatically 57 # solution + repo_name solution. Then checkout will be automatically
65 # correctly set by gclient.checkout 58 # correctly set by gclient.checkout
66 manual_checkout_path = self.m.path.slave_build('src') 59 self.m.path.set_dynamic_path('checkout', self.m.path.slave_build('src'))
67 self.m.path.add_checkout(manual_checkout_path)
68 self.m.path.choose_checkout(manual_checkout_path)
69
70 self._build_internal_android = self.m.path.build_internal(
71 'scripts', 'slave', 'android')
72 60
73 gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES 61 gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES
74 for gyp_def, val in gyp_defs.items():
75 if isinstance(val, list):
76 gyp_defs[gyp_def] = self.m.path.checkout(*val)
77 62
78 if internal: 63 if internal:
79 yield self.m.step( 64 yield self.m.step(
80 'get app_manifest_vars', 65 'get app_manifest_vars',
81 [self.m.path.checkout( 66 [self._internal_dir('build', 'dump_app_manifest_vars.py'),
82 self._internal_dir, 'build', 'dump_app_manifest_vars.py'),
83 '-b', self.m.properties['buildername'], 67 '-b', self.m.properties['buildername'],
84 '-v', self.m.path.checkout('chrome', 'VERSION'), 68 '-v', self.m.path.checkout('chrome', 'VERSION'),
85 '--output-json', self.m.json.output()] 69 '--output-json', self.m.json.output()]
86 ) 70 )
87 71
88 app_manifest_vars = self.m.step_history.last_step().json.output 72 app_manifest_vars = self.m.step_history.last_step().json.output
89 gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES 73 gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES
90 gyp_defs['app_manifest_version_code'] = app_manifest_vars['version_code'] 74 gyp_defs['app_manifest_version_code'] = app_manifest_vars['version_code']
91 gyp_defs['app_manifest_version_name'] = app_manifest_vars['version_name'] 75 gyp_defs['app_manifest_version_name'] = app_manifest_vars['version_name']
92 gyp_defs['chrome_build_id'] = app_manifest_vars['build_id'] 76 gyp_defs['chrome_build_id'] = app_manifest_vars['build_id']
(...skipping 25 matching lines...) Expand all
118 shutil.rmtree(sys.argv[1], True) 102 shutil.rmtree(sys.argv[1], True)
119 shutil.rmtree(sys.argv[2], True) 103 shutil.rmtree(sys.argv[2], True)
120 for base, _dirs, files in os.walk(sys.argv[3]): 104 for base, _dirs, files in os.walk(sys.argv[3]):
121 for f in files: 105 for f in files:
122 if f.endswith('.pyc'): 106 if f.endswith('.pyc'):
123 os.remove(os.path.join(base, f)) 107 os.remove(os.path.join(base, f))
124 """, 108 """,
125 args=[debug_info_dumps, test_logs, self.m.path.checkout()], 109 args=[debug_info_dumps, test_logs, self.m.path.checkout()],
126 ) 110 )
127 111
128 def run_tree_truth(self, show_revisions=False): 112 def run_tree_truth(self):
129 # TODO(sivachandra): The downstream ToT builder will require 113 # TODO(sivachandra): The downstream ToT builder will require
130 # 'Show Revisions' step. 114 # 'Show Revisions' step.
131 repos = ['src', 'src-internal'] 115 repos = ['src', 'src-internal']
132 if self.c.REPO_NAME not in repos: 116 if self.c.REPO_NAME not in repos:
133 repos.append(self.c.REPO_NAME) 117 repos.append(self.c.REPO_NAME)
134 # TODO(sivachandra): Disable subannottations after cleaning up 118 # TODO(sivachandra): Disable subannottations after cleaning up
135 # tree_truth.sh. 119 # tree_truth.sh.
136 yield self.m.step('tree truth steps', 120 yield self.m.step('tree truth steps',
137 [self.m.path.checkout('build', 'tree_truth.sh'), 121 [self.m.path.checkout('build', 'tree_truth.sh'),
138 self.m.path.checkout()] + repos, 122 self.m.path.checkout()] + repos,
139 allow_subannottations=True) 123 allow_subannottations=True)
140 124
141 def runhooks(self): 125 def runhooks(self):
142 run_hooks_env = self.get_env() 126 run_hooks_env = self.get_env()
143 if self.m.properties.get('internal'): 127 if self.m.properties.get('internal'):
144 run_hooks_env['EXTRA_LANDMINES_SCRIPT'] = self.m.path.checkout( 128 run_hooks_env['EXTRA_LANDMINES_SCRIPT'] = self._internal_dir(
145 self._internal_dir, 'build', 'get_internal_landmines.py') 129 'build', 'get_internal_landmines.py')
146 return self.m.chromium.runhooks(env=run_hooks_env) 130 return self.m.chromium.runhooks(env=run_hooks_env)
147 131
148 def apply_svn_patch(self): 132 def apply_svn_patch(self):
149 # TODO(sivachandra): We should probably pull this into its own module 133 # TODO(sivachandra): We should probably pull this into its own module
150 # (maybe a 'tryserver' module) at some point. 134 # (maybe a 'tryserver' module) at some point.
151 return self.m.step( 135 return self.m.step(
152 'apply_patch', 136 'apply_patch',
153 [self.m.path.build('scripts', 'slave', 'apply_svn_patch.py'), 137 [self.m.path.build('scripts', 'slave', 'apply_svn_patch.py'),
154 '-p', self.m.properties['patch_url'], 138 '-p', self.m.properties['patch_url'],
155 '-r', self._internal_dir]) 139 '-r', self._internal_dir])
156 140
157 def compile(self, target='Debug'): 141 def compile(self):
158 return self.m.chromium.compile(env=self.get_env()) 142 return self.m.chromium.compile(env=self.get_env())
159 143
160 def findbugs(self): 144 def findbugs(self):
161 cmd = [self.m.path.checkout('build', 'android', 'findbugs_diff.py')] 145 cmd = [self.m.path.checkout('build', 'android', 'findbugs_diff.py')]
162 if self.c.INTERNAL: 146 if self.c.INTERNAL:
163 cmd.extend( 147 cmd.extend(
164 ['-b', 148 ['-b', self._internal_dir('bin', 'findbugs_filter'),
165 self.m.path.checkout(self._internal_dir, 'bin', 'findbugs_filter'),
166 '-o', 'com.google.android.apps.chrome.-,org.chromium.-']) 149 '-o', 'com.google.android.apps.chrome.-,org.chromium.-'])
167 return self.m.step('findbugs internal', cmd, env=self.get_env()) 150 return self.m.step('findbugs internal', cmd, env=self.get_env())
168 151
169 def checkdeps(self): 152 def checkdeps(self):
170 return self.m.step( 153 return self.m.step(
171 'checkdeps', 154 'checkdeps',
172 [self.m.path.checkout('tools', 'checkdeps', 'checkdeps.py'), 155 [self.m.path.checkout('tools', 'checkdeps', 'checkdeps.py'),
173 '--root=%s' % self._internal_dir], 156 '--root=%s' % self._internal_dir],
174 env=self.get_env()) 157 env=self.get_env())
175 158
176 def lint(self): 159 def lint(self):
177 if self.c.INTERNAL: 160 if self.c.INTERNAL:
178 return self.m.step( 161 return self.m.step(
179 'lint', 162 'lint',
180 [self.m.path.checkout(self._internal_dir, 'bin', 'lint.py')], 163 [self._internal_dir('bin', 'lint.py')],
181 env=self.get_env()) 164 env=self.get_env())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698