OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 """Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 | 4 |
5 Use of this source code is governed by a BSD-style license that can be | 5 Use of this source code is governed by a BSD-style license that can be |
6 found in the LICENSE file. | 6 found in the LICENSE file. |
7 | 7 |
8 Eclipse Dart Editor buildbot steps. | 8 Eclipse Dart Editor buildbot steps. |
9 """ | 9 """ |
10 | 10 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 # 'USERNAME' Windows were used. | 232 # 'USERNAME' Windows were used. |
233 username = os.environ.get('USER') | 233 username = os.environ.get('USER') |
234 if username is None: | 234 if username is None: |
235 username = os.environ.get('USERNAME') | 235 username = os.environ.get('USERNAME') |
236 | 236 |
237 if username is None: | 237 if username is None: |
238 _PrintError('could not find the user name' | 238 _PrintError('could not find the user name' |
239 ' tried environment variables' | 239 ' tried environment variables' |
240 ' USER and USERNAME') | 240 ' USER and USERNAME') |
241 return 1 | 241 return 1 |
| 242 sdk_environment = os.environ |
242 if username.startswith('chrome'): | 243 if username.startswith('chrome'): |
243 to_bucket = 'gs://dart-editor-archive-continuous' | 244 to_bucket = 'gs://dart-editor-archive-continuous' |
| 245 run_sdk_build = True |
| 246 running_on_buildbot = True |
244 else: | 247 else: |
245 to_bucket = 'gs://dart-editor-archive-testing' | 248 to_bucket = 'gs://dart-editor-archive-testing' |
| 249 run_sdk_build = False |
| 250 running_on_buildbot = False |
| 251 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' |
| 252 |
| 253 #this is a hack to allow the SDK build to be run on a local machine |
| 254 if sdk_environment.has_key('FORCE_RUN_SDK_BUILD'): |
| 255 run_sdk_build = True |
| 256 #end hack |
246 | 257 |
247 print '@@@BUILD_STEP dart-ide dart clients: %s@@@' % options.name | 258 print '@@@BUILD_STEP dart-ide dart clients: %s@@@' % options.name |
| 259 if sdk_environment.has_key('JAVA_HOME'): |
| 260 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) |
248 builder_name = str(options.name) | 261 builder_name = str(options.name) |
249 | 262 |
250 if builder_name != 'dart-editor-win' and builder_name != 'dart-editor': | 263 if (run_sdk_build and |
| 264 builder_name != 'dart-editor-win' |
| 265 and builder_name != 'dart-editor'): |
251 _PrintSeparator('running the build of the Dart SDK') | 266 _PrintSeparator('running the build of the Dart SDK') |
252 dartbuildscript = os.path.join(toolspath, 'build.py') | 267 dartbuildscript = os.path.join(toolspath, 'build.py') |
253 cmds = [sys.executable, dartbuildscript, | 268 cmds = [sys.executable, dartbuildscript, |
254 '--mode=release', 'upload_sdk'] | 269 '--mode=release', 'upload_sdk'] |
255 cwd = os.getcwd() | 270 cwd = os.getcwd() |
256 try: | 271 try: |
257 os.chdir(dartpath) | 272 os.chdir(dartpath) |
258 print ' '.join(cmds) | 273 print ' '.join(cmds) |
259 status = subprocess.call(cmds) | 274 status = subprocess.call(cmds, env=sdk_environment) |
260 print 'sdk build returned ' + str(status) | 275 print 'sdk build returned ' + str(status) |
261 if status: | 276 if status: |
262 _PrintError('the build of the SDK failed') | 277 _PrintError('the build of the SDK failed') |
263 return status | 278 return status |
264 finally: | 279 finally: |
265 os.chdir(cwd) | 280 os.chdir(cwd) |
266 | 281 if running_on_buildbot: |
267 _CopySdk(buildos, revision, to_bucket, gsu) | 282 _CopySdk(buildos, revision, to_bucket, gsu) |
268 | 283 |
269 if builder_name == 'dart-editor': | 284 if builder_name == 'dart-editor': |
270 buildos = None | 285 buildos = None |
271 else: | 286 else: |
272 _PrintSeparator('new builder running on {0} is' | 287 _PrintSeparator('new builder running on {0} is' |
273 ' a place holder until the os specific builds' | 288 ' a place holder until the os specific builds' |
274 ' are in place. This is a ' | 289 ' are in place. This is a ' |
275 'normal termination'.format(builder_name)) | 290 'normal termination'.format(builder_name)) |
276 return 0 | 291 return 0 |
277 | 292 |
(...skipping 20 matching lines...) Expand all Loading... |
298 | 313 |
299 #if the build passed run the deploy artifacts | 314 #if the build passed run the deploy artifacts |
300 _PrintSeparator("Deploying the built RCP's to Google Storage") | 315 _PrintSeparator("Deploying the built RCP's to Google Storage") |
301 status = _DeployArtifacts(buildout, to_bucket, | 316 status = _DeployArtifacts(buildout, to_bucket, |
302 properties['build.tmp'], revision, | 317 properties['build.tmp'], revision, |
303 gsu) | 318 gsu) |
304 if status: | 319 if status: |
305 return status | 320 return status |
306 | 321 |
307 _PrintSeparator("Setting the ACL'sfor the RCP's in Google Storage") | 322 _PrintSeparator("Setting the ACL'sfor the RCP's in Google Storage") |
308 _SetAclOnArtifacts(to_bucket, [revision, 'latest'], gsu) | 323 _SetAclOnArtifacts(to_bucket, |
| 324 [revision + '/DartBuild', 'latest/DartBuild'], |
| 325 gsu) |
309 | 326 |
310 sys.stdout.flush() | 327 sys.stdout.flush() |
311 | 328 |
312 _PrintSeparator('Running the tests') | 329 _PrintSeparator('Running the tests') |
313 status = ant.RunAnt('../com.google.dart.tools.tests.feature_releng', | 330 status = ant.RunAnt('../com.google.dart.tools.tests.feature_releng', |
314 'buildTests.xml', | 331 'buildTests.xml', |
315 revision, options.name, buildroot, buildout, | 332 revision, options.name, buildroot, buildout, |
316 editorpath, buildos) | 333 editorpath, buildos) |
317 properties = _ReadPropertyFile(property_file) | 334 properties = _ReadPropertyFile(property_file) |
318 if status and properties['build.runtime']: | 335 if status and properties['build.runtime']: |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 for element in contents: | 482 for element in contents: |
466 for tag in bucket_tags: | 483 for tag in bucket_tags: |
467 if tag in element: | 484 if tag in element: |
468 print 'setting ACL on {0}'.format(element) | 485 print 'setting ACL on {0}'.format(element) |
469 gsu.SetCannedAcl(element, 'project-private') | 486 gsu.SetCannedAcl(element, 'project-private') |
470 acl = gsu.GetAcl(element) | 487 acl = gsu.GetAcl(element) |
471 acl = gsu.AddPublicAcl(acl) | 488 acl = gsu.AddPublicAcl(acl) |
472 gsu.SetAcl(element, acl) | 489 gsu.SetAcl(element, acl) |
473 | 490 |
474 | 491 |
475 def _CopySdk(buildos, revision, bucket, gsu): | 492 def _CopySdk(buildos, revision, bucket_to, gsu): |
476 """copy the deployed SDK to the editor buckets. | 493 """copy the deployed SDK to the editor buckets. |
477 | 494 |
478 Args: | 495 Args: |
479 buildos: the OS the build is running under | 496 buildos: the OS the build is running under |
480 revision: the svn revision | 497 revision: the svn revision |
481 bucket: the bucket to upload to | 498 bucket_to: the bucket to upload to |
482 gsu: the gsutil object | 499 gsu: the gsutil object |
483 """ | 500 """ |
484 print '_CopySdk({0}, {1}, gsu)'.format(buildos, revision) | 501 print '_CopySdk({0}, {1}, gsu)'.format(buildos, revision) |
485 gszip = 'dart-{0}-{1}.zip'.format(buildos, revision) | 502 gszip = 'dart-{0}-{1}.zip'.format(buildos, revision) |
486 gssdkzip = 'gs://dart-dump-render-tree/sdk/{0}'.format(gszip) | 503 gssdkzip = 'gs://dart-dump-render-tree/sdk/{0}'.format(gszip) |
487 gseditorzip = '{0}/{1}/{2}'.format(bucket, revision, gszip) | 504 gseditorzip = '{0}/{1}/{2}'.format(bucket_to, revision, gszip) |
488 gseditorlatestzip = '{0}/{1}/{2}'.format(bucket, 'latest', gszip) | 505 gseditorlatestzip = '{0}/{1}/{2}'.format(bucket_to, 'latest', gszip) |
489 | 506 |
490 print 'copying {0} to {1}'.format(gssdkzip, gseditorzip) | 507 print 'copying {0} to {1}'.format(gssdkzip, gseditorzip) |
491 gsu.Copy(gssdkzip, gseditorzip) | 508 gsu.Copy(gssdkzip, gseditorzip) |
492 print 'copying {0} to {1}'.format(gssdkzip, gseditorlatestzip) | 509 print 'copying {0} to {1}'.format(gssdkzip, gseditorlatestzip) |
493 gsu.Copy(gssdkzip, gseditorlatestzip) | 510 gsu.Copy(gssdkzip, gseditorlatestzip) |
494 _SetAclOnArtifacts(bucket, [gszip], gsu) | 511 _SetAclOnArtifacts(bucket_to, [gszip], gsu) |
495 | 512 |
496 | 513 |
497 def _PrintSeparator(text): | 514 def _PrintSeparator(text): |
498 """Print a separator for the build steps.""" | 515 """Print a separator for the build steps.""" |
499 | 516 |
500 #used to print separators during the build process | 517 #used to print separators during the build process |
501 tag_line_sep = '================================' | 518 tag_line_sep = '================================' |
502 tag_line_text = '= {0}' | 519 tag_line_text = '= {0}' |
503 | 520 |
504 print tag_line_sep | 521 print tag_line_sep |
(...skipping 10 matching lines...) Expand all Loading... |
515 | 532 |
516 print error_sep | 533 print error_sep |
517 print error_sep | 534 print error_sep |
518 print error_text.format(text) | 535 print error_text.format(text) |
519 print error_sep | 536 print error_sep |
520 print error_sep | 537 print error_sep |
521 | 538 |
522 | 539 |
523 if __name__ == '__main__': | 540 if __name__ == '__main__': |
524 sys.exit(main()) | 541 sys.exit(main()) |
OLD | NEW |