OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import contextlib | 5 import contextlib |
6 | 6 |
7 DEPS = [ | 7 DEPS = [ |
8 'depot_tools/git', | 8 'depot_tools/git', |
9 'depot_tools/infra_paths', | |
10 'file', | 9 'file', |
11 'gsutil', | 10 'gsutil', |
12 'recipe_engine/json', | 11 'recipe_engine/json', |
13 'recipe_engine/path', | 12 'recipe_engine/path', |
14 'recipe_engine/platform', | 13 'recipe_engine/platform', |
15 'recipe_engine/properties', | 14 'recipe_engine/properties', |
16 'recipe_engine/step', | 15 'recipe_engine/step', |
17 'recipe_engine/python', | 16 'recipe_engine/python', |
18 ] | 17 ] |
19 | 18 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 """Runs the `build/scripts/slave/ios/find_xcode.py` utility. | 143 """Runs the `build/scripts/slave/ios/find_xcode.py` utility. |
145 | 144 |
146 Retrieves information about xcode installations and to activate a specific | 145 Retrieves information about xcode installations and to activate a specific |
147 version of Xcode. | 146 version of Xcode. |
148 """ | 147 """ |
149 args = ['--json-file', api.json.output()] | 148 args = ['--json-file', api.json.output()] |
150 | 149 |
151 if target_version is not None: | 150 if target_version is not None: |
152 args.extend(['--version', target_version]) | 151 args.extend(['--version', target_version]) |
153 | 152 |
154 result = api.python(step_name, api.infra_paths['build'].join('scripts', 'slave
', | 153 result = api.python(step_name, api.path['build'].join('scripts', 'slave', |
155 'ios', 'find_xcode.py'), args) | 154 'ios', 'find_xcode.py'), args) |
156 | 155 |
157 return result.json.output | 156 return result.json.output |
158 | 157 |
159 | 158 |
160 def SetupXcode(api): | 159 def SetupXcode(api): |
161 xcode_json = RunFindXcode(api, 'enumerate_xcode_installations') | 160 xcode_json = RunFindXcode(api, 'enumerate_xcode_installations') |
162 installations = xcode_json["installations"] | 161 installations = xcode_json["installations"] |
163 activate_version = None | 162 activate_version = None |
164 for key in installations: | 163 for key in installations: |
165 version = installations[key].split()[0] | 164 version = installations[key].split()[0] |
166 if version.startswith('7.'): | 165 if version.startswith('7.'): |
167 activate_version = version | 166 activate_version = version |
168 break | 167 break |
169 if not activate_version: | 168 if not activate_version: |
170 raise api.step.StepFailure('Xcode version 7 or above not found') | 169 raise api.step.StepFailure('Xcode version 7 or above not found') |
171 RunFindXcode(api, 'set_xcode_version', target_version=activate_version) | 170 RunFindXcode(api, 'set_xcode_version', target_version=activate_version) |
172 | 171 |
173 | 172 |
174 def RunSteps(api): | 173 def RunSteps(api): |
175 # buildbot sets 'clobber' to the empty string which is falsey, check with 'in' | 174 # buildbot sets 'clobber' to the empty string which is falsey, check with 'in' |
176 if 'clobber' in api.properties: | 175 if 'clobber' in api.properties: |
177 api.file.rmcontents('everything', api.infra_paths['slave_build']) | 176 api.file.rmcontents('everything', api.path['slave_build']) |
178 | 177 |
179 git_hash = api.git.checkout( | 178 git_hash = api.git.checkout( |
180 'https://chromium.googlesource.com/external/github.com/flutter/flutter', | 179 'https://chromium.googlesource.com/external/github.com/flutter/flutter', |
181 recursive=True, set_got_revision=True) | 180 recursive=True, set_got_revision=True) |
182 checkout = api.path['checkout'] | 181 checkout = api.path['checkout'] |
183 | 182 |
184 api.step('download android tools', | 183 api.step('download android tools', |
185 [checkout.join('infra', 'download_android_tools.py')]) | 184 [checkout.join('infra', 'download_android_tools.py')]) |
186 | 185 |
187 dart_bin = checkout.join('bin', 'cache', 'dart-sdk', 'bin') | 186 dart_bin = checkout.join('bin', 'cache', 'dart-sdk', 'bin') |
188 flutter_bin = checkout.join('bin') | 187 flutter_bin = checkout.join('bin') |
189 # TODO(eseidel): This is named exactly '.pub-cache' as a hack around | 188 # TODO(eseidel): This is named exactly '.pub-cache' as a hack around |
190 # a regexp in flutter_tools analyze.dart which is in turn a hack around: | 189 # a regexp in flutter_tools analyze.dart which is in turn a hack around: |
191 # https://github.com/dart-lang/sdk/issues/25722 | 190 # https://github.com/dart-lang/sdk/issues/25722 |
192 pub_cache = api.infra_paths['slave_build'].join('.pub-cache') | 191 pub_cache = api.path['slave_build'].join('.pub-cache') |
193 env = { | 192 env = { |
194 'PATH': api.path.pathsep.join((str(flutter_bin), str(dart_bin), | 193 'PATH': api.path.pathsep.join((str(flutter_bin), str(dart_bin), |
195 '%(PATH)s')), | 194 '%(PATH)s')), |
196 # Setup our own pub_cache to not affect other slaves on this machine. | 195 # Setup our own pub_cache to not affect other slaves on this machine. |
197 'PUB_CACHE': pub_cache, | 196 'PUB_CACHE': pub_cache, |
198 'ANDROID_HOME': checkout.join('infra', 'android_tools'), | 197 'ANDROID_HOME': checkout.join('infra', 'android_tools'), |
199 } | 198 } |
200 | 199 |
201 # The context adds dart-sdk tools to PATH sets PUB_CACHE. | 200 # The context adds dart-sdk tools to PATH sets PUB_CACHE. |
202 with api.step.context({'env': env}): | 201 with api.step.context({'env': env}): |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 yield test | 243 yield test |
245 | 244 |
246 yield ( | 245 yield ( |
247 api.test('mac_cannot_find_xcode') + | 246 api.test('mac_cannot_find_xcode') + |
248 api.platform('mac', 64) + | 247 api.platform('mac', 64) + |
249 api.properties(clobber='') + | 248 api.properties(clobber='') + |
250 api.step_data('enumerate_xcode_installations', api.json.output({ | 249 api.step_data('enumerate_xcode_installations', api.json.output({ |
251 'installations': {} | 250 'installations': {} |
252 })) | 251 })) |
253 ) | 252 ) |
OLD | NEW |