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

Side by Side Diff: scripts/slave/recipe_modules/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: Address comments 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 """Common steps for recipes that sync/build Android sources.""" 5 """Common steps for recipes that sync/build Android sources."""
6 6
7 from slave import recipe_api 7 from slave import recipe_api
8 8
9 class AOSPApi(recipe_api.RecipeApi): 9 class AOSPApi(recipe_api.RecipeApi):
10 def __init__(self, **kwargs): 10 def __init__(self, **kwargs):
11 super(AOSPApi, self).__init__(**kwargs) 11 super(AOSPApi, self).__init__(**kwargs)
12 self._repo_path = None 12 self._repo_path = None
13 13
14 # TODO(iannucci): use path.checkout
15 SLAVE_ANDROID_ROOT_NAME = 'android-src'
16 _CHROMIUM_IN_ANDROID_SUBPATH = 'external/chromium_org'
17
18 @property
19 def slave_chromium_in_android_path(self):
20 return self.m.path.slave_build(self.SLAVE_ANDROID_ROOT_NAME,
21 self._CHROMIUM_IN_ANDROID_SUBPATH)
22
23 @property
24 def build_path(self):
25 return self.m.path.slave_build(self.SLAVE_ANDROID_ROOT_NAME)
26
27 @property
28 def slave_android_out_path(self):
29 return self.m.path.slave_build(self.SLAVE_ANDROID_ROOT_NAME, 'out')
30
31 @property 14 @property
32 def with_lunch_command(self): 15 def with_lunch_command(self):
33 return [self.m.path.build('scripts', 'slave', 'android', 'with_lunch'), 16 return [self.m.path.build('scripts', 'slave', 'android', 'with_lunch'),
34 self.build_path, 17 self.c.build_path,
35 self.c.lunch_flavor] 18 self.c.lunch_flavor]
36 19
37 @recipe_api.inject_test_data 20 @recipe_api.inject_test_data
38 def calculate_trimmed_deps(self): 21 def calculate_trimmed_deps(self):
39 return self.m.step( 22 return self.m.step(
40 'calculate trimmed deps', 23 'calculate trimmed deps',
41 [ 24 [
42 self.m.path.checkout('android_webview', 'buildbot', 25 self.m.path.checkout('android_webview', 'buildbot',
43 'deps_whitelist.py'), 26 'deps_whitelist.py'),
44 '--method', 'android_build', 27 '--method', 'android_build',
(...skipping 22 matching lines...) Expand all
67 self.m.gclient.spec_alias = 'trimmed' 50 self.m.gclient.spec_alias = 'trimmed'
68 yield self.m.gclient.checkout(spec) 51 yield self.m.gclient.checkout(spec)
69 del self.m.gclient.spec_alias 52 del self.m.gclient.spec_alias
70 53
71 def lastchange_steps(self): 54 def lastchange_steps(self):
72 lastchange_command = self.m.path.checkout('build', 'util', 'lastchange.py') 55 lastchange_command = self.m.path.checkout('build', 'util', 'lastchange.py')
73 yield ( 56 yield (
74 self.m.step('Chromium LASTCHANGE', [ 57 self.m.step('Chromium LASTCHANGE', [
75 lastchange_command, 58 lastchange_command,
76 '-o', self.m.path.checkout('build', 'util', 'LASTCHANGE'), 59 '-o', self.m.path.checkout('build', 'util', 'LASTCHANGE'),
77 '-s', self.m.path.checkout()]), 60 '-s', self.m.path.checkout]),
78 self.m.step('Blink LASTCHANGE', [ 61 self.m.step('Blink LASTCHANGE', [
79 lastchange_command, 62 lastchange_command,
80 '-o', self.m.path.checkout('build', 'util', 'LASTCHANGE.blink'), 63 '-o', self.m.path.checkout('build', 'util', 'LASTCHANGE.blink'),
81 '-s', self.m.path.checkout('third_party', 'WebKit')]) 64 '-s', self.m.path.checkout('third_party', 'WebKit')])
82 ) 65 )
83 66
84 # TODO(iannucci): Refactor repo stuff into another module? 67 # TODO(iannucci): Refactor repo stuff into another module?
85 def repo_init_steps(self): 68 def repo_init_steps(self):
86 # The version of repo checked into depot_tools doesn't support switching 69 # The version of repo checked into depot_tools doesn't support switching
87 # between branches correctly due to 70 # between branches correctly due to
88 # https://code.google.com/p/git-repo/issues/detail?id=46 which is why we use 71 # https://code.google.com/p/git-repo/issues/detail?id=46 which is why we use
89 # the copy of repo from the Android tree. 72 # the copy of repo from the Android tree.
90 # The copy of repo from depot_tools is only used to bootstrap the Android 73 # The copy of repo from depot_tools is only used to bootstrap the Android
91 # tree checkout. 74 # tree checkout.
92 repo_in_android_path = self.m.path.slave_build( 75 repo_in_android_path = self.c.build_path('.repo', 'repo', 'repo')
93 self.SLAVE_ANDROID_ROOT_NAME, '.repo', 'repo', 'repo')
94 repo_copy_dir = self.m.path.slave_build('repo_copy') 76 repo_copy_dir = self.m.path.slave_build('repo_copy')
95 repo_copy_path = self.m.path.slave_build('repo_copy', 'repo') 77 repo_copy_path = self.m.path.slave_build('repo_copy', 'repo')
96 if self.m.path.exists(repo_in_android_path): 78 if self.m.path.exists(repo_in_android_path):
97 yield self.m.path.makedirs('repo copy dir', repo_copy_dir) 79 yield self.m.path.makedirs('repo copy dir', repo_copy_dir)
98 yield self.m.step('copy repo from Android', [ 80 yield self.m.step('copy repo from Android', [
99 'cp', repo_in_android_path, repo_copy_path]) 81 'cp', repo_in_android_path, repo_copy_path])
100 self.m.repo.repo_path = repo_copy_path 82 self.m.repo.repo_path = repo_copy_path
101 yield self.m.path.makedirs('android source root', self.build_path) 83 yield self.m.path.makedirs('android source root', self.c.build_path)
102 yield self.m.repo.init(self.c.repo.url, '-b', self.c.repo.branch, 84 yield self.m.repo.init(self.c.repo.url, '-b', self.c.repo.branch,
103 cwd=self.build_path) 85 cwd=self.c.build_path)
104 self.m.path.mock_add_paths(repo_in_android_path) 86 self.m.path.mock_add_paths(repo_in_android_path)
105 87
106 def generate_local_manifest_step(self): 88 def generate_local_manifest_step(self):
107 yield self.m.step( 89 yield self.m.step(
108 'generate local manifest', [ 90 'generate local manifest', [
109 self.m.path.checkout('android_webview', 'buildbot', 91 self.m.path.checkout('android_webview', 'buildbot',
110 'generate_local_manifest.py'), 92 'generate_local_manifest.py'),
111 self.build_path, 93 self.c.build_path,
112 self._CHROMIUM_IN_ANDROID_SUBPATH]) 94 self.c.chromium_in_android_subpath])
113 95
114 def repo_sync_steps(self): 96 def repo_sync_steps(self):
115 # repo_init_steps must have been invoked first. 97 # repo_init_steps must have been invoked first.
116 yield self.m.repo.sync(*self.c.repo.sync_flags, cwd=self.build_path) 98 yield self.m.repo.sync(*self.c.repo.sync_flags, cwd=self.c.build_path)
117 99
118 def symlink_chromium_into_android_tree_step(self): 100 def symlink_chromium_into_android_tree_step(self):
119 if self.m.path.exists(self.slave_chromium_in_android_path): 101 if self.m.path.exists(self.c.slave_chromium_in_android_path):
120 yield self.m.step('remove chromium_org', 102 yield self.m.step('remove chromium_org',
121 ['rm', '-rf', self.slave_chromium_in_android_path]) 103 ['rm', '-rf', self.c.slave_chromium_in_android_path])
122 104
123 yield self.m.step('symlink chromium_org', [ 105 yield self.m.step('symlink chromium_org', [
124 'ln', '-s', 106 'ln', '-s',
125 self.m.path.checkout(), 107 self.m.path.checkout,
126 self.slave_chromium_in_android_path]), 108 self.c.slave_chromium_in_android_path]),
127 109
128 def gyp_webview_step(self): 110 def gyp_webview_step(self):
129 yield self.m.step('gyp_webview', self.with_lunch_command + [ 111 yield self.m.step('gyp_webview', self.with_lunch_command + [
130 self.m.path.slave_build( 112 self.c.slave_chromium_in_android_path('android_webview', 'tools',
131 self.SLAVE_ANDROID_ROOT_NAME, 'external', 'chromium_org', 113 'gyp_webview')],
132 'android_webview', 'tools', 'gyp_webview')], 114 cwd=self.c.slave_chromium_in_android_path)
133 cwd=self.slave_chromium_in_android_path)
134 115
135 def compile_step(self, build_tool, step_name='compile', targets=None, 116 def compile_step(self, build_tool, step_name='compile', targets=None,
136 use_goma=True, src_dir=None, target_out_dir=None, 117 use_goma=True, src_dir=None, target_out_dir=None,
137 envsetup=None): 118 envsetup=None):
138 src_dir = src_dir or self.build_path 119 src_dir = src_dir or self.c.build_path
139 target_out_dir = target_out_dir or self.slave_android_out_path 120 target_out_dir = target_out_dir or self.c.slave_android_out_path
140 envsetup = envsetup or self.with_lunch_command 121 envsetup = envsetup or self.with_lunch_command
141 targets = targets or [] 122 targets = targets or []
142 compiler_option = [] 123 compiler_option = []
143 compile_script = [self.m.path.build('scripts', 'slave', 'compile.py')] 124 compile_script = [self.m.path.build('scripts', 'slave', 'compile.py')]
144 if use_goma and self.m.path.exists(self.m.path.build('goma')): 125 if use_goma and self.m.path.exists(self.m.path.build('goma')):
145 compiler_option = ['--compiler', 'goma', 126 compiler_option = ['--compiler', 'goma',
146 '--goma-dir', self.m.path.build('goma')] 127 '--goma-dir', self.m.path.build('goma')]
147 yield self.m.step(step_name, 128 yield self.m.step(step_name,
148 envsetup + 129 envsetup +
149 compile_script + 130 compile_script +
150 targets + 131 targets +
151 ['--build-dir', self.m.path.slave_build()] + 132 ['--build-dir', self.m.path.slave_build] +
152 ['--src-dir', src_dir] + 133 ['--src-dir', src_dir] +
153 ['--build-tool', build_tool] + 134 ['--build-tool', build_tool] +
154 ['--verbose'] + 135 ['--verbose'] +
155 compiler_option, 136 compiler_option,
156 cwd=self.m.path.slave_build()) 137 cwd=self.m.path.slave_build)
157 138
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698