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

Side by Side Diff: buildbot/buildbot_run.py

Issue 12314014: CMake generator. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Address comments. Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gyptest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 Google Inc. All rights reserved. 2 # Copyright (c) 2012 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 6
7 """Argument-less script to select what to run on the buildbots.""" 7 """Argument-less script to select what to run on the buildbots."""
8 8
9 9
10 import os 10 import os
11 import shutil 11 import shutil
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 14
15 15
16 if sys.platform in ['win32', 'cygwin']: 16 if sys.platform in ['win32', 'cygwin']:
17 EXE_SUFFIX = '.exe' 17 EXE_SUFFIX = '.exe'
18 else: 18 else:
19 EXE_SUFFIX = '' 19 EXE_SUFFIX = ''
20 20
21 21
22 BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__)) 22 BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__))
23 TRUNK_DIR = os.path.dirname(BUILDBOT_DIR) 23 TRUNK_DIR = os.path.dirname(BUILDBOT_DIR)
24 ROOT_DIR = os.path.dirname(TRUNK_DIR) 24 ROOT_DIR = os.path.dirname(TRUNK_DIR)
25 ANDROID_DIR = os.path.join(ROOT_DIR, 'android') 25 ANDROID_DIR = os.path.join(ROOT_DIR, 'android')
26 CMAKE_DIR = os.path.join(ROOT_DIR, 'cmake')
27 CMAKE_BIN_DIR = os.path.join(CMAKE_DIR, 'bin')
26 OUT_DIR = os.path.join(TRUNK_DIR, 'out') 28 OUT_DIR = os.path.join(TRUNK_DIR, 'out')
27 29
28 30
29 def CallSubProcess(*args, **kwargs): 31 def CallSubProcess(*args, **kwargs):
30 """Wrapper around subprocess.call which treats errors as build exceptions.""" 32 """Wrapper around subprocess.call which treats errors as build exceptions."""
31 retcode = subprocess.call(*args, **kwargs) 33 retcode = subprocess.call(*args, **kwargs)
32 if retcode != 0: 34 if retcode != 0:
33 print '@@@STEP_EXCEPTION@@@' 35 print '@@@STEP_EXCEPTION@@@'
34 sys.exit(1) 36 sys.exit(1)
35 37
36 38
39 def PrepareCmake():
40 """Build CMake 2.8.8 since the version in Precise is 2.8.7."""
41 if os.environ['BUILDBOT_CLOBBER'] == '1':
42 print '@@@BUILD_STEP Clobber CMake checkout@@@'
43 shutil.rmtree(CMAKE_DIR)
44
45 # We always build CMake 2.8.8, so no need to do anything
46 # if the directory already exists.
47 if os.path.isdir(CMAKE_DIR):
48 return
49
50 print '@@@BUILD_STEP Initialize CMake checkout@@@'
51 os.mkdir(CMAKE_DIR)
52 CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot'])
53 CallSubProcess(['git', 'config', '--global',
54 'user.email', 'chrome-bot@google.com'])
55 CallSubProcess(['git', 'config', '--global', 'color.ui', 'false'])
56
57 print '@@@BUILD_STEP Sync CMake@@@'
58 CallSubProcess(
59 ['git', 'clone',
60 '--depth', '1',
61 '--single-branch',
62 '--branch', 'v2.8.8',
63 '--',
64 'git://cmake.org/cmake.git',
65 CMAKE_DIR],
66 cwd=CMAKE_DIR)
67
68 print '@@@BUILD_STEP Build CMake@@@'
69 CallSubProcess(
70 ['/bin/bash', 'bootstrap', '--prefix=%s' % CMAKE_DIR],
71 cwd=CMAKE_DIR)
72
73 CallSubProcess( ['make', 'cmake'], cwd=CMAKE_DIR)
74
75
37 def PrepareAndroidTree(): 76 def PrepareAndroidTree():
38 """Prepare an Android tree to run 'android' format tests.""" 77 """Prepare an Android tree to run 'android' format tests."""
39 if os.environ['BUILDBOT_CLOBBER'] == '1': 78 if os.environ['BUILDBOT_CLOBBER'] == '1':
40 print '@@@BUILD_STEP Clobber Android checkout@@@' 79 print '@@@BUILD_STEP Clobber Android checkout@@@'
41 shutil.rmtree(ANDROID_DIR) 80 shutil.rmtree(ANDROID_DIR)
42 81
43 # The release of Android we use is static, so there's no need to do anything 82 # The release of Android we use is static, so there's no need to do anything
44 # if the directory already exists. 83 # if the directory already exists.
45 if os.path.isdir(ANDROID_DIR): 84 if os.path.isdir(ANDROID_DIR):
46 return 85 return
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 print '@@@BUILD_STEP ' + title + '@@@' 123 print '@@@BUILD_STEP ' + title + '@@@'
85 sys.stdout.flush() 124 sys.stdout.flush()
86 env = os.environ.copy() 125 env = os.environ.copy()
87 if msvs_version: 126 if msvs_version:
88 env['GYP_MSVS_VERSION'] = msvs_version 127 env['GYP_MSVS_VERSION'] = msvs_version
89 command = ' '.join( 128 command = ' '.join(
90 [sys.executable, 'trunk/gyptest.py', 129 [sys.executable, 'trunk/gyptest.py',
91 '--all', 130 '--all',
92 '--passed', 131 '--passed',
93 '--format', format, 132 '--format', format,
133 '--path', CMAKE_BIN_DIR,
94 '--chdir', 'trunk']) 134 '--chdir', 'trunk'])
95 if format == 'android': 135 if format == 'android':
96 # gyptest needs the environment setup from envsetup/lunch in order to build 136 # gyptest needs the environment setup from envsetup/lunch in order to build
97 # using the 'android' backend, so this is done in a single shell. 137 # using the 'android' backend, so this is done in a single shell.
98 retcode = subprocess.call( 138 retcode = subprocess.call(
99 ['/bin/bash', 139 ['/bin/bash',
100 '-c', 'source build/envsetup.sh && lunch full-eng && cd %s && %s' 140 '-c', 'source build/envsetup.sh && lunch full-eng && cd %s && %s'
101 % (ROOT_DIR, command)], 141 % (ROOT_DIR, command)],
102 cwd=ANDROID_DIR, env=env) 142 cwd=ANDROID_DIR, env=env)
103 else: 143 else:
(...skipping 13 matching lines...) Expand all
117 print 'Done.' 157 print 'Done.'
118 158
119 retcode = 0 159 retcode = 0
120 # The Android gyp bot runs on linux so this must be tested first. 160 # The Android gyp bot runs on linux so this must be tested first.
121 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': 161 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android':
122 PrepareAndroidTree() 162 PrepareAndroidTree()
123 retcode += GypTestFormat('android') 163 retcode += GypTestFormat('android')
124 elif sys.platform.startswith('linux'): 164 elif sys.platform.startswith('linux'):
125 retcode += GypTestFormat('ninja') 165 retcode += GypTestFormat('ninja')
126 retcode += GypTestFormat('make') 166 retcode += GypTestFormat('make')
167 PrepareCmake()
168 retcode += GypTestFormat('cmake')
127 elif sys.platform == 'darwin': 169 elif sys.platform == 'darwin':
128 retcode += GypTestFormat('ninja') 170 retcode += GypTestFormat('ninja')
129 retcode += GypTestFormat('xcode') 171 retcode += GypTestFormat('xcode')
130 retcode += GypTestFormat('make') 172 retcode += GypTestFormat('make')
131 elif sys.platform == 'win32': 173 elif sys.platform == 'win32':
132 retcode += GypTestFormat('ninja') 174 retcode += GypTestFormat('ninja')
133 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64': 175 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64':
134 retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010') 176 retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010')
135 retcode += GypTestFormat('msvs-2012', format='msvs', msvs_version='2012') 177 retcode += GypTestFormat('msvs-2012', format='msvs', msvs_version='2012')
136 else: 178 else:
137 raise Exception('Unknown platform') 179 raise Exception('Unknown platform')
138 if retcode: 180 if retcode:
139 # TODO(bradnelson): once the annotator supports a postscript (section for 181 # TODO(bradnelson): once the annotator supports a postscript (section for
140 # after the build proper that could be used for cumulative failures), 182 # after the build proper that could be used for cumulative failures),
141 # use that instead of this. This isolates the final return value so 183 # use that instead of this. This isolates the final return value so
142 # that it isn't misattributed to the last stage. 184 # that it isn't misattributed to the last stage.
143 print '@@@BUILD_STEP failures@@@' 185 print '@@@BUILD_STEP failures@@@'
144 sys.exit(retcode) 186 sys.exit(retcode)
145 187
146 188
147 if __name__ == '__main__': 189 if __name__ == '__main__':
148 GypBuild() 190 GypBuild()
OLDNEW
« no previous file with comments | « no previous file | gyptest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698