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

Side by Side Diff: tools/bots/bot.py

Issue 11264019: Set up Android build config. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« tools/bots/android.py ('K') | « tools/bots/android.py ('k') | no next file » | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 Shared code for use in the buildbot scripts. 8 Shared code for use in the buildbot scripts.
9 """ 9 """
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 def __enter__(self): 83 def __enter__(self):
84 print '@@@BUILD_STEP %s@@@' % self.name 84 print '@@@BUILD_STEP %s@@@' % self.name
85 85
86 def __exit__(self, type, value, traceback): 86 def __exit__(self, type, value, traceback):
87 if value: 87 if value:
88 print '@@@STEP_FAILURE@@@' 88 print '@@@STEP_FAILURE@@@'
89 if self.swallow_error and isinstance(value, OSError): 89 if self.swallow_error and isinstance(value, OSError):
90 return True 90 return True
91 91
92 92
93 def RunBot(parse_name, custom_steps): 93 def BuildSDK(build_info):
94 """
95 Builds the SDK.
96
97 - build_info: the buildInfo object, containing information about what sort of
98 build and test to be run.
99 """
100 with BuildStep('Build SDK'):
101 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode,
102 'create_sdk']
103 print 'Building SDK: %s' % (' '.join(args))
104 RunProcess(args)
105
106
107 def RunBot(parse_name, custom_steps, build_step=BuildSDK):
94 """ 108 """
95 The main function for running a buildbot. 109 The main function for running a buildbot.
96 110
97 A buildbot script should invoke this once. The parse_name function will be 111 A buildbot script should invoke this once. The parse_name function will be
98 called with the name of the buildbot and should return an instance of 112 called with the name of the buildbot and should return an instance of
99 BuildInfo. This function will then set up the bot, build the SDK etc. When 113 BuildInfo. This function will then set up the bot, build the SDK etc. When
100 that's done, it will call custom_steps, passing in the BuildInfo object. 114 that's done, it will call custom_steps, passing in the BuildInfo object.
101 115
102 In that, you can perform any bot-specific build steps. 116 In that, you can perform any bot-specific build steps.
103 117
(...skipping 11 matching lines...) Expand all
115 sys.exit(1) 129 sys.exit(1)
116 130
117 # Print out the buildinfo for easy debugging. 131 # Print out the buildinfo for easy debugging.
118 build_info.PrintBuildInfo() 132 build_info.PrintBuildInfo()
119 133
120 # Make sure we are in the dart directory 134 # Make sure we are in the dart directory
121 os.chdir(DART_PATH) 135 os.chdir(DART_PATH)
122 136
123 try: 137 try:
124 Clobber(build_info.mode) 138 Clobber(build_info.mode)
125 BuildSDK(build_info.mode, build_info.system) 139 build_step(build_info)
126 140
127 custom_steps(build_info) 141 custom_steps(build_info)
128 except OSError as e: 142 except OSError as e:
129 sys.exit(e.errno) 143 sys.exit(e.errno)
130 144
131 sys.exit(0) 145 sys.exit(0)
132 146
133 147
134 def GetBotName(): 148 def GetBotName():
135 """ 149 """
(...skipping 29 matching lines...) Expand all
165 return 179 return
166 180
167 with BuildStep('Clobber'): 181 with BuildStep('Clobber'):
168 cmd = [sys.executable, 182 cmd = [sys.executable,
169 './tools/clean_output_directory.py', 183 './tools/clean_output_directory.py',
170 '--mode=' + mode] 184 '--mode=' + mode]
171 print 'Clobbering %s' % (' '.join(cmd)) 185 print 'Clobbering %s' % (' '.join(cmd))
172 RunProcess(cmd) 186 RunProcess(cmd)
173 187
174 188
175 def BuildSDK(mode, system):
176 """
177 Builds the SDK.
178
179 - mode: either 'debug' or 'release'
180 - system: either 'linux', 'mac', or 'win7'
181 """
182 with BuildStep('Build SDK'):
183 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk']
184 print 'Building SDK: %s' % (' '.join(args))
185 RunProcess(args)
186
187
188 def RunTest(name, build_info, targets, flags=None): 189 def RunTest(name, build_info, targets, flags=None):
189 """ 190 """
190 Runs test.py with the given settings. 191 Runs test.py with the given settings.
191 """ 192 """
192 if not flags: 193 if not flags:
193 flags = [] 194 flags = []
194 195
195 step_name = GetStepName(name, flags) 196 step_name = GetStepName(name, flags)
196 with BuildStep(step_name): 197 with BuildStep(step_name):
197 sys.stdout.flush() 198 sys.stdout.flush()
(...skipping 29 matching lines...) Expand all
227 if exit_code != 0: 228 if exit_code != 0:
228 raise OSError(exit_code) 229 raise OSError(exit_code)
229 230
230 231
231 def GetStepName(name, flags): 232 def GetStepName(name, flags):
232 """ 233 """
233 Filters out flags with '=' as this breaks the /stats feature of the buildbot. 234 Filters out flags with '=' as this breaks the /stats feature of the buildbot.
234 """ 235 """
235 flags = [x for x in flags if not '=' in x] 236 flags = [x for x in flags if not '=' in x]
236 return ('%s tests %s' % (name, ' '.join(flags))).strip() 237 return ('%s tests %s' % (name, ' '.join(flags))).strip()
OLDNEW
« tools/bots/android.py ('K') | « tools/bots/android.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698