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