OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import re |
| 8 import shutil |
| 9 import sys |
| 10 import tempfile |
| 11 |
| 12 import bot |
| 13 |
| 14 GCS_BUCKET = 'gs://dart-cross-compiled-binaries' |
| 15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 16 sys.path.append(os.path.join(SCRIPT_DIR, '..')) |
| 17 |
| 18 import utils |
| 19 |
| 20 CROSS_VM = r'cross-(arm)-vm-linux-(release)' |
| 21 TARGET_VM = r'target-(arm)-vm-linux-(release)' |
| 22 GSUTIL = utils.GetBuildbotGSUtilPath() |
| 23 |
| 24 def run(args): |
| 25 print 'Running: %s' % (' '.join(args)) |
| 26 sys.stdout.flush() |
| 27 bot.RunProcess(args) |
| 28 |
| 29 def main(): |
| 30 name, is_buildbot = bot.GetBotName() |
| 31 build_py = os.path.join('tools', 'build.py') |
| 32 test_py = os.path.join('tools', 'test.py') |
| 33 |
| 34 cross_vm_pattern_match = re.match(CROSS_VM, name) |
| 35 target_vm_pattern_match = re.match(TARGET_VM, name) |
| 36 if cross_vm_pattern_match: |
| 37 arch = cross_vm_pattern_match.group(1) |
| 38 mode = cross_vm_pattern_match.group(2) |
| 39 |
| 40 bot.Clobber() |
| 41 with bot.BuildStep('Build %s %s' % (arch, mode)): |
| 42 args = [sys.executable, build_py, |
| 43 '-m%s' % mode, '--arch=%s' % arch, 'runtime'] |
| 44 run(args) |
| 45 |
| 46 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) |
| 47 try: |
| 48 with bot.BuildStep('Create build tarball'): |
| 49 run(['tar', '-cjf', tarball, '--exclude=**/obj', |
| 50 '--exclude=**/obj.host', '--exclude=**/obj.target', |
| 51 '--exclude=**/*analyzer*', 'out/']) |
| 52 |
| 53 with bot.BuildStep('Upload build tarball'): |
| 54 uri = "%s/%s" % (GCS_BUCKET, tarball) |
| 55 run([GSUTIL, 'cp', tarball, uri]) |
| 56 run([GSUTIL, 'setacl', 'public-read', uri]) |
| 57 finally: |
| 58 if os.path.exists(tarball): |
| 59 os.remove(tarball) |
| 60 elif target_vm_pattern_match: |
| 61 arch = target_vm_pattern_match.group(1) |
| 62 mode = target_vm_pattern_match.group(2) |
| 63 |
| 64 bot.Clobber() |
| 65 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) |
| 66 try: |
| 67 test_args = [sys.executable, test_py, '--progress=line', '--report', |
| 68 '--time', '--mode=' + mode, '--arch=' + arch, '--compiler=none', |
| 69 '--runtime=vm', '--write-debug-log'] |
| 70 |
| 71 with bot.BuildStep('Fetch build tarball'): |
| 72 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) |
| 73 |
| 74 with bot.BuildStep('Unpack build tarball'): |
| 75 run(['tar', '-xjf', tarball]) |
| 76 |
| 77 with bot.BuildStep('tests'): |
| 78 run(test_args) |
| 79 |
| 80 with bot.BuildStep('checked_tests'): |
| 81 run(test_args + ['--checked']) |
| 82 finally: |
| 83 if os.path.exists(tarball): |
| 84 os.remove(tarball) |
| 85 else: |
| 86 raise Exception("Unknown builder name %s" % name) |
| 87 |
| 88 if __name__ == '__main__': |
| 89 sys.exit(main()) |
OLD | NEW |