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

Unified Diff: scripts/slave/recipes/flutter/flutter.py

Issue 1768473002: setup the correct version of Xcode (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipes/flutter/flutter.py
diff --git a/scripts/slave/recipes/flutter/flutter.py b/scripts/slave/recipes/flutter/flutter.py
index ca3dfb9c2aa110fee57c1e71aa8fce918a667be5..4cbfad54486ea783b7cf27c2883df82612cc4597 100644
--- a/scripts/slave/recipes/flutter/flutter.py
+++ b/scripts/slave/recipes/flutter/flutter.py
@@ -8,6 +8,7 @@ DEPS = [
'depot_tools/git',
'file',
'gsutil',
+ 'recipe_engine/json',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
@@ -127,6 +128,63 @@ def BuildExamples(api, git_hash):
ArchiveAPK(api, 'examples/material_gallery', 'Gallery.apk')
+def RunFindXcode(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.
+ """
+ import json
+ import os
+ import string
+ import subprocess
+ import sys
+ import tempfile
iannucci 2016/03/04 17:58:05 Whoops. This not lgtm for sure. This will break th
+
+ scripts_dir = os.path.dirname(os.path.dirname(os.path.dirname(
+ os.path.dirname(os.path.abspath(__file__)))))
+
+ find_xcode_py_path = os.path.join(
+ scripts_dir,
eseidel1 2016/03/04 04:25:05 I think this is api.path['build'].join('scripts'),
yjbanov 2016/03/04 17:45:50 I tried that, but for some reason api.path['build'
iannucci 2016/03/04 17:58:05 This should be rewritten to use the recipe apis to
+ 'slave/ios/find_xcode.py'
+ )
+
+ json_file = tempfile.mkstemp(prefix='xcode-info')[1]
+
+ args = [
+ find_xcode_py_path,
+ '--json-file', json_file,
+ ]
+
+ if target_version is not None:
+ args.extend(['--version', '7.2.1'])
+
+ find_proc = subprocess.Popen(args, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, cwd=scripts_dir, env={'PYTHONPATH': scripts_dir})
+
+ (stdout, stderr) = find_proc.communicate()
+ if find_proc.returncode != 0:
+ raise Exception(find_proc.returncode, stdout, stderr)
+
+ with open(json_file, 'r') as xcode_info_reader:
+ return json.loads(xcode_info_reader.read())
+
+
+def SetupXcode(api):
+ if api.platform.is_mac:
+ xcode_json = RunFindXcode()
+ 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:
+ raise Exception('Xcode version 7 or above not found')
+ print 'Activating Xcode version %s' % version
+ RunFindXcode(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 +214,8 @@ def RunSteps(api):
# The context adds dart-sdk tools to PATH sets PUB_CACHE.
with api.step.context({'env': env}):
+ SetupXcode(api)
eseidel1 2016/03/04 04:25:06 Do you need to take the results of finding XCode t
yjbanov 2016/03/04 17:45:50 The `find_xcode.py` utility uses `xcode-select` to
+
# Must be first to download dependencies for later steps.
api.step('flutter doctor', ['flutter', 'doctor'])
api.step('update packages', ['flutter', 'update-packages'])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698