OLD | NEW |
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() |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 REPO_URL=repo_url, | 42 REPO_URL=repo_url, |
43 BUILD_CONFIG=target) | 43 BUILD_CONFIG=target) |
44 | 44 |
45 # TODO(sivachandra): Move the setting of the gclient spec below to an | 45 # TODO(sivachandra): Move the setting of the gclient spec below to an |
46 # internal config extension when they are supported by the recipe system. | 46 # internal config extension when they are supported by the recipe system. |
47 spec = self.m.gclient.make_config('android_bare') | 47 spec = self.m.gclient.make_config('android_bare') |
48 spec.target_os = ['android'] | 48 spec.target_os = ['android'] |
49 s = spec.solutions[0] | 49 s = spec.solutions[0] |
50 s.name = repo_name | 50 s.name = repo_name |
51 s.url = repo_url | 51 s.url = repo_url |
52 s.custom_vars = self.c.custom_vars | |
53 s.custom_deps = gclient_custom_deps or {} | 52 s.custom_deps = gclient_custom_deps or {} |
54 if revision: | 53 if revision: |
55 s.revision = revision | 54 s.revision = revision |
56 else: | 55 else: |
57 s.revision = 'refs/remotes/origin/master' | 56 s.revision = 'refs/remotes/origin/master' |
58 | 57 |
59 yield self.m.gclient.checkout(spec) | 58 yield self.m.gclient.checkout(spec) |
60 | 59 |
61 # TODO(sivachandra): Manufacture gclient spec such that it contains "src" | 60 # TODO(sivachandra): Manufacture gclient spec such that it contains "src" |
62 # solution + repo_name solution. Then checkout will be automatically | 61 # solution + repo_name solution. Then checkout will be automatically |
(...skipping 10 matching lines...) Expand all Loading... |
73 if isinstance(val, list): | 72 if isinstance(val, list): |
74 gyp_defs[gyp_def] = self.m.path.checkout(*val) | 73 gyp_defs[gyp_def] = self.m.path.checkout(*val) |
75 | 74 |
76 if internal: | 75 if internal: |
77 yield self.m.step( | 76 yield self.m.step( |
78 'get app_manifest_vars', | 77 'get app_manifest_vars', |
79 [self.m.path.checkout( | 78 [self.m.path.checkout( |
80 self._internal_dir, 'build', 'dump_app_manifest_vars.py'), | 79 self._internal_dir, 'build', 'dump_app_manifest_vars.py'), |
81 '-b', self.m.properties['buildername'], | 80 '-b', self.m.properties['buildername'], |
82 '-v', self.m.path.checkout('chrome', 'VERSION'), | 81 '-v', self.m.path.checkout('chrome', 'VERSION'), |
83 self.m.json.output()] | 82 '--output-json', self.m.json.output()] |
84 ) | 83 ) |
85 | 84 |
86 app_manifest_vars = self.m.step_history.last_step().json.output | 85 app_manifest_vars = self.m.step_history.last_step().json.output |
87 gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES | 86 gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES |
88 gyp_defs['app_manifest_version_code'] = app_manifest_vars['version_code'] | 87 gyp_defs['app_manifest_version_code'] = app_manifest_vars['version_code'] |
89 gyp_defs['app_manifest_version_name'] = app_manifest_vars['version_name'] | 88 gyp_defs['app_manifest_version_name'] = app_manifest_vars['version_name'] |
90 gyp_defs['chrome_build_id'] = app_manifest_vars['build_id'] | 89 gyp_defs['chrome_build_id'] = app_manifest_vars['build_id'] |
91 | 90 |
92 def envsetup(self): | 91 def envsetup(self): |
93 envsetup_cmd = [self.m.path.checkout('build', 'android', 'envsetup.sh')] | 92 envsetup_cmd = [self.m.path.checkout('build', 'android', 'envsetup.sh')] |
94 if self.c.target_arch: | 93 if self.c.target_arch: |
95 envsetup_cmd += ['--target-arch=%s' % self.c.target_arch] | 94 envsetup_cmd += ['--target-arch=%s' % self.c.target_arch] |
96 | 95 |
97 cmd = ([self.m.path.checkout('build', 'env_dump.py'), | 96 cmd = ([self.m.path.checkout('build', 'env_dump.py'), |
98 self.m.json.output()] + envsetup_cmd) | 97 '--output-json', self.m.json.output()] + envsetup_cmd) |
99 yield self.m.step('envsetup', cmd, env=self.get_env()) | 98 yield self.m.step('envsetup', cmd, env=self.get_env()) |
100 | 99 |
101 env_diff = self.m.step_history.last_step().json.output | 100 env_diff = self.m.step_history.last_step().json.output |
102 for key, value in env_diff.iteritems(): | 101 for key, value in env_diff.iteritems(): |
103 if key.startswith('GYP_'): | 102 if key.startswith('GYP_'): |
104 continue | 103 continue |
105 else: | 104 else: |
106 self._env[key] = value | 105 self._env[key] = value |
107 | 106 |
108 def clean_local_files(self): | 107 def clean_local_files(self): |
(...skipping 16 matching lines...) Expand all Loading... |
125 | 124 |
126 def run_tree_truth(self, show_revisions=False): | 125 def run_tree_truth(self, show_revisions=False): |
127 # TODO(sivachandra): The downstream ToT builder will require | 126 # TODO(sivachandra): The downstream ToT builder will require |
128 # 'Show Revisions' step. | 127 # 'Show Revisions' step. |
129 repos = ['src', 'src-internal'] | 128 repos = ['src', 'src-internal'] |
130 if self.c.REPO_NAME not in repos: | 129 if self.c.REPO_NAME not in repos: |
131 repos.append(self.c.REPO_NAME) | 130 repos.append(self.c.REPO_NAME) |
132 # TODO(sivachandra): Disable subannottations after cleaning up | 131 # TODO(sivachandra): Disable subannottations after cleaning up |
133 # tree_truth.sh. | 132 # tree_truth.sh. |
134 yield self.m.step('tree truth steps', | 133 yield self.m.step('tree truth steps', |
135 [self.m.path.checkout('build', 'tree_truth.sh'), | 134 [self.m.path.checkout('build', 'tree_truth.sh'), |
136 self.m.path.checkout()] + repos, | 135 self.m.path.checkout()] + repos, |
137 allow_subannottations=True) | 136 allow_subannottations=True) |
138 | 137 |
139 def runhooks(self): | 138 def runhooks(self): |
140 run_hooks_env = self.get_env() | 139 run_hooks_env = self.get_env() |
141 if self.m.properties.get('internal'): | 140 if self.m.properties.get('internal'): |
142 run_hooks_env['EXTRA_LANDMINES_SCRIPT'] = self.m.path.checkout( | 141 run_hooks_env['EXTRA_LANDMINES_SCRIPT'] = self.m.path.checkout( |
143 self._internal_dir, 'build', 'get_internal_landmines.py') | 142 self._internal_dir, 'build', 'get_internal_landmines.py') |
144 return self.m.chromium.runhooks(env=run_hooks_env) | 143 return self.m.chromium.runhooks(env=run_hooks_env) |
145 | 144 |
(...skipping 15 matching lines...) Expand all Loading... |
161 [self.m.path.checkout('tools', 'checkdeps', 'checkdeps.py'), | 160 [self.m.path.checkout('tools', 'checkdeps', 'checkdeps.py'), |
162 '--root=%s' % self._internal_dir], | 161 '--root=%s' % self._internal_dir], |
163 env=self.get_env()) | 162 env=self.get_env()) |
164 | 163 |
165 def lint(self): | 164 def lint(self): |
166 if self.c.INTERNAL: | 165 if self.c.INTERNAL: |
167 return self.m.step( | 166 return self.m.step( |
168 'lint', | 167 'lint', |
169 [self.m.path.checkout(self._internal_dir, 'bin', 'lint.py')], | 168 [self.m.path.checkout(self._internal_dir, 'bin', 'lint.py')], |
170 env=self.get_env()) | 169 env=self.get_env()) |
OLD | NEW |