Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, 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 imp | 9 import imp |
| 10 import optparse | 10 import optparse |
| 11 import os | 11 import os |
| 12 import re | 12 import re |
| 13 import shutil | 13 import shutil |
| 14 import stat | 14 import stat |
| 15 import subprocess | 15 import subprocess |
| 16 import sys | 16 import sys |
| 17 import tempfile | 17 import tempfile |
| 18 import zipfile | 18 import zipfile |
| 19 import ziputils | 19 import ziputils |
| 20 | 20 |
| 21 from os.path import join | 21 from os.path import join |
| 22 | 22 |
| 23 BUILD_OS = None | 23 BUILD_OS = None |
| 24 DART_PATH = None | 24 DART_PATH = None |
| 25 TOOLS_PATH = None | 25 TOOLS_PATH = None |
| 26 | 26 |
| 27 GSU_PATH_REV = None | |
| 28 GSU_PATH_LATEST = None | |
| 29 GSU_API_DOCS_PATH = None | 27 GSU_API_DOCS_PATH = None |
| 30 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' | 28 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' |
| 31 | 29 |
| 32 CHANNEL = None | 30 CHANNEL = None |
| 33 PLUGINS_BUILD = None | 31 PLUGINS_BUILD = None |
| 34 REVISION = None | 32 REVISION = None |
| 35 SYSTEM = None | 33 SYSTEM = None |
| 36 TRUNK_BUILD = None | |
| 37 | 34 |
| 38 NO_UPLOAD = None | 35 NO_UPLOAD = None |
| 39 | 36 |
| 40 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) | 37 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) |
| 41 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) | 38 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) |
| 42 bot_utils = imp.load_source('bot_utils', | 39 bot_utils = imp.load_source('bot_utils', |
| 43 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) | 40 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) |
| 44 | 41 |
| 45 def DartArchiveFile(local_path, remote_path, create_md5sum=False): | 42 def DartArchiveFile(local_path, remote_path, create_md5sum=False): |
| 46 # Copy it to the new unified gs://dart-archive bucket | 43 # Copy it to the new unified gs://dart-archive bucket |
| 47 # TODO(kustermann/ricow): Remove all the old archiving code, once everything | |
| 48 # points to the new location | |
| 49 gsutil = bot_utils.GSUtil() | 44 gsutil = bot_utils.GSUtil() |
| 50 gsutil.upload(local_path, remote_path, public=True) | 45 gsutil.upload(local_path, remote_path, public=True) |
| 51 if create_md5sum: | 46 if create_md5sum: |
| 52 # 'local_path' may have a different filename than 'remote_path'. So we need | 47 # 'local_path' may have a different filename than 'remote_path'. So we need |
| 53 # to make sure the *.md5sum file contains the correct name. | 48 # to make sure the *.md5sum file contains the correct name. |
| 54 assert '/' in remote_path and not remote_path.endswith('/') | 49 assert '/' in remote_path and not remote_path.endswith('/') |
| 55 mangled_filename = remote_path[remote_path.rfind('/') + 1:] | 50 mangled_filename = remote_path[remote_path.rfind('/') + 1:] |
| 56 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) | 51 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) |
| 57 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) | 52 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) |
| 58 | 53 |
| 59 def DartArchiveUploadEditorZipFile(zipfile): | 54 def DartArchiveUploadEditorZipFile(zipfile): |
| 60 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ | |
| 61 # Remove this once the channel transition is done. | |
| 62 if CHANNEL == 'trunk': return | |
| 63 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | 55 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 64 gsutil = bot_utils.GSUtil() | 56 gsutil = bot_utils.GSUtil() |
| 65 | 57 |
| 66 basename = os.path.basename(zipfile) | 58 basename = os.path.basename(zipfile) |
| 67 system = None | 59 system = None |
| 68 arch = None | 60 arch = None |
| 69 if basename.startswith('darteditor-linux'): | 61 if basename.startswith('darteditor-linux'): |
| 70 system = 'linux' | 62 system = 'linux' |
| 71 elif basename.startswith('darteditor-mac'): | 63 elif basename.startswith('darteditor-mac'): |
| 72 system = 'macos' | 64 system = 'macos' |
| 73 elif basename.startswith('darteditor-win'): | 65 elif basename.startswith('darteditor-win'): |
| 74 system = 'windows' | 66 system = 'windows' |
| 75 | 67 |
| 76 if basename.endswith('-32.zip'): | 68 if basename.endswith('-32.zip'): |
| 77 arch = 'ia32' | 69 arch = 'ia32' |
| 78 elif basename.endswith('-64.zip'): | 70 elif basename.endswith('-64.zip'): |
| 79 arch = 'x64' | 71 arch = 'x64' |
| 80 | 72 |
| 81 assert system and arch | 73 assert system and arch |
| 82 | 74 |
| 83 for revision in [REVISION, 'latest']: | 75 for revision in [REVISION, 'latest']: |
| 84 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), | 76 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), |
| 85 create_md5sum=True) | 77 create_md5sum=True) |
| 86 | 78 |
| 87 def DartArchiveUploadUpdateSite(local_path): | 79 def DartArchiveUploadUpdateSite(local_path): |
| 88 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ | |
| 89 # Remove this once the channel transition is done. | |
| 90 if CHANNEL == 'trunk': return | |
| 91 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | 80 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 92 gsutil = bot_utils.GSUtil() | 81 gsutil = bot_utils.GSUtil() |
| 93 for revision in [REVISION, 'latest']: | 82 for revision in [REVISION, 'latest']: |
| 94 update_site_dir = namer.editor_eclipse_update_directory(revision) | 83 update_site_dir = namer.editor_eclipse_update_directory(revision) |
| 95 try: | 84 try: |
| 96 gsutil.remove(update_site_dir, recursive=True) | 85 gsutil.remove(update_site_dir, recursive=True) |
| 97 except: | 86 except: |
| 98 # Ignore this, in the general case there is nothing. | 87 # Ignore this, in the general case there is nothing. |
| 99 pass | 88 pass |
| 100 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) | 89 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) |
| 101 | 90 |
| 102 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip): | 91 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip): |
| 103 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ | |
| 104 # Remove this once the channel transition is done. | |
| 105 if CHANNEL == 'trunk': return | |
| 106 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | 92 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 107 for revision in [REVISION, 'latest']: | 93 for revision in [REVISION, 'latest']: |
| 108 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') | 94 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') |
| 109 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') | 95 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') |
| 110 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) | 96 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) |
| 111 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) | 97 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) |
| 112 | 98 |
| 113 def DartArchiveUploadAPIDocs(api_zip): | 99 def DartArchiveUploadAPIDocs(api_zip): |
| 114 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/ | |
| 115 # Remove this once the channel transition is done. | |
| 116 if CHANNEL == 'trunk': return | |
| 117 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | 100 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 118 for revision in [REVISION, 'latest']: | 101 for revision in [REVISION, 'latest']: |
| 119 destination = (namer.apidocs_directory(revision) + '/' + | 102 destination = (namer.apidocs_directory(revision) + '/' + |
| 120 namer.apidocs_zipfilename()) | 103 namer.apidocs_zipfilename()) |
| 121 DartArchiveFile(api_zip, destination, create_md5sum=False) | 104 DartArchiveFile(api_zip, destination, create_md5sum=False) |
| 122 | 105 |
| 123 def DartArchiveUploadVersionFile(version_file): | 106 def DartArchiveUploadVersionFile(version_file): |
| 124 # TODO(kustermann): We don't archive trunk builds to gs://dart-archive/. | |
| 125 # Remove this once the channel transition is done. | |
| 126 if CHANNEL == 'trunk': return | |
| 127 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) | 107 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 128 for revision in [REVISION, 'latest']: | 108 for revision in [REVISION, 'latest']: |
| 129 DartArchiveFile(version_file, namer.version_filepath(revision), | 109 DartArchiveFile(version_file, namer.version_filepath(revision), |
| 130 create_md5sum=False) | 110 create_md5sum=False) |
| 131 | 111 |
| 132 def DartArchiveUploadInstaller( | 112 def DartArchiveUploadInstaller( |
| 133 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): | 113 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): |
| 134 namer = bot_utils.GCSNamer(CHANNEL, release_type) | 114 namer = bot_utils.GCSNamer(CHANNEL, release_type) |
| 135 gsu_path = namer.editor_installer_filepath( | 115 gsu_path = namer.editor_installer_filepath( |
| 136 REVISION, SYSTEM, arch, extension) | 116 REVISION, SYSTEM, arch, extension) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 | 222 |
| 243 print ' '.join(args) | 223 print ' '.join(args) |
| 244 status = subprocess.call(args, shell=is_windows) | 224 status = subprocess.call(args, shell=is_windows) |
| 245 os.chdir(cwd) | 225 os.chdir(cwd) |
| 246 return status | 226 return status |
| 247 | 227 |
| 248 | 228 |
| 249 def BuildOptions(): | 229 def BuildOptions(): |
| 250 """Setup the argument processing for this program.""" | 230 """Setup the argument processing for this program.""" |
| 251 result = optparse.OptionParser() | 231 result = optparse.OptionParser() |
| 252 result.set_default('dest', 'gs://dart-editor-archive-continuous') | |
| 253 result.add_option('-m', '--mode', | 232 result.add_option('-m', '--mode', |
| 254 help='Build variants (comma-separated).', | 233 help='Build variants (comma-separated).', |
| 255 metavar='[all,debug,release]', | 234 metavar='[all,debug,release]', |
| 256 default='debug') | 235 default='debug') |
| 257 result.add_option('-v', '--verbose', | 236 result.add_option('-v', '--verbose', |
| 258 help='Verbose output.', | 237 help='Verbose output.', |
| 259 default=False, action='store') | 238 default=False, action='store') |
| 260 result.add_option('-r', '--revision', | 239 result.add_option('-r', '--revision', |
| 261 help='SVN Revision.', | 240 help='SVN Revision.', |
| 262 action='store') | 241 action='store') |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 273 help='Fetch editor, build installer and archive it.', | 252 help='Fetch editor, build installer and archive it.', |
| 274 action='store_true', default=False) | 253 action='store_true', default=False) |
| 275 return result | 254 return result |
| 276 | 255 |
| 277 def main(): | 256 def main(): |
| 278 """Main entry point for the build program.""" | 257 """Main entry point for the build program.""" |
| 279 global BUILD_OS | 258 global BUILD_OS |
| 280 global CHANNEL | 259 global CHANNEL |
| 281 global DART_PATH | 260 global DART_PATH |
| 282 global GSU_API_DOCS_PATH | 261 global GSU_API_DOCS_PATH |
| 283 global GSU_PATH_LATEST | |
| 284 global GSU_PATH_REV | |
| 285 global NO_UPLOAD | 262 global NO_UPLOAD |
| 286 global PLUGINS_BUILD | 263 global PLUGINS_BUILD |
| 287 global REVISION | 264 global REVISION |
| 288 global SYSTEM | 265 global SYSTEM |
| 289 global TOOLS_PATH | 266 global TOOLS_PATH |
| 290 global TRUNK_BUILD | |
| 291 | 267 |
| 292 if not sys.argv: | 268 if not sys.argv: |
| 293 print 'Script pathname not known, giving up.' | 269 print 'Script pathname not known, giving up.' |
| 294 return 1 | 270 return 1 |
| 295 | 271 |
| 296 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) | 272 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) |
| 297 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) | 273 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) |
| 298 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 274 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', |
| 299 'third_party')) | 275 'third_party')) |
| 300 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 276 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 lastc = revision[-1] | 339 lastc = revision[-1] |
| 364 if lastc.isalpha(): | 340 if lastc.isalpha(): |
| 365 revision = revision[0:-1] | 341 revision = revision[0:-1] |
| 366 index = revision.find(':') | 342 index = revision.find(':') |
| 367 if index > -1: | 343 if index > -1: |
| 368 revision = revision[0:index] | 344 revision = revision[0:index] |
| 369 print 'revision = |{0}|'.format(revision) | 345 print 'revision = |{0}|'.format(revision) |
| 370 buildout = os.path.abspath(options.out) | 346 buildout = os.path.abspath(options.out) |
| 371 print 'buildout = {0}'.format(buildout) | 347 print 'buildout = {0}'.format(buildout) |
| 372 | 348 |
| 373 # Get user name. If it does not start with chrome then deploy to the test | 349 username = utils.GetUserName() |
| 374 # bucket; otherwise deploy to the continuous bucket. | 350 if not username: |
| 375 username = os.environ.get('USER') | |
| 376 if username is None: | |
| 377 username = os.environ.get('USERNAME') | |
| 378 | |
| 379 if username is None: | |
| 380 print 'Could not find username' | 351 print 'Could not find username' |
| 381 return 6 | 352 return 6 |
| 382 | 353 |
| 383 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') | 354 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') |
| 384 sdk_environment = os.environ | 355 sdk_environment = os.environ |
| 385 if sdk_environment.has_key('JAVA_HOME'): | 356 if sdk_environment.has_key('JAVA_HOME'): |
| 386 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) | 357 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) |
| 387 | 358 |
| 388 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable] | 359 # dart-editor(-be/dev/stable),dart-editor-(win/mac/linux)(-be/dev/stable) |
|
ricow1
2013/11/07 14:09:21
you are missing installer here, so either add it o
kustermann
2013/11/07 15:00:23
Removed
| |
| 389 builder_name = str(options.name) | 360 builder_name = str(options.name) |
| 390 | 361 |
| 391 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?' | 362 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?' |
| 392 '(-(?P<system>(win|mac|linux)))?' + | 363 '(-(?P<system>(win|mac|linux)))?' + |
| 393 '(-(?P<channel>(trunk|be|dev|stable)))?$') | 364 '(-(?P<channel>(be|dev|stable)))?$') |
| 394 match = re.match(EDITOR_REGEXP, builder_name) | 365 match = re.match(EDITOR_REGEXP, builder_name) |
| 395 if not match: | 366 if not match: |
| 396 raise Exception("Buildername '%s' does not match pattern '%s'." | 367 raise Exception("Buildername '%s' does not match pattern '%s'." |
| 397 % (builder_name, EDITOR_REGEXP)) | 368 % (builder_name, EDITOR_REGEXP)) |
| 398 | 369 |
| 399 CHANNEL = match.groupdict()['channel'] or 'be' | 370 CHANNEL = match.groupdict()['channel'] or 'be' |
| 400 SYSTEM = match.groupdict()['system'] | 371 SYSTEM = match.groupdict()['system'] |
| 401 BUILD_INSTALLER = bool(match.groupdict()['installer']) | 372 BUILD_INSTALLER = bool(match.groupdict()['installer']) |
| 402 | 373 |
| 403 TRUNK_BUILD = CHANNEL == 'trunk' | |
| 404 PLUGINS_BUILD = SYSTEM is None | 374 PLUGINS_BUILD = SYSTEM is None |
| 405 REVISION = revision | 375 REVISION = revision |
| 406 | 376 |
| 407 # Make sure the buildername and the options agree | 377 # Make sure the buildername and the options agree |
| 408 assert BUILD_INSTALLER == options.build_installer | 378 assert BUILD_INSTALLER == options.build_installer |
| 409 | 379 |
| 410 if username.startswith('chrome'): | 380 running_on_buildbot = username.startswith('chrome') |
| 411 if TRUNK_BUILD: | |
| 412 bucket = 'gs://dart-editor-archive-trunk' | |
| 413 else: | |
| 414 bucket = 'gs://dart-editor-archive-continuous' | |
| 415 running_on_buildbot = True | |
| 416 else: | |
| 417 bucket = 'gs://dart-editor-archive-testing' | |
| 418 running_on_buildbot = False | |
| 419 sdk_environment['DART_LOCAL_BUILD'] = 'dart-editor-archive-testing' | |
| 420 | 381 |
| 421 GSU_PATH_REV = '%s/%s' % (bucket, REVISION) | |
| 422 GSU_PATH_LATEST = '%s/%s' % (bucket, 'latest') | |
| 423 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) | 382 GSU_API_DOCS_PATH = '%s/%s' % (GSU_API_DOCS_BUCKET, REVISION) |
| 424 | 383 |
| 425 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 384 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
| 426 gsu = gsutil.GsUtil(False, homegsutil, | 385 gsu = gsutil.GsUtil(False, homegsutil, |
| 427 running_on_buildbot=running_on_buildbot) | 386 running_on_buildbot=running_on_buildbot) |
| 428 | 387 |
| 429 def build_installer(): | 388 def build_installer(): |
| 430 release_type = bot_utils.ReleaseType.SIGNED | 389 release_type = bot_utils.ReleaseType.SIGNED |
| 431 if CHANNEL == 'be': | 390 if CHANNEL == 'be': |
| 432 # We don't have signed bits on bleeding_edge, so we take the unsigned | 391 # We don't have signed bits on bleeding_edge, so we take the unsigned |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 _InstallArtifacts(buildout, buildos, extra_artifacts) | 551 _InstallArtifacts(buildout, buildos, extra_artifacts) |
| 593 | 552 |
| 594 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip | 553 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip |
| 595 RenameRcpZipFiles(buildout) | 554 RenameRcpZipFiles(buildout) |
| 596 | 555 |
| 597 PostProcessEditorBuilds(buildout, buildos) | 556 PostProcessEditorBuilds(buildout, buildos) |
| 598 | 557 |
| 599 if running_on_buildbot: | 558 if running_on_buildbot: |
| 600 version_file = _FindVersionFile(buildout) | 559 version_file = _FindVersionFile(buildout) |
| 601 if version_file: | 560 if version_file: |
| 602 UploadFile(version_file, False) | |
| 603 DartArchiveUploadVersionFile(version_file) | 561 DartArchiveUploadVersionFile(version_file) |
| 604 | 562 |
| 605 found_zips = _FindRcpZipFiles(buildout) | 563 found_zips = _FindRcpZipFiles(buildout) |
| 606 for zipfile in found_zips: | 564 for zipfile in found_zips: |
| 607 UploadFile(zipfile) | |
| 608 DartArchiveUploadEditorZipFile(zipfile) | 565 DartArchiveUploadEditorZipFile(zipfile) |
| 609 | 566 |
| 610 return 0 | 567 return 0 |
| 611 | 568 |
| 612 if BUILD_INSTALLER: | 569 if BUILD_INSTALLER: |
| 613 build_installer() | 570 build_installer() |
| 614 else: | 571 else: |
| 615 build_editor(sdk_zip) | 572 build_editor(sdk_zip) |
| 616 finally: | 573 finally: |
| 617 if ant_property_file is not None: | 574 if ant_property_file is not None: |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 # black/white-listing mechanism. | 770 # black/white-listing mechanism. |
| 814 FileDelete(join(add_path, 'mini_installer.exe')) | 771 FileDelete(join(add_path, 'mini_installer.exe')) |
| 815 FileDelete(join(add_path, 'sync_unit_tests.exe')) | 772 FileDelete(join(add_path, 'sync_unit_tests.exe')) |
| 816 FileDelete(join(add_path, 'chrome.packed.7z')) | 773 FileDelete(join(add_path, 'chrome.packed.7z')) |
| 817 | 774 |
| 818 # Add dartium to the rcp zip | 775 # Add dartium to the rcp zip |
| 819 dart_zip.AddDirectoryTree(add_path, 'dart/chromium') | 776 dart_zip.AddDirectoryTree(add_path, 'dart/chromium') |
| 820 shutil.rmtree(tmp_dir, True) | 777 shutil.rmtree(tmp_dir, True) |
| 821 | 778 |
| 822 | 779 |
| 823 def InstallDartiumFromOldDartiumArchive(buildroot, buildout, buildos, gsu): | |
| 824 """Install Dartium into the RCP zip files and upload a version of Dartium | |
| 825 | |
| 826 Args: | |
| 827 buildroot: the boot of the build output | |
| 828 buildout: the location of the ant build output | |
| 829 buildos: the OS the build is running under | |
| 830 gsu: the gsutil wrapper | |
| 831 Raises: | |
| 832 Exception: if no dartium files can be found | |
| 833 """ | |
| 834 print 'InstallDartium(%s, %s, %s)' % (buildroot, buildout, buildos) | |
| 835 | |
| 836 tmp_dir = os.path.join(buildroot, 'tmp') | |
| 837 | |
| 838 rcpZipFiles = _FindRcpZipFiles(buildout) | |
| 839 | |
| 840 for rcpZipFile in rcpZipFiles: | |
| 841 print ' found rcp: %s' % rcpZipFile | |
| 842 | |
| 843 dartiumFiles = [] | |
| 844 | |
| 845 dartiumFiles.append("gs://dartium-archive/dartium-mac-full-trunk/" | |
| 846 + "dartium-mac-full-trunk-%s.0.zip" % REVISION) | |
| 847 dartiumFiles.append("gs://dartium-archive/dartium-win-full-trunk/" | |
| 848 + "dartium-win-full-trunk-%s.0.zip" % REVISION) | |
| 849 dartiumFiles.append("gs://dartium-archive/dartium-lucid32-full-trunk/" | |
| 850 + "dartium-lucid32-full-trunk-%s.0.zip" % REVISION) | |
| 851 dartiumFiles.append("gs://dartium-archive/dartium-lucid64-full-trunk/" | |
| 852 + "dartium-lucid64-full-trunk-%s.0.zip" % REVISION) | |
| 853 | |
| 854 for rcpZipFile in rcpZipFiles: | |
| 855 searchString = None | |
| 856 | |
| 857 # dart-editor-linux.gtk.x86.zip, ... | |
| 858 | |
| 859 if '-linux.gtk.x86.zip' in rcpZipFile: | |
| 860 searchString = 'dartium-lucid32' | |
| 861 if '-linux.gtk.x86_64.zip' in rcpZipFile: | |
| 862 searchString = 'dartium-lucid64' | |
| 863 if 'macosx' in rcpZipFile: | |
| 864 searchString = 'dartium-mac' | |
| 865 if 'win32' in rcpZipFile: | |
| 866 searchString = 'dartium-win' | |
| 867 | |
| 868 for dartiumFile in dartiumFiles: | |
| 869 if searchString in dartiumFile: | |
| 870 #download and unzip dartium | |
| 871 unzip_dir = os.path.join(tmp_dir, | |
| 872 os.path.splitext(os.path.basename(dartiumFile))[0]) | |
| 873 if not os.path.exists(unzip_dir): | |
| 874 os.makedirs(unzip_dir) | |
| 875 # Always download as searchString.zip | |
| 876 basename = "%s.zip" % searchString | |
| 877 tmp_zip_file = os.path.join(tmp_dir, basename) | |
| 878 | |
| 879 if not os.path.exists(tmp_zip_file): | |
| 880 if gsu.Copy(dartiumFile, tmp_zip_file, False): | |
| 881 raise Exception("gsutil command failed, aborting.") | |
| 882 | |
| 883 # Upload dartium zip to make sure we have consistent dartium downloads | |
| 884 UploadFile(tmp_zip_file) | |
| 885 | |
| 886 # Dartium is unzipped into ~ unzip_dir/dartium-win-full-7665.7665 | |
| 887 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | |
| 888 dartium_zip.UnZip(unzip_dir) | |
| 889 else: | |
| 890 dartium_zip = ziputils.ZipUtil(tmp_zip_file, buildos) | |
| 891 | |
| 892 dart_zip_path = join(buildout, rcpZipFile) | |
| 893 dart_zip = ziputils.ZipUtil(dart_zip_path, buildos) | |
| 894 | |
| 895 if 'lin' in buildos: | |
| 896 paths = glob.glob(join(unzip_dir, 'dartium-*')) | |
| 897 add_path = paths[0] | |
| 898 zip_rel_path = 'dart/chromium' | |
| 899 # add to the rcp zip | |
| 900 dart_zip.AddDirectoryTree(add_path, zip_rel_path) | |
| 901 if 'win' in buildos: | |
| 902 paths = glob.glob(join(unzip_dir, 'dartium-*')) | |
| 903 add_path = paths[0] | |
| 904 zip_rel_path = 'dart/chromium' | |
| 905 FileDelete(join(add_path, 'mini_installer.exe')) | |
| 906 FileDelete(join(add_path, 'sync_unit_tests.exe')) | |
| 907 FileDelete(join(add_path, 'chrome.packed.7z')) | |
| 908 # add to the rcp zip | |
| 909 dart_zip.AddDirectoryTree(add_path, zip_rel_path) | |
| 910 if 'mac' in buildos: | |
| 911 paths = glob.glob(join(unzip_dir, 'dartium-*')) | |
| 912 add_path = paths[0] | |
| 913 zip_rel_path = 'dart/chromium' | |
| 914 # add to the rcp zip | |
| 915 dart_zip.AddDirectoryTree(add_path, zip_rel_path) | |
| 916 | |
| 917 | |
| 918 shutil.rmtree(tmp_dir, True) | |
| 919 | |
| 920 | |
| 921 def InstallDartium(buildroot, buildout, buildos, gsu): | 780 def InstallDartium(buildroot, buildout, buildos, gsu): |
| 922 if TRUNK_BUILD: | 781 # On our be/dev/stable channels, we fetch dartium from the new |
| 923 # On trunk builds we fetch dartium from the old location (where the | 782 # gs://dart-archive/ location. |
| 924 # dartium-*-trunk builders archive to) | 783 InstallDartiumFromDartArchive(buildroot, buildout, buildos, gsu) |
| 925 InstallDartiumFromOldDartiumArchive(buildroot, buildout, buildos, gsu) | |
| 926 else: | |
| 927 # On our be/dev/stable channels, we fetch dartium from the new | |
| 928 # gs://dart-archive/ location. | |
| 929 InstallDartiumFromDartArchive(buildroot, buildout, buildos, gsu) | |
| 930 | 784 |
| 931 | 785 |
| 932 def _InstallArtifacts(buildout, buildos, extra_artifacts): | 786 def _InstallArtifacts(buildout, buildos, extra_artifacts): |
| 933 """Install extra build artifacts into the RCP zip files. | 787 """Install extra build artifacts into the RCP zip files. |
| 934 | 788 |
| 935 Args: | 789 Args: |
| 936 buildout: the location of the ant build output | 790 buildout: the location of the ant build output |
| 937 buildos: the OS the build is running under | 791 buildos: the OS the build is running under |
| 938 extra_artifacts: the directory containing the extra artifacts | 792 extra_artifacts: the directory containing the extra artifacts |
| 939 """ | 793 """ |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1037 dartium_download_script = join(scratch_dir, 'download_dartium_debug') | 891 dartium_download_script = join(scratch_dir, 'download_dartium_debug') |
| 1038 instantiate_download_script_template(dartium_download_script, { | 892 instantiate_download_script_template(dartium_download_script, { |
| 1039 'VAR_DESTINATION' : dartium_debug_name, | 893 'VAR_DESTINATION' : dartium_debug_name, |
| 1040 'VAR_DOWNLOAD_URL' : | 894 'VAR_DOWNLOAD_URL' : |
| 1041 ("http://dartlang.org/editor/update/channels/%s/%s/dartium/%s" | 895 ("http://dartlang.org/editor/update/channels/%s/%s/dartium/%s" |
| 1042 % (CHANNEL, REVISION, dartium_debug_name)), | 896 % (CHANNEL, REVISION, dartium_debug_name)), |
| 1043 }) | 897 }) |
| 1044 f.AddFile(dartium_download_script, | 898 f.AddFile(dartium_download_script, |
| 1045 'dart/chromium/download_dartium_debug%s' % shell_ending) | 899 'dart/chromium/download_dartium_debug%s' % shell_ending) |
| 1046 | 900 |
| 1047 # Create a editor.properties | 901 # Create a editor.properties |
|
ricow1
2013/11/07 14:09:21
should we move this down to line 924 for increased
kustermann
2013/11/07 15:00:23
I put it up here, because we need to create this f
| |
| 1048 editor_properties = os.path.join(scratch_dir, 'editor.properties') | 902 editor_properties = os.path.join(scratch_dir, 'editor.properties') |
| 1049 with open(editor_properties, 'w') as fd: | 903 with open(editor_properties, 'w') as fd: |
| 1050 fd.write("com.dart.tools.update.core.url=http://dartlang.org" | 904 fd.write("com.dart.tools.update.core.url=http://dartlang.org" |
| 1051 "/editor/update/channels/%s/\n" % CHANNEL) | 905 "/editor/update/channels/%s/\n" % CHANNEL) |
| 1052 | 906 |
| 1053 for zipFile in _FindRcpZipFiles(out_dir): | 907 for zipFile in _FindRcpZipFiles(out_dir): |
| 1054 basename = os.path.basename(zipFile) | 908 basename = os.path.basename(zipFile) |
| 1055 is_64bit = basename.endswith('-64.zip') | 909 is_64bit = basename.endswith('-64.zip') |
| 1056 | 910 |
| 1057 print(' processing %s' % basename) | 911 print(' processing %s' % basename) |
| 1058 | 912 |
| 1059 readme_file = join('dart', 'README') | 913 readme_file = join('dart', 'README') |
| 1060 if (basename.startswith('darteditor-win32-')): | 914 if (basename.startswith('darteditor-win32-')): |
| 1061 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe') | 915 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe') |
| 1062 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ) | 916 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ) |
| 1063 else: | 917 else: |
| 1064 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ) | 918 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ) |
| 1065 | 919 |
| 1066 # If we're on -dev/-stable build: add an editor.properties file | 920 # If we're on -dev/-stable build: add an editor.properties file |
| 1067 # pointing to the correct update location of the editor for the channel | 921 # pointing to the correct update location of the editor for the channel |
| 1068 # we're building for. | 922 # we're building for. |
| 1069 if not TRUNK_BUILD and CHANNEL != 'be': | 923 if CHANNEL != 'be': |
| 1070 f = ziputils.ZipUtil(zipFile, buildos) | 924 f = ziputils.ZipUtil(zipFile, buildos) |
| 1071 f.AddFile(editor_properties, 'dart/editor.properties') | 925 f.AddFile(editor_properties, 'dart/editor.properties') |
| 1072 | 926 |
| 1073 # Add a shell/bat script to download contentshell and dartium debug. | 927 # Add a shell/bat script to download contentshell and dartium debug. |
| 1074 # (including the necessary tools/dartium/download_file.dart helper). | 928 # (including the necessary tools/dartium/download_file.dart helper). |
| 1075 add_download_scripts(zipFile, '64' if is_64bit else '32') | 929 add_download_scripts(zipFile, '64' if is_64bit else '32') |
| 1076 | 930 |
| 1077 # adjust memory params for 64 bit versions | 931 # adjust memory params for 64 bit versions |
| 1078 if is_64bit: | 932 if is_64bit: |
| 1079 if (basename.startswith('darteditor-macos-')): | 933 if (basename.startswith('darteditor-macos-')): |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 | 968 |
| 1115 def Modify64BitDartEditorIni(iniFilePath): | 969 def Modify64BitDartEditorIni(iniFilePath): |
| 1116 f = open(iniFilePath, 'r') | 970 f = open(iniFilePath, 'r') |
| 1117 lines = f.readlines() | 971 lines = f.readlines() |
| 1118 f.close() | 972 f.close() |
| 1119 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' | 973 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' |
| 1120 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' | 974 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' |
| 1121 # Add -d64 to give better error messages to user in 64 bit mode. | 975 # Add -d64 to give better error messages to user in 64 bit mode. |
| 1122 lines[lines.index('-vmargs\n')] = '-vmargs\n-d64\n' | 976 lines[lines.index('-vmargs\n')] = '-vmargs\n-d64\n' |
| 1123 f = open(iniFilePath, 'w') | 977 f = open(iniFilePath, 'w') |
| 1124 f.writelines(lines); | 978 f.writelines(lines) |
| 1125 f.close() | 979 f.close() |
| 1126 | 980 |
| 1127 | 981 |
| 1128 def RunEditorTests(buildout, buildos): | 982 def RunEditorTests(buildout, buildos): |
| 1129 StartBuildStep('run_tests') | 983 StartBuildStep('run_tests') |
| 1130 | 984 |
| 1131 for editorArchive in _GetTestableRcpArchives(buildout): | 985 for editorArchive in _GetTestableRcpArchives(buildout): |
| 1132 with utils.TempDir('editor_') as tempDir: | 986 with utils.TempDir('editor_') as tempDir: |
| 1133 print 'Running tests for %s...' % editorArchive | 987 print 'Running tests for %s...' % editorArchive |
| 1134 | 988 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1208 | 1062 |
| 1209 def BuildUpdateSite(ant, revision, name, buildroot, buildout, | 1063 def BuildUpdateSite(ant, revision, name, buildroot, buildout, |
| 1210 editorpath, buildos): | 1064 editorpath, buildos): |
| 1211 status = ant.RunAnt('../com.google.dart.eclipse.feature_releng', | 1065 status = ant.RunAnt('../com.google.dart.eclipse.feature_releng', |
| 1212 'build.xml', revision, name, buildroot, buildout, | 1066 'build.xml', revision, name, buildroot, buildout, |
| 1213 editorpath, buildos, ['-Dbuild.dir=%s' % buildout]) | 1067 editorpath, buildos, ['-Dbuild.dir=%s' % buildout]) |
| 1214 if status: | 1068 if status: |
| 1215 BuildStepFailure() | 1069 BuildStepFailure() |
| 1216 else: | 1070 else: |
| 1217 StartBuildStep('upload_artifacts') | 1071 StartBuildStep('upload_artifacts') |
| 1218 UploadSite(buildout, "%s/%s" % (GSU_PATH_REV, 'eclipse-update')) | 1072 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo')) |
| 1219 UploadSite(buildout, "%s/%s" % (GSU_PATH_LATEST, 'eclipse-update')) | |
| 1220 return status | 1073 return status |
| 1221 | 1074 |
| 1222 | 1075 |
| 1223 def UploadSite(buildout, gsPath) : | |
| 1224 # remove any old artifacts | |
| 1225 try: | |
| 1226 Gsutil(['rm', '-R', join(gsPath, '*')]) | |
| 1227 except: | |
| 1228 # Ignore this, in the general case there is nothing. | |
| 1229 pass | |
| 1230 # create eclipse-update/index.html first to ensure eclipse-update prefix | |
| 1231 # exists (needed for recursive copy to follow) | |
| 1232 Gsutil(['cp', '-a', 'public-read', | |
| 1233 r'file://' + join(buildout, 'buildRepo', 'index.html'), | |
| 1234 join(gsPath,'index.html')]) | |
| 1235 | |
| 1236 # recursively copy update site contents | |
| 1237 UploadDirectory(glob.glob(join(buildout, 'buildRepo', '*')), gsPath) | |
| 1238 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo')) | |
| 1239 | |
| 1240 def CreateApiDocs(buildLocation): | 1076 def CreateApiDocs(buildLocation): |
| 1241 """Zip up api_docs, upload it, and upload the raw tree of docs""" | 1077 """Zip up api_docs, upload it, and upload the raw tree of docs""" |
| 1242 | 1078 |
| 1243 apidir = join(DART_PATH, | 1079 apidir = join(DART_PATH, |
| 1244 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 1080 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
| 1245 'api_docs') | 1081 'api_docs') |
| 1246 | 1082 |
| 1247 shutil.rmtree(apidir, ignore_errors = True) | 1083 shutil.rmtree(apidir, ignore_errors = True) |
| 1248 | 1084 |
| 1249 CallBuildScript('release', 'ia32', 'api_docs') | 1085 CallBuildScript('release', 'ia32', 'api_docs') |
| 1250 | 1086 |
| 1251 UploadApiDocs(apidir) | 1087 UploadApiDocs(apidir) |
| 1252 | 1088 |
| 1253 api_zip = join(buildLocation, 'dart-api-docs.zip') | 1089 api_zip = join(buildLocation, 'dart-api-docs.zip') |
| 1254 | 1090 |
| 1255 CreateZip(apidir, api_zip) | 1091 CreateZip(apidir, api_zip) |
| 1256 | 1092 |
| 1257 # upload to continuous/svn_rev and to continuous/latest | |
| 1258 UploadFile(api_zip, False) | |
| 1259 | |
| 1260 DartArchiveUploadAPIDocs(api_zip) | 1093 DartArchiveUploadAPIDocs(api_zip) |
| 1261 | 1094 |
| 1262 | 1095 |
| 1263 def CreateSDK(sdkpath): | 1096 def CreateSDK(sdkpath): |
| 1264 """Create the dart-sdk's for the current OS""" | 1097 """Create the dart-sdk's for the current OS""" |
| 1265 | 1098 |
| 1266 if BUILD_OS == 'linux': | 1099 if BUILD_OS == 'linux': |
| 1267 return CreateLinuxSDK(sdkpath) | 1100 return CreateLinuxSDK(sdkpath) |
| 1268 if BUILD_OS == 'macos': | 1101 if BUILD_OS == 'macos': |
| 1269 return CreateMacosSDK(sdkpath) | 1102 return CreateMacosSDK(sdkpath) |
| 1270 if BUILD_OS == 'win32': | 1103 if BUILD_OS == 'win32': |
| 1271 return CreateWin32SDK(sdkpath) | 1104 return CreateWin32SDK(sdkpath) |
| 1272 | 1105 |
| 1273 def CreateLinuxSDK(sdkpath): | 1106 def CreateLinuxSDK(sdkpath): |
| 1274 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), | 1107 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), |
| 1275 'dart-sdk') | 1108 'dart-sdk') |
| 1276 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), | 1109 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), |
| 1277 'dart-sdk') | 1110 'dart-sdk') |
| 1278 | 1111 |
| 1279 # Build the SDK | 1112 # Build the SDK |
| 1280 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1113 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
| 1281 | 1114 |
| 1282 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') | 1115 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') |
| 1283 sdk32_tgz = join(sdkpath, 'dartsdk-linux-32.tar.gz') | |
| 1284 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') | 1116 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') |
| 1285 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz') | |
| 1286 | 1117 |
| 1287 CreateZip(sdkdir32, sdk32_zip) | 1118 CreateZip(sdkdir32, sdk32_zip) |
| 1288 CreateTgz(sdkdir32, sdk32_tgz) | |
| 1289 CreateZip(sdkdir64, sdk64_zip) | 1119 CreateZip(sdkdir64, sdk64_zip) |
| 1290 CreateTgz(sdkdir64, sdk64_tgz) | |
| 1291 | |
| 1292 UploadFile(sdk32_zip) | |
| 1293 UploadFile(sdk32_tgz) | |
| 1294 UploadFile(sdk64_zip) | |
| 1295 UploadFile(sdk64_tgz) | |
| 1296 | 1120 |
| 1297 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip) | 1121 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip) |
| 1298 | 1122 |
| 1299 return sdk32_zip | 1123 return sdk32_zip |
| 1300 | 1124 |
| 1301 | 1125 |
| 1302 def CreateMacosSDK(sdkpath): | 1126 def CreateMacosSDK(sdkpath): |
| 1303 # Build the SDK | 1127 # Build the SDK |
| 1304 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1128 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
| 1305 | 1129 |
| 1306 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') | 1130 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') |
| 1307 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') | 1131 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') |
| 1308 sdk32_tgz = join(sdkpath, 'dartsdk-macos-32.tar.gz') | |
| 1309 sdk64_tgz = join(sdkpath, 'dartsdk-macos-64.tar.gz') | |
| 1310 | 1132 |
| 1311 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), | 1133 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), |
| 1312 'dart-sdk'), sdk32_zip) | 1134 'dart-sdk'), sdk32_zip) |
| 1313 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), | 1135 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), |
| 1314 'dart-sdk'), sdk64_zip) | 1136 'dart-sdk'), sdk64_zip) |
| 1315 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), | |
| 1316 'dart-sdk'), sdk32_tgz) | |
| 1317 CreateTgz(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), | |
| 1318 'dart-sdk'), sdk64_tgz) | |
| 1319 | |
| 1320 UploadFile(sdk32_zip) | |
| 1321 UploadFile(sdk64_zip) | |
| 1322 UploadFile(sdk32_tgz) | |
| 1323 UploadFile(sdk64_tgz) | |
| 1324 | 1137 |
| 1325 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip) | 1138 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip) |
| 1326 | 1139 |
| 1327 return sdk32_zip | 1140 return sdk32_zip |
| 1328 | 1141 |
| 1329 | 1142 |
| 1330 def CreateWin32SDK(sdkpath): | 1143 def CreateWin32SDK(sdkpath): |
| 1331 # Build the SDK | 1144 # Build the SDK |
| 1332 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1145 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
| 1333 | 1146 |
| 1334 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') | 1147 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') |
| 1335 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') | 1148 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') |
| 1336 | 1149 |
| 1337 CreateZipWindows(join(DART_PATH, | 1150 CreateZipWindows(join(DART_PATH, |
| 1338 utils.GetBuildRoot('win32', 'release', 'ia32'), | 1151 utils.GetBuildRoot('win32', 'release', 'ia32'), |
| 1339 'dart-sdk'), sdk32_zip) | 1152 'dart-sdk'), sdk32_zip) |
| 1340 CreateZipWindows(join(DART_PATH, | 1153 CreateZipWindows(join(DART_PATH, |
| 1341 utils.GetBuildRoot('win32', 'release', 'x64'), | 1154 utils.GetBuildRoot('win32', 'release', 'x64'), |
| 1342 'dart-sdk'), sdk64_zip) | 1155 'dart-sdk'), sdk64_zip) |
| 1343 | 1156 |
| 1344 UploadFile(sdk32_zip) | |
| 1345 UploadFile(sdk64_zip) | |
| 1346 | |
| 1347 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip) | 1157 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip) |
| 1348 | 1158 |
| 1349 return sdk32_zip | 1159 return sdk32_zip |
| 1350 | 1160 |
| 1351 | 1161 |
| 1352 def CallBuildScript(mode, arch, target): | 1162 def CallBuildScript(mode, arch, target): |
| 1353 """invoke tools/build.py""" | 1163 """invoke tools/build.py""" |
| 1354 buildScript = join(TOOLS_PATH, 'build.py') | 1164 buildScript = join(TOOLS_PATH, 'build.py') |
| 1355 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, | 1165 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, |
| 1356 target] | 1166 target] |
| 1357 try: | 1167 try: |
| 1358 ExecuteCommand(cmd, DART_PATH) | 1168 ExecuteCommand(cmd, DART_PATH) |
| 1359 except: | 1169 except Exception as error: |
| 1360 print '%s build failed: %s' % (target, status) | 1170 print '%s build failed: %s' % (target, error) |
| 1361 BuildStepFailure() | 1171 BuildStepFailure() |
| 1362 raise Exception('%s build failed' % target) | 1172 raise Exception('%s build failed' % target) |
| 1363 | 1173 |
| 1364 | 1174 |
| 1365 def CreateZip(directory, targetFile): | 1175 def CreateZip(directory, targetFile): |
| 1366 """zip the given directory into the file""" | 1176 """zip the given directory into the file""" |
| 1367 EnsureDirectoryExists(targetFile) | 1177 EnsureDirectoryExists(targetFile) |
| 1368 FileDelete(targetFile) | 1178 FileDelete(targetFile) |
| 1369 ExecuteCommand(['zip', '-yrq9', targetFile, os.path.basename(directory)], | 1179 ExecuteCommand(['zip', '-yrq9', targetFile, os.path.basename(directory)], |
| 1370 os.path.dirname(directory)) | 1180 os.path.dirname(directory)) |
| 1371 | 1181 |
| 1372 | 1182 |
| 1373 def CreateZipWindows(directory, targetFile): | 1183 def CreateZipWindows(directory, targetFile): |
| 1374 """zip the given directory into the file - win32 specific""" | 1184 """zip the given directory into the file - win32 specific""" |
| 1375 EnsureDirectoryExists(targetFile) | 1185 EnsureDirectoryExists(targetFile) |
| 1376 FileDelete(targetFile) | 1186 FileDelete(targetFile) |
| 1377 ExecuteCommand([join(DART_PATH, 'third_party', '7zip', '7za'), 'a', '-tzip', | 1187 ExecuteCommand([join(DART_PATH, 'third_party', '7zip', '7za'), 'a', '-tzip', |
| 1378 targetFile, | 1188 targetFile, |
| 1379 os.path.basename(directory)], | 1189 os.path.basename(directory)], |
| 1380 os.path.dirname(directory)) | 1190 os.path.dirname(directory)) |
| 1381 | 1191 |
| 1382 | 1192 |
| 1383 def CreateTgz(directory, targetFile): | |
| 1384 """tar gzip the given directory into the file""" | |
| 1385 EnsureDirectoryExists(targetFile) | |
| 1386 FileDelete(targetFile) | |
| 1387 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)], | |
| 1388 os.path.dirname(directory)) | |
| 1389 | |
| 1390 | |
| 1391 def UploadFile(targetFile, createChecksum=True): | |
| 1392 """Upload the given file to google storage.""" | |
| 1393 | |
| 1394 if (NO_UPLOAD): | |
| 1395 return | |
| 1396 | |
| 1397 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile)) | |
| 1398 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile)) | |
| 1399 | |
| 1400 if createChecksum: | |
| 1401 checksum = bot_utils.CreateChecksumFile(targetFile) | |
| 1402 | |
| 1403 checksumRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(checksum)) | |
| 1404 checksumLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(checksum)) | |
| 1405 | |
| 1406 Gsutil(['cp', '-a', 'public-read', r'file://' + targetFile, filePathRev]) | |
| 1407 | |
| 1408 if (createChecksum): | |
| 1409 Gsutil(['cp', '-a', 'public-read', r'file://' + checksum, checksumRev]) | |
| 1410 | |
| 1411 Gsutil(['cp', '-a', 'public-read', filePathRev, filePathLatest]) | |
| 1412 if (createChecksum): | |
| 1413 Gsutil(['cp', '-a', 'public-read', checksumRev, checksumLatest]) | |
| 1414 | |
| 1415 | |
| 1416 def UploadDirectory(filesToUpload, gs_dir): | 1193 def UploadDirectory(filesToUpload, gs_dir): |
| 1417 Gsutil(['-m', 'cp', '-a', 'public-read', '-r'] + filesToUpload + [gs_dir]) | 1194 Gsutil(['-m', 'cp', '-a', 'public-read', '-r'] + filesToUpload + [gs_dir]) |
| 1418 | 1195 |
| 1419 | 1196 |
| 1420 def UploadApiDocs(dirName): | 1197 def UploadApiDocs(dirName): |
| 1421 # create file in dartlang-api-docs/REVISION/index.html | 1198 # create file in dartlang-api-docs/REVISION/index.html |
| 1422 # this lets us do the recursive copy in the next step | 1199 # this lets us do the recursive copy in the next step |
| 1423 | 1200 |
| 1424 localIndexFile = join(dirName, 'index.html') | 1201 localIndexFile = join(dirName, 'index.html') |
| 1425 destIndexFile = GSU_API_DOCS_PATH + '/index.html' | 1202 destIndexFile = GSU_API_DOCS_PATH + '/index.html' |
| 1426 | 1203 |
| 1427 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile]) | 1204 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile]) |
| 1428 | 1205 |
| 1429 # copy -R api_docs into dartlang-api-docs/REVISION | 1206 # copy -R api_docs into dartlang-api-docs/REVISION |
| 1430 filesToUpload = glob.glob(join(dirName, '*')) | 1207 filesToUpload = glob.glob(join(dirName, '*')) |
| 1431 result = Gsutil(['-m', 'cp', '-q', '-a', 'public-read', '-r'] + | 1208 Gsutil(['-m', 'cp', '-q', '-a', 'public-read', '-r'] + |
| 1432 filesToUpload + [GSU_API_DOCS_PATH]) | 1209 filesToUpload + [GSU_API_DOCS_PATH]) |
| 1433 | 1210 |
| 1434 if result == 0: | 1211 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt' |
| 1435 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt' | 1212 localLatestRevFilename = join(dirName, 'latest.txt') |
| 1436 localLatestRevFilename = join(dirName, 'latest.txt') | 1213 with open(localLatestRevFilename, 'w+') as f: |
| 1437 with open(localLatestRevFilename, 'w+') as f: | 1214 f.write(REVISION) |
| 1438 f.write(REVISION) | |
| 1439 | 1215 |
| 1440 # overwrite dartlang-api-docs/latest.txt to contain REVISION | 1216 # overwrite dartlang-api-docs/latest.txt to contain REVISION |
| 1441 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename, | 1217 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename, |
| 1442 destLatestRevFile]) | 1218 destLatestRevFile]) |
| 1443 | 1219 |
| 1444 | 1220 |
| 1445 def Gsutil(cmd): | 1221 def Gsutil(cmd): |
| 1446 gsutilTool = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 1222 gsutilTool = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
| 1447 ExecuteCommand([sys.executable, gsutilTool] + cmd) | 1223 ExecuteCommand([sys.executable, gsutilTool] + cmd) |
| 1448 | 1224 |
| 1449 | 1225 |
| 1450 def EnsureDirectoryExists(f): | 1226 def EnsureDirectoryExists(f): |
| 1451 d = os.path.dirname(f) | 1227 d = os.path.dirname(f) |
| 1452 if not os.path.exists(d): | 1228 if not os.path.exists(d): |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1467 """delete the given file - do not re-throw any exceptions that occur""" | 1243 """delete the given file - do not re-throw any exceptions that occur""" |
| 1468 if os.path.exists(f): | 1244 if os.path.exists(f): |
| 1469 try: | 1245 try: |
| 1470 os.remove(f) | 1246 os.remove(f) |
| 1471 except OSError: | 1247 except OSError: |
| 1472 print 'error deleting %s' % f | 1248 print 'error deleting %s' % f |
| 1473 | 1249 |
| 1474 | 1250 |
| 1475 if __name__ == '__main__': | 1251 if __name__ == '__main__': |
| 1476 sys.exit(main()) | 1252 sys.exit(main()) |
| OLD | NEW |