Chromium Code Reviews| Index: scripts/slave/recipes/flutter/flutter.py |
| diff --git a/scripts/slave/recipes/flutter/flutter.py b/scripts/slave/recipes/flutter/flutter.py |
| index 558d0016a9b5d9365e0270556b29eaffc9f2444e..00095c24636905da8db5390136d8bbb4907ec0cc 100644 |
| --- a/scripts/slave/recipes/flutter/flutter.py |
| +++ b/scripts/slave/recipes/flutter/flutter.py |
| @@ -8,10 +8,12 @@ DEPS = [ |
| 'depot_tools/git', |
| 'file', |
| 'gsutil', |
| + 'recipe_engine/json', |
| 'recipe_engine/path', |
| 'recipe_engine/platform', |
| 'recipe_engine/properties', |
| 'recipe_engine/step', |
| + 'recipe_engine/python', |
| ] |
| BUCKET_NAME = 'flutter_infra' |
| @@ -127,6 +129,37 @@ def BuildExamples(api, git_hash): |
| ArchiveAPK(api, 'examples/material_gallery', 'Gallery.apk') |
| +def RunFindXcode(api, step_name, target_version=None): |
| + """Runs the `build/scripts/slave/ios/find_xcode.py` utility to retrieve |
| + information about xcode installations and to activate a specific version |
| + of Xcode. |
|
smut
2016/03/05 02:03:47
"""<One liner>
<Additional info>
"""
yjbanov
2016/03/06 22:53:42
Done.
|
| + """ |
| + args = ['--json-file', api.json.output()] |
| + |
| + if target_version is not None: |
| + args.extend(['--version', '7.2.1']) |
|
smut
2016/03/05 02:03:47
I'm not sure this is what you intended. If target_
yjbanov
2016/03/06 22:53:42
Oops. Left-over. Fixed.
|
| + |
| + result = api.python(step_name, api.path['build'].join('scripts', 'slave', |
| + 'ios', 'find_xcode.py'), args) |
| + |
| + return result.json.output |
| + |
| + |
| +def SetupXcode(api): |
| + xcode_json = RunFindXcode(api, 'enumerate_xcode_installations') |
| + installations = xcode_json["installations"] |
| + activate_version = None |
| + for key in installations: |
| + version = installations[key].split()[0] |
| + if version.startswith('7.'): |
| + activate_version = version |
| + break |
| + if activate_version is None: |
|
smut
2016/03/05 02:03:47
if not activate_version:
yjbanov
2016/03/06 22:53:42
Done.
|
| + raise Exception('Xcode version 7 or above not found') |
|
smut
2016/03/05 02:03:47
raise api.step.StepFailure(...) or api.step.InfraF
yjbanov
2016/03/06 22:53:42
Done.
|
| + print 'Activating Xcode version %s' % version |
|
smut
2016/03/05 02:03:47
Don't print outside a step. You can just delete th
yjbanov
2016/03/06 22:53:42
Done.
|
| + RunFindXcode(api, 'set_xcode_version', target_version=activate_version) |
| + |
| + |
| def RunSteps(api): |
| # buildbot sets 'clobber' to the empty string which is falsey, check with 'in' |
| if 'clobber' in api.properties: |
| @@ -156,6 +189,9 @@ def RunSteps(api): |
| # The context adds dart-sdk tools to PATH sets PUB_CACHE. |
| with api.step.context({'env': env}): |
| + if api.platform.is_mac: |
| + SetupXcode(api) |
| + |
| # Must be first to download dependencies for later steps. |
| api.step('flutter doctor', ['flutter', 'doctor']) |
| api.step('update packages', ['flutter', 'update-packages']) |
| @@ -181,5 +217,16 @@ def RunSteps(api): |
| def GenTests(api): |
| for platform in ('mac', 'linux'): |
| - yield (api.test(platform) + api.platform(platform, 64) + |
| + test = (api.test(platform) + api.platform(platform, 64) + |
| api.properties(clobber='')) |
| + |
| + if platform == 'mac': |
| + test = (test + |
| + api.step_data('enumerate_xcode_installations', api.json.output({ |
| + 'installations': { |
| + '/some/path': '7.2.1 build_number' |
| + } |
| + })) + |
| + api.step_data('set_xcode_version', api.json.output({}))) |
| + |
| + yield test |