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

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(mode, system):
94 """
95 Builds the SDK.
96
97 - mode: either 'debug' or 'release'
98 - system: either 'linux', 'mac', or 'win7'
99 """
100 with BuildStep('Build SDK'):
101 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk']
102 print 'Building SDK: %s' % (' '.join(args))
103 RunProcess(args)
104
105
106 def RunBot(parse_name, custom_steps, build_step=BuildSDK):
94 """ 107 """
95 The main function for running a buildbot. 108 The main function for running a buildbot.
96 109
97 A buildbot script should invoke this once. The parse_name function will be 110 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 111 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 112 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. 113 that's done, it will call custom_steps, passing in the BuildInfo object.
101 114
102 In that, you can perform any bot-specific build steps. 115 In that, you can perform any bot-specific build steps.
103 116
(...skipping 11 matching lines...) Expand all
115 sys.exit(1) 128 sys.exit(1)
116 129
117 # Print out the buildinfo for easy debugging. 130 # Print out the buildinfo for easy debugging.
118 build_info.PrintBuildInfo() 131 build_info.PrintBuildInfo()
119 132
120 # Make sure we are in the dart directory 133 # Make sure we are in the dart directory
121 os.chdir(DART_PATH) 134 os.chdir(DART_PATH)
122 135
123 try: 136 try:
124 Clobber(build_info.mode) 137 Clobber(build_info.mode)
125 BuildSDK(build_info.mode, build_info.system) 138 build_step(build_info.mode, build_info.system)
126 139
127 custom_steps(build_info) 140 custom_steps(build_info)
128 except OSError as e: 141 except OSError as e:
129 sys.exit(e.errno) 142 sys.exit(e.errno)
130 143
131 sys.exit(0) 144 sys.exit(0)
132 145
133 146
134 def GetBotName(): 147 def GetBotName():
135 """ 148 """
(...skipping 29 matching lines...) Expand all
165 return 178 return
166 179
167 with BuildStep('Clobber'): 180 with BuildStep('Clobber'):
168 cmd = [sys.executable, 181 cmd = [sys.executable,
169 './tools/clean_output_directory.py', 182 './tools/clean_output_directory.py',
170 '--mode=' + mode] 183 '--mode=' + mode]
171 print 'Clobbering %s' % (' '.join(cmd)) 184 print 'Clobbering %s' % (' '.join(cmd))
172 RunProcess(cmd) 185 RunProcess(cmd)
173 186
174 187
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): 188 def RunTest(name, build_info, targets, flags=None):
189 """ 189 """
190 Runs test.py with the given settings. 190 Runs test.py with the given settings.
191 """ 191 """
192 if not flags: 192 if not flags:
193 flags = [] 193 flags = []
194 194
195 step_name = GetStepName(name, flags) 195 step_name = GetStepName(name, flags)
196 with BuildStep(step_name): 196 with BuildStep(step_name):
197 sys.stdout.flush() 197 sys.stdout.flush()
(...skipping 29 matching lines...) Expand all
227 if exit_code != 0: 227 if exit_code != 0:
228 raise OSError(exit_code) 228 raise OSError(exit_code)
229 229
230 230
231 def GetStepName(name, flags): 231 def GetStepName(name, flags):
232 """ 232 """
233 Filters out flags with '=' as this breaks the /stats feature of the buildbot. 233 Filters out flags with '=' as this breaks the /stats feature of the buildbot.
234 """ 234 """
235 flags = [x for x in flags if not '=' in x] 235 flags = [x for x in flags if not '=' in x]
236 return ('%s tests %s' % (name, ' '.join(flags))).strip() 236 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