OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 import glob | 7 import glob |
8 import gsutil | 8 import gsutil |
9 import hashlib | 9 import hashlib |
10 import imp | 10 import imp |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 BUILD_OS = None | 22 BUILD_OS = None |
23 DART_PATH = None | 23 DART_PATH = None |
24 TOOLS_PATH = None | 24 TOOLS_PATH = None |
25 | 25 |
26 GSU_PATH_REV = None | 26 GSU_PATH_REV = None |
27 GSU_PATH_LATEST = None | 27 GSU_PATH_LATEST = None |
28 GSU_API_DOCS_PATH = None | 28 GSU_API_DOCS_PATH = None |
29 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' | 29 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' |
30 | 30 |
| 31 CHANNEL = None |
| 32 PLUGINS_BUILD = None |
31 REVISION = None | 33 REVISION = None |
| 34 SYSTEM = None |
32 TRUNK_BUILD = None | 35 TRUNK_BUILD = None |
33 PLUGINS_BUILD = None | |
34 | 36 |
35 NO_UPLOAD = None | 37 NO_UPLOAD = None |
36 | 38 |
37 def GetUtils(): | 39 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) |
38 '''Dynamically load the tools/utils.py python module.''' | 40 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) |
39 dart_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..')) | 41 bot_utils = imp.load_source('bot_utils', |
40 return imp.load_source('utils', os.path.join(dart_dir, 'tools', 'utils.py')) | 42 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) |
41 | 43 |
42 utils = GetUtils() | 44 def DartArchiveFile(local_path, remote_path, create_md5sum=False): |
| 45 # Copy it to the new unified gs://dart-archive bucket |
| 46 # TODO(kustermann/ricow): Remove all the old archiving code, once everything |
| 47 # points to the new location |
| 48 gsutil = bot_utils.GSUtil() |
| 49 gsutil.upload(local_path, remote_path, public=True) |
| 50 if create_md5sum: |
| 51 # 'local_path' may have a different filename than 'remote_path'. So we need |
| 52 # to make sure the *.md5sum file contains the correct name. |
| 53 assert '/' in remote_path and not remote_path.endswith('/') |
| 54 mangled_filename = remote_path[remote_path.rfind('/') + 1:] |
| 55 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) |
| 56 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) |
| 57 |
| 58 def DartArchiveUploadEditorZipFile(zipfile): |
| 59 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ |
| 60 # Remove this once the channel transition is done. |
| 61 if CHANNEL == 'trunk': return |
| 62 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 63 gsutil = bot_utils.GSUtil() |
| 64 |
| 65 basename = os.path.basename(zipfile) |
| 66 system = None |
| 67 arch = None |
| 68 if basename.startswith('darteditor-linux'): |
| 69 system = 'linux' |
| 70 elif basename.startswith('darteditor-mac'): |
| 71 system = 'macos' |
| 72 elif basename.startswith('darteditor-win'): |
| 73 system = 'windows' |
| 74 |
| 75 if basename.endswith('-32.zip'): |
| 76 arch = 'ia32' |
| 77 elif basename.endswith('-64.zip'): |
| 78 arch = 'x64' |
| 79 |
| 80 assert system and arch |
| 81 |
| 82 for revision in [REVISION, 'latest']: |
| 83 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), |
| 84 create_md5sum=True) |
| 85 |
| 86 def DartArchiveUploadUpdateSite(local_path): |
| 87 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ |
| 88 # Remove this once the channel transition is done. |
| 89 if CHANNEL == 'trunk': return |
| 90 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 91 gsutil = bot_utils.GSUtil() |
| 92 for revision in [REVISION, 'latest']: |
| 93 update_site_dir = namer.editor_eclipse_update_directory(revision) |
| 94 try: |
| 95 gsutil.remove(update_site_dir, recursive=True) |
| 96 except: |
| 97 # Ignore this, in the general case there is nothing. |
| 98 pass |
| 99 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) |
| 100 |
| 101 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip): |
| 102 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ |
| 103 # Remove this once the channel transition is done. |
| 104 if CHANNEL == 'trunk': return |
| 105 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 106 for revision in [REVISION, 'latest']: |
| 107 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') |
| 108 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') |
| 109 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) |
| 110 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) |
| 111 |
| 112 def DartArchiveUploadAPIDocs(api_zip): |
| 113 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ |
| 114 # Remove this once the channel transition is done. |
| 115 if CHANNEL == 'trunk': return |
| 116 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 117 for revision in [REVISION, 'latest']: |
| 118 destination = (namer.apidocs_directory(revision) + '/' + |
| 119 namer.apidocs_zipfilename()) |
| 120 DartArchiveFile(api_zip, destination, create_md5sum=False) |
| 121 |
| 122 def DartArchiveUploadVersionFile(version_file): |
| 123 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/. |
| 124 # Remove this once the channel transition is done. |
| 125 if CHANNEL == 'trunk': return |
| 126 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 127 for revision in [REVISION, 'latest']: |
| 128 DartArchiveFile(version_file, namer.version_filepath(revision), |
| 129 create_md5sum=False) |
43 | 130 |
44 class AntWrapper(object): | 131 class AntWrapper(object): |
45 """A wrapper for ant build invocations""" | 132 """A wrapper for ant build invocations""" |
46 | 133 |
47 _antpath = None | 134 _antpath = None |
48 _bzippath = None | 135 _bzippath = None |
49 _propertyfile = None | 136 _propertyfile = None |
50 | 137 |
51 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None): | 138 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None): |
52 """Initialize the ant path. | 139 """Initialize the ant path. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 help='Output Directory.', | 259 help='Output Directory.', |
173 action='store') | 260 action='store') |
174 result.add_option('--dest', | 261 result.add_option('--dest', |
175 help='Output Directory.', | 262 help='Output Directory.', |
176 action='store') | 263 action='store') |
177 return result | 264 return result |
178 | 265 |
179 def main(): | 266 def main(): |
180 """Main entry point for the build program.""" | 267 """Main entry point for the build program.""" |
181 global BUILD_OS | 268 global BUILD_OS |
| 269 global CHANNEL |
182 global DART_PATH | 270 global DART_PATH |
183 global TOOLS_PATH | |
184 global GSU_PATH_REV | |
185 global GSU_API_DOCS_PATH | 271 global GSU_API_DOCS_PATH |
186 global GSU_PATH_LATEST | 272 global GSU_PATH_LATEST |
| 273 global GSU_PATH_REV |
| 274 global NO_UPLOAD |
| 275 global PLUGINS_BUILD |
187 global REVISION | 276 global REVISION |
| 277 global SYSTEM |
| 278 global TOOLS_PATH |
188 global TRUNK_BUILD | 279 global TRUNK_BUILD |
189 global PLUGINS_BUILD | |
190 global NO_UPLOAD | |
191 | 280 |
192 if not sys.argv: | 281 if not sys.argv: |
193 print 'Script pathname not known, giving up.' | 282 print 'Script pathname not known, giving up.' |
194 return 1 | 283 return 1 |
195 | 284 |
196 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) | 285 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) |
197 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) | 286 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) |
198 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 287 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', |
199 'third_party')) | 288 'third_party')) |
200 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 289 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 # Get user name. If it does not start with chrome then deploy to the test | 380 # Get user name. If it does not start with chrome then deploy to the test |
292 # bucket; otherwise deploy to the continuous bucket. | 381 # bucket; otherwise deploy to the continuous bucket. |
293 username = os.environ.get('USER') | 382 username = os.environ.get('USER') |
294 if username is None: | 383 if username is None: |
295 username = os.environ.get('USERNAME') | 384 username = os.environ.get('USERNAME') |
296 | 385 |
297 if username is None: | 386 if username is None: |
298 print 'Could not find username' | 387 print 'Could not find username' |
299 return 6 | 388 return 6 |
300 | 389 |
301 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk] | 390 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable] |
302 builder_name = str(options.name) | 391 builder_name = str(options.name) |
303 | 392 |
304 TRUNK_BUILD = builder_name.endswith("-trunk") | 393 EDITOR_REGEXP = (r'^dart-editor(-(?P<system>(win|mac|linux)))?' + |
305 PLUGINS_BUILD = (builder_name == 'dart-editor' or | 394 '(-(?P<channel>(trunk|be|dev|stable)))?$') |
306 builder_name == 'dart-editor-trunk') | 395 match = re.match(EDITOR_REGEXP, builder_name) |
| 396 if not match: |
| 397 raise Exception("Buildername '%s' does not match pattern '%s'." |
| 398 % (builder_name, EDITOR_REGEXP)) |
| 399 |
| 400 CHANNEL = match.groupdict()['channel'] or 'be' |
| 401 SYSTEM = match.groupdict()['system'] |
| 402 |
| 403 TRUNK_BUILD = CHANNEL == 'trunk' |
| 404 PLUGINS_BUILD = SYSTEM is None |
| 405 REVISION = revision |
307 | 406 |
308 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') | 407 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') |
309 sdk_environment = os.environ | 408 sdk_environment = os.environ |
310 if username.startswith('chrome'): | 409 if username.startswith('chrome'): |
311 if TRUNK_BUILD: | 410 if TRUNK_BUILD: |
312 to_bucket = 'gs://dart-editor-archive-trunk' | 411 to_bucket = 'gs://dart-editor-archive-trunk' |
313 else: | 412 else: |
314 to_bucket = 'gs://dart-editor-archive-continuous' | 413 to_bucket = 'gs://dart-editor-archive-continuous' |
315 running_on_buildbot = True | 414 running_on_buildbot = True |
316 else: | 415 else: |
317 to_bucket = 'gs://dart-editor-archive-testing' | 416 to_bucket = 'gs://dart-editor-archive-testing' |
318 running_on_buildbot = False | 417 running_on_buildbot = False |
319 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' | 418 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' |
320 | 419 |
321 REVISION = revision | |
322 GSU_PATH_REV = '%s/%s' % (to_bucket, REVISION) | 420 GSU_PATH_REV = '%s/%s' % (to_bucket, REVISION) |
323 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') | 421 GSU_PATH_LATEST = '%s/%s' % (to_bucket, 'latest') |
324 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) | 422 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) |
325 | 423 |
326 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 424 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
327 gsu = gsutil.GsUtil(False, homegsutil, | 425 gsu = gsutil.GsUtil(False, homegsutil, |
328 running_on_buildbot=running_on_buildbot) | 426 running_on_buildbot=running_on_buildbot) |
329 InstallDartium(buildroot, buildout, buildos, gsu) | 427 InstallDartium(buildroot, buildout, buildos, gsu) |
330 if sdk_environment.has_key('JAVA_HOME'): | 428 if sdk_environment.has_key('JAVA_HOME'): |
331 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) | 429 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 498 |
401 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip | 499 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip |
402 RenameRcpZipFiles(buildout) | 500 RenameRcpZipFiles(buildout) |
403 | 501 |
404 PostProcessEditorBuilds(buildout) | 502 PostProcessEditorBuilds(buildout) |
405 | 503 |
406 if running_on_buildbot: | 504 if running_on_buildbot: |
407 version_file = _FindVersionFile(buildout) | 505 version_file = _FindVersionFile(buildout) |
408 if version_file: | 506 if version_file: |
409 UploadFile(version_file, False) | 507 UploadFile(version_file, False) |
| 508 DartArchiveUploadVersionFile(version_file) |
410 | 509 |
411 found_zips = _FindRcpZipFiles(buildout) | 510 found_zips = _FindRcpZipFiles(buildout) |
412 for zipfile in found_zips: | 511 for zipfile in found_zips: |
413 UploadFile(zipfile) | 512 UploadFile(zipfile) |
| 513 DartArchiveUploadEditorZipFile(zipfile) |
414 | 514 |
415 return 0 | 515 return 0 |
416 finally: | 516 finally: |
417 if ant_property_file is not None: | 517 if ant_property_file is not None: |
418 print 'cleaning up temp file {0}'.format(ant_property_file.name) | 518 print 'cleaning up temp file {0}'.format(ant_property_file.name) |
419 os.remove(ant_property_file.name) | 519 os.remove(ant_property_file.name) |
420 print 'cleaning up {0}'.format(buildroot) | 520 print 'cleaning up {0}'.format(buildroot) |
421 shutil.rmtree(buildroot, True) | 521 shutil.rmtree(buildroot, True) |
422 print 'Build Done' | 522 print 'Build Done' |
423 | 523 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 unzip_dir = os.path.join(tmp_dir, | 706 unzip_dir = os.path.join(tmp_dir, |
607 os.path.splitext(os.path.basename(dartiumFile))[0]) | 707 os.path.splitext(os.path.basename(dartiumFile))[0]) |
608 if not os.path.exists(unzip_dir): | 708 if not os.path.exists(unzip_dir): |
609 os.makedirs(unzip_dir) | 709 os.makedirs(unzip_dir) |
610 # Always download as searchString.zip | 710 # Always download as searchString.zip |
611 basename = "%s.zip" % searchString | 711 basename = "%s.zip" % searchString |
612 tmp_zip_file = os.path.join(tmp_dir, basename) | 712 tmp_zip_file = os.path.join(tmp_dir, basename) |
613 | 713 |
614 if not os.path.exists(tmp_zip_file): | 714 if not os.path.exists(tmp_zip_file): |
615 gsu.Copy(dartiumFile, tmp_zip_file, False) | 715 gsu.Copy(dartiumFile, tmp_zip_file, False) |
616 | 716 |
617 # Upload dartium zip to make sure we have consistent dartium downloads | 717 # Upload dartium zip to make sure we have consistent dartium downloads |
618 UploadFile(tmp_zip_file) | 718 UploadFile(tmp_zip_file) |
619 | 719 |
620 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665 | 720 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665 |
621 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | 721 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) |
622 dartium_zip.UnZip(unzip_dir) | 722 dartium_zip.UnZip(unzip_dir) |
623 else: | 723 else: |
624 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | 724 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) |
625 | 725 |
626 dart_zip_path = join(buildout, rcpZipFile) | 726 dart_zip_path = join(buildout, rcpZipFile) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') | 799 infofile = join('dart', 'DartEditor.app', 'Contents', 'Info.plist') |
700 subprocess.call(['unzip', zipFile, infofile], env=os.environ) | 800 subprocess.call(['unzip', zipFile, infofile], env=os.environ) |
701 ReplaceInFiles( | 801 ReplaceInFiles( |
702 [infofile], | 802 [infofile], |
703 [('<dict>', | 803 [('<dict>', |
704 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) | 804 '<dict>\n\t<key>NSHighResolutionCapable</key>\n\t\t<true/>')]) |
705 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) | 805 subprocess.call(['zip', '-q', zipFile, infofile], env=os.environ) |
706 os.remove(infofile) | 806 os.remove(infofile) |
707 | 807 |
708 | 808 |
709 def CalculateChecksum(filename): | |
710 """Calculate the MD5 checksum for filename.""" | |
711 | |
712 md5 = hashlib.md5() | |
713 | |
714 with open(filename, 'rb') as f: | |
715 data = f.read(65536) | |
716 while len(data) > 0: | |
717 md5.update(data) | |
718 data = f.read(65536) | |
719 | |
720 return md5.hexdigest() | |
721 | |
722 | |
723 def CreateChecksumFile(filename): | |
724 """Create and upload an MD5 checksum file for filename.""" | |
725 | |
726 checksum = CalculateChecksum(filename) | |
727 checksum_filename = '%s.md5sum' % filename | |
728 | |
729 with open(checksum_filename, 'w') as f: | |
730 f.write('%s *%s' % (checksum, os.path.basename(filename))) | |
731 | |
732 return checksum_filename | |
733 | |
734 | |
735 def RunEditorTests(buildout, buildos): | 809 def RunEditorTests(buildout, buildos): |
736 StartBuildStep('run_tests') | 810 StartBuildStep('run_tests') |
737 | 811 |
738 for editorArchive in _GetTestableRcpArchives(buildout): | 812 for editorArchive in _GetTestableRcpArchives(buildout): |
739 with utils.TempDir('editor_') as tempDir: | 813 with utils.TempDir('editor_') as tempDir: |
740 print 'Running tests for %s...' % editorArchive | 814 print 'Running tests for %s...' % editorArchive |
741 | 815 |
742 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) | 816 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) |
743 zipper.UnZip(tempDir) | 817 zipper.UnZip(tempDir) |
744 | 818 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 try: | 906 try: |
833 Gsutil(['rm', '-R', join(gsPath, '*')]) | 907 Gsutil(['rm', '-R', join(gsPath, '*')]) |
834 except: | 908 except: |
835 # Ignore this, in the general case there is nothing. | 909 # Ignore this, in the general case there is nothing. |
836 pass | 910 pass |
837 # create eclipse-update/index.html first to ensure eclipse-update prefix | 911 # create eclipse-update/index.html first to ensure eclipse-update prefix |
838 # exists (needed for recursive copy to follow) | 912 # exists (needed for recursive copy to follow) |
839 Gsutil(['cp', '-a', 'public-read', | 913 Gsutil(['cp', '-a', 'public-read', |
840 r'file://' + join(buildout, 'buildRepo', 'index.html'), | 914 r'file://' + join(buildout, 'buildRepo', 'index.html'), |
841 join(gsPath,'index.html')]) | 915 join(gsPath,'index.html')]) |
| 916 |
842 # recursively copy update site contents | 917 # recursively copy update site contents |
843 UploadDirectory(glob.glob(join(buildout, 'buildRepo', '*')), gsPath) | 918 UploadDirectory(glob.glob(join(buildout, 'buildRepo', '*')), gsPath) |
844 | 919 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo')) |
845 | 920 |
846 def CreateApiDocs(buildLocation): | 921 def CreateApiDocs(buildLocation): |
847 """Zip up api_docs, upload it, and upload the raw tree of docs""" | 922 """Zip up api_docs, upload it, and upload the raw tree of docs""" |
848 | 923 |
849 apidir = join(DART_PATH, | 924 apidir = join(DART_PATH, |
850 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 925 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
851 'api_docs') | 926 'api_docs') |
852 | 927 |
853 shutil.rmtree(apidir, ignore_errors = True) | 928 shutil.rmtree(apidir, ignore_errors = True) |
854 | 929 |
855 CallBuildScript('release', 'ia32', 'api_docs') | 930 CallBuildScript('release', 'ia32', 'api_docs') |
856 | 931 |
857 UploadApiDocs(apidir) | 932 UploadApiDocs(apidir) |
858 | 933 |
859 api_zip = join(buildLocation, 'dart-api-docs.zip') | 934 api_zip = join(buildLocation, 'dart-api-docs.zip') |
860 | 935 |
861 CreateZip(apidir, api_zip) | 936 CreateZip(apidir, api_zip) |
862 | 937 |
863 # upload to continuous/svn_rev and to continuous/latest | 938 # upload to continuous/svn_rev and to continuous/latest |
864 UploadFile(api_zip, False) | 939 UploadFile(api_zip, False) |
865 | 940 |
| 941 DartArchiveUploadAPIDocs(api_zip) |
| 942 |
866 | 943 |
867 def CreateSDK(sdkpath): | 944 def CreateSDK(sdkpath): |
868 """Create the dart-sdk's for the current OS""" | 945 """Create the dart-sdk's for the current OS""" |
869 | 946 |
870 if BUILD_OS == 'linux': | 947 if BUILD_OS == 'linux': |
871 return CreateLinuxSDK(sdkpath) | 948 return CreateLinuxSDK(sdkpath) |
872 if BUILD_OS == 'macos': | 949 if BUILD_OS == 'macos': |
873 return CreateMacosSDK(sdkpath) | 950 return CreateMacosSDK(sdkpath) |
874 if BUILD_OS == 'win32': | 951 if BUILD_OS == 'win32': |
875 return CreateWin32SDK(sdkpath) | 952 return CreateWin32SDK(sdkpath) |
876 | 953 |
877 | |
878 def CreateLinuxSDK(sdkpath): | 954 def CreateLinuxSDK(sdkpath): |
879 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), | 955 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), |
880 'dart-sdk') | 956 'dart-sdk') |
881 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), | 957 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), |
882 'dart-sdk') | 958 'dart-sdk') |
883 | 959 |
884 # Build the SDK | 960 # Build the SDK |
885 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 961 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
886 | 962 |
887 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') | 963 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') |
888 sdk32_tgz = join(sdkpath, 'dartsdk-linux-32.tar.gz') | 964 sdk32_tgz = join(sdkpath, 'dartsdk-linux-32.tar.gz') |
889 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') | 965 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') |
890 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz') | 966 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz') |
891 | 967 |
892 CreateZip(sdkdir32, sdk32_zip) | 968 CreateZip(sdkdir32, sdk32_zip) |
893 CreateTgz(sdkdir32, sdk32_tgz) | 969 CreateTgz(sdkdir32, sdk32_tgz) |
894 CreateZip(sdkdir64, sdk64_zip) | 970 CreateZip(sdkdir64, sdk64_zip) |
895 CreateTgz(sdkdir64, sdk64_tgz) | 971 CreateTgz(sdkdir64, sdk64_tgz) |
896 | 972 |
897 UploadFile(sdk32_zip) | 973 UploadFile(sdk32_zip) |
898 UploadFile(sdk32_tgz) | 974 UploadFile(sdk32_tgz) |
899 UploadFile(sdk64_zip) | 975 UploadFile(sdk64_zip) |
900 UploadFile(sdk64_tgz) | 976 UploadFile(sdk64_tgz) |
901 | 977 |
| 978 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip) |
| 979 |
902 return sdk32_zip | 980 return sdk32_zip |
903 | 981 |
904 | 982 |
905 def CreateMacosSDK(sdkpath): | 983 def CreateMacosSDK(sdkpath): |
906 # Build the SDK | 984 # Build the SDK |
907 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 985 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
908 | 986 |
909 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') | 987 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') |
910 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') | 988 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') |
911 sdk32_tgz = join(sdkpath, 'dartsdk-macos-32.tar.gz') | 989 sdk32_tgz = join(sdkpath, 'dartsdk-macos-32.tar.gz') |
912 sdk64_tgz = join(sdkpath, 'dartsdk-macos-64.tar.gz') | 990 sdk64_tgz = join(sdkpath, 'dartsdk-macos-64.tar.gz') |
913 | 991 |
914 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), | 992 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), |
915 'dart-sdk'), sdk32_zip) | 993 'dart-sdk'), sdk32_zip) |
916 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), | 994 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), |
917 'dart-sdk'), sdk64_zip) | 995 'dart-sdk'), sdk64_zip) |
918 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), | 996 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), |
919 'dart-sdk'), sdk32_tgz) | 997 'dart-sdk'), sdk32_tgz) |
920 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), | 998 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), |
921 'dart-sdk'), sdk64_tgz) | 999 'dart-sdk'), sdk64_tgz) |
922 | 1000 |
923 UploadFile(sdk32_zip) | 1001 UploadFile(sdk32_zip) |
924 UploadFile(sdk64_zip) | 1002 UploadFile(sdk64_zip) |
925 UploadFile(sdk32_tgz) | 1003 UploadFile(sdk32_tgz) |
926 UploadFile(sdk64_tgz) | 1004 UploadFile(sdk64_tgz) |
927 | 1005 |
| 1006 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip) |
| 1007 |
928 return sdk32_zip | 1008 return sdk32_zip |
929 | 1009 |
930 | 1010 |
931 def CreateWin32SDK(sdkpath): | 1011 def CreateWin32SDK(sdkpath): |
932 # Build the SDK | 1012 # Build the SDK |
933 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1013 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
934 | 1014 |
935 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') | 1015 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') |
936 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') | 1016 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') |
937 | 1017 |
938 CreateZipWindows(join(DART_PATH, | 1018 CreateZipWindows(join(DART_PATH, |
939 utils.GetBuildRoot('win32', 'release', 'ia32'), | 1019 utils.GetBuildRoot('win32', 'release', 'ia32'), |
940 'dart-sdk'), sdk32_zip) | 1020 'dart-sdk'), sdk32_zip) |
941 CreateZipWindows(join(DART_PATH, | 1021 CreateZipWindows(join(DART_PATH, |
942 utils.GetBuildRoot('win32', 'release', 'x64'), | 1022 utils.GetBuildRoot('win32', 'release', 'x64'), |
943 'dart-sdk'), sdk64_zip) | 1023 'dart-sdk'), sdk64_zip) |
944 | 1024 |
945 UploadFile(sdk32_zip) | 1025 UploadFile(sdk32_zip) |
946 UploadFile(sdk64_zip) | 1026 UploadFile(sdk64_zip) |
947 | 1027 |
| 1028 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip) |
| 1029 |
948 return sdk32_zip | 1030 return sdk32_zip |
949 | 1031 |
950 | 1032 |
951 def CallBuildScript(mode, arch, target): | 1033 def CallBuildScript(mode, arch, target): |
952 """invoke tools/build.py""" | 1034 """invoke tools/build.py""" |
953 buildScript = join(TOOLS_PATH, 'build.py') | 1035 buildScript = join(TOOLS_PATH, 'build.py') |
954 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, | 1036 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, |
955 target] | 1037 target] |
956 try: | 1038 try: |
957 ExecuteCommand(cmd, DART_PATH) | 1039 ExecuteCommand(cmd, DART_PATH) |
(...skipping 27 matching lines...) Expand all Loading... |
985 FileDelete(targetFile) | 1067 FileDelete(targetFile) |
986 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)], | 1068 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)], |
987 os.path.dirname(directory)) | 1069 os.path.dirname(directory)) |
988 | 1070 |
989 | 1071 |
990 def UploadFile(targetFile, createChecksum=True): | 1072 def UploadFile(targetFile, createChecksum=True): |
991 """Upload the given file to google storage.""" | 1073 """Upload the given file to google storage.""" |
992 | 1074 |
993 if (NO_UPLOAD): | 1075 if (NO_UPLOAD): |
994 return | 1076 return |
995 | 1077 |
996 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile)) | 1078 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile)) |
997 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile)) | 1079 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile)) |
998 | 1080 |
999 if (createChecksum): | 1081 if createChecksum: |
1000 checksum = CreateChecksumFile(targetFile) | 1082 checksum = bot_utils.CreateChecksumFile(targetFile) |
1001 | 1083 |
1002 checksumRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(checksum)) | 1084 checksumRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(checksum)) |
1003 checksumLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(checksum)) | 1085 checksumLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(checksum)) |
1004 | 1086 |
1005 Gsutil(['cp', '-a', 'public-read', r'file://' + targetFile, filePathRev]) | 1087 Gsutil(['cp', '-a', 'public-read', r'file://' + targetFile, filePathRev]) |
1006 | 1088 |
1007 if (createChecksum): | 1089 if (createChecksum): |
1008 Gsutil(['cp', '-a', 'public-read', r'file://' + checksum, checksumRev]) | 1090 Gsutil(['cp', '-a', 'public-read', r'file://' + checksum, checksumRev]) |
1009 | 1091 |
1010 Gsutil(['cp', '-a', 'public-read', filePathRev, filePathLatest]) | 1092 Gsutil(['cp', '-a', 'public-read', filePathRev, filePathLatest]) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 """delete the given file - do not re-throw any exceptions that occur""" | 1148 """delete the given file - do not re-throw any exceptions that occur""" |
1067 if os.path.exists(f): | 1149 if os.path.exists(f): |
1068 try: | 1150 try: |
1069 os.remove(f) | 1151 os.remove(f) |
1070 except OSError: | 1152 except OSError: |
1071 print 'error deleting %s' % f | 1153 print 'error deleting %s' % f |
1072 | 1154 |
1073 | 1155 |
1074 if __name__ == '__main__': | 1156 if __name__ == '__main__': |
1075 sys.exit(main()) | 1157 sys.exit(main()) |
OLD | NEW |