| 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 | |
| 30 GSU_API_DOCS_BUCKET = 'gs://dartlang-api-docs' | |
| 31 | |
| 32 CHANNEL = None | 27 CHANNEL = None |
| 33 PLUGINS_BUILD = None | 28 PLUGINS_BUILD = None |
| 34 REVISION = None | 29 REVISION = None |
| 35 SYSTEM = None | 30 SYSTEM = None |
| 36 TRUNK_BUILD = None | |
| 37 | 31 |
| 38 NO_UPLOAD = None | 32 NO_UPLOAD = None |
| 39 | 33 |
| 40 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) | 34 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) |
| 41 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) | 35 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) |
| 42 bot_utils = imp.load_source('bot_utils', | 36 bot_utils = imp.load_source('bot_utils', |
| 43 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) | 37 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) |
| 44 | 38 |
| 45 def DartArchiveFile(local_path, remote_path, create_md5sum=False): | 39 def DartArchiveFile(local_path, remote_path, create_md5sum=False): |
| 46 # Copy it to the new unified gs://dart-archive bucket | 40 # 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() | 41 gsutil = bot_utils.GSUtil() |
| 50 gsutil.upload(local_path, remote_path, public=True) | 42 gsutil.upload(local_path, remote_path, public=True) |
| 51 if create_md5sum: | 43 if create_md5sum: |
| 52 # 'local_path' may have a different filename than 'remote_path'. So we need | 44 # 'local_path' may have a different filename than 'remote_path'. So we need |
| 53 # to make sure the *.md5sum file contains the correct name. | 45 # to make sure the *.md5sum file contains the correct name. |
| 54 assert '/' in remote_path and not remote_path.endswith('/') | 46 assert '/' in remote_path and not remote_path.endswith('/') |
| 55 mangled_filename = remote_path[remote_path.rfind('/') + 1:] | 47 mangled_filename = remote_path[remote_path.rfind('/') + 1:] |
| 56 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) | 48 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) |
| 57 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) | 49 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) |
| 58 | 50 |
| 59 def DartArchiveUploadEditorZipFile(zipfile): | 51 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) | 52 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 64 gsutil = bot_utils.GSUtil() | 53 gsutil = bot_utils.GSUtil() |
| 65 | 54 |
| 66 basename = os.path.basename(zipfile) | 55 basename = os.path.basename(zipfile) |
| 67 system = None | 56 system = None |
| 68 arch = None | 57 arch = None |
| 69 if basename.startswith('darteditor-linux'): | 58 if basename.startswith('darteditor-linux'): |
| 70 system = 'linux' | 59 system = 'linux' |
| 71 elif basename.startswith('darteditor-mac'): | 60 elif basename.startswith('darteditor-mac'): |
| 72 system = 'macos' | 61 system = 'macos' |
| 73 elif basename.startswith('darteditor-win'): | 62 elif basename.startswith('darteditor-win'): |
| 74 system = 'windows' | 63 system = 'windows' |
| 75 | 64 |
| 76 if basename.endswith('-32.zip'): | 65 if basename.endswith('-32.zip'): |
| 77 arch = 'ia32' | 66 arch = 'ia32' |
| 78 elif basename.endswith('-64.zip'): | 67 elif basename.endswith('-64.zip'): |
| 79 arch = 'x64' | 68 arch = 'x64' |
| 80 | 69 |
| 81 assert system and arch | 70 assert system and arch |
| 82 | 71 |
| 83 for revision in [REVISION, 'latest']: | 72 for revision in [REVISION, 'latest']: |
| 84 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), | 73 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), |
| 85 create_md5sum=True) | 74 create_md5sum=True) |
| 86 | 75 |
| 87 def DartArchiveUploadUpdateSite(local_path): | 76 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) | 77 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 92 gsutil = bot_utils.GSUtil() | 78 gsutil = bot_utils.GSUtil() |
| 93 for revision in [REVISION, 'latest']: | 79 for revision in [REVISION, 'latest']: |
| 94 update_site_dir = namer.editor_eclipse_update_directory(revision) | 80 update_site_dir = namer.editor_eclipse_update_directory(revision) |
| 95 try: | 81 try: |
| 96 gsutil.remove(update_site_dir, recursive=True) | 82 gsutil.remove(update_site_dir, recursive=True) |
| 97 except: | 83 except: |
| 98 # Ignore this, in the general case there is nothing. | 84 # Ignore this, in the general case there is nothing. |
| 99 pass | 85 pass |
| 100 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) | 86 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) |
| 101 | 87 |
| 102 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip): | 88 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) | 89 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 107 for revision in [REVISION, 'latest']: | 90 for revision in [REVISION, 'latest']: |
| 108 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') | 91 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') |
| 109 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') | 92 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') |
| 110 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) | 93 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) |
| 111 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) | 94 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) |
| 112 | 95 |
| 113 def DartArchiveUploadAPIDocs(api_zip): | 96 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) | 97 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 118 for revision in [REVISION, 'latest']: | 98 for revision in [REVISION, 'latest']: |
| 119 destination = (namer.apidocs_directory(revision) + '/' + | 99 destination = (namer.apidocs_directory(revision) + '/' + |
| 120 namer.apidocs_zipfilename()) | 100 namer.apidocs_zipfilename()) |
| 121 DartArchiveFile(api_zip, destination, create_md5sum=False) | 101 DartArchiveFile(api_zip, destination, create_md5sum=False) |
| 122 | 102 |
| 123 def DartArchiveUploadVersionFile(version_file): | 103 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) | 104 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) |
| 128 for revision in [REVISION, 'latest']: | 105 for revision in [REVISION, 'latest']: |
| 129 DartArchiveFile(version_file, namer.version_filepath(revision), | 106 DartArchiveFile(version_file, namer.version_filepath(revision), |
| 130 create_md5sum=False) | 107 create_md5sum=False) |
| 131 | 108 |
| 132 def DartArchiveUploadInstaller( | 109 def DartArchiveUploadInstaller( |
| 133 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): | 110 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): |
| 134 namer = bot_utils.GCSNamer(CHANNEL, release_type) | 111 namer = bot_utils.GCSNamer(CHANNEL, release_type) |
| 135 gsu_path = namer.editor_installer_filepath( | 112 gsu_path = namer.editor_installer_filepath( |
| 136 REVISION, SYSTEM, arch, extension) | 113 REVISION, SYSTEM, arch, extension) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 219 |
| 243 print ' '.join(args) | 220 print ' '.join(args) |
| 244 status = subprocess.call(args, shell=is_windows) | 221 status = subprocess.call(args, shell=is_windows) |
| 245 os.chdir(cwd) | 222 os.chdir(cwd) |
| 246 return status | 223 return status |
| 247 | 224 |
| 248 | 225 |
| 249 def BuildOptions(): | 226 def BuildOptions(): |
| 250 """Setup the argument processing for this program.""" | 227 """Setup the argument processing for this program.""" |
| 251 result = optparse.OptionParser() | 228 result = optparse.OptionParser() |
| 252 result.set_default('dest', 'gs://dart-editor-archive-continuous') | |
| 253 result.add_option('-m', '--mode', | 229 result.add_option('-m', '--mode', |
| 254 help='Build variants (comma-separated).', | 230 help='Build variants (comma-separated).', |
| 255 metavar='[all,debug,release]', | 231 metavar='[all,debug,release]', |
| 256 default='debug') | 232 default='debug') |
| 257 result.add_option('-v', '--verbose', | 233 result.add_option('-v', '--verbose', |
| 258 help='Verbose output.', | 234 help='Verbose output.', |
| 259 default=False, action='store') | 235 default=False, action='store') |
| 260 result.add_option('-r', '--revision', | 236 result.add_option('-r', '--revision', |
| 261 help='SVN Revision.', | 237 help='SVN Revision.', |
| 262 action='store') | 238 action='store') |
| 263 result.add_option('-n', '--name', | 239 result.add_option('-n', '--name', |
| 264 help='builder name.', | 240 help='builder name.', |
| 265 action='store') | 241 action='store') |
| 266 result.add_option('-o', '--out', | 242 result.add_option('-o', '--out', |
| 267 help='Output Directory.', | 243 help='Output Directory.', |
| 268 action='store') | 244 action='store') |
| 269 result.add_option('--dest', | 245 result.add_option('--dest', |
| 270 help='Output Directory.', | 246 help='Output Directory.', |
| 271 action='store') | 247 action='store') |
| 272 result.add_option('--build-installer', | 248 result.add_option('--build-installer', |
| 273 help='Fetch editor, build installer and archive it.', | 249 help='Fetch editor, build installer and archive it.', |
| 274 action='store_true', default=False) | 250 action='store_true', default=False) |
| 275 return result | 251 return result |
| 276 | 252 |
| 277 def main(): | 253 def main(): |
| 278 """Main entry point for the build program.""" | 254 """Main entry point for the build program.""" |
| 279 global BUILD_OS | 255 global BUILD_OS |
| 280 global CHANNEL | 256 global CHANNEL |
| 281 global DART_PATH | 257 global DART_PATH |
| 282 global GSU_API_DOCS_PATH | |
| 283 global GSU_PATH_LATEST | |
| 284 global GSU_PATH_REV | |
| 285 global NO_UPLOAD | 258 global NO_UPLOAD |
| 286 global PLUGINS_BUILD | 259 global PLUGINS_BUILD |
| 287 global REVISION | 260 global REVISION |
| 288 global SYSTEM | 261 global SYSTEM |
| 289 global TOOLS_PATH | 262 global TOOLS_PATH |
| 290 global TRUNK_BUILD | |
| 291 | 263 |
| 292 if not sys.argv: | 264 if not sys.argv: |
| 293 print 'Script pathname not known, giving up.' | 265 print 'Script pathname not known, giving up.' |
| 294 return 1 | 266 return 1 |
| 295 | 267 |
| 296 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) | 268 scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) |
| 297 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) | 269 editorpath = os.path.abspath(os.path.join(scriptdir, '..')) |
| 298 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 270 thirdpartypath = os.path.abspath(os.path.join(scriptdir, '..', '..', |
| 299 'third_party')) | 271 'third_party')) |
| 300 toolspath = os.path.abspath(os.path.join(scriptdir, '..', '..', | 272 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] | 335 lastc = revision[-1] |
| 364 if lastc.isalpha(): | 336 if lastc.isalpha(): |
| 365 revision = revision[0:-1] | 337 revision = revision[0:-1] |
| 366 index = revision.find(':') | 338 index = revision.find(':') |
| 367 if index > -1: | 339 if index > -1: |
| 368 revision = revision[0:index] | 340 revision = revision[0:index] |
| 369 print 'revision = |{0}|'.format(revision) | 341 print 'revision = |{0}|'.format(revision) |
| 370 buildout = os.path.abspath(options.out) | 342 buildout = os.path.abspath(options.out) |
| 371 print 'buildout = {0}'.format(buildout) | 343 print 'buildout = {0}'.format(buildout) |
| 372 | 344 |
| 373 # Get user name. If it does not start with chrome then deploy to the test | 345 username = utils.GetUserName() |
| 374 # bucket; otherwise deploy to the continuous bucket. | 346 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' | 347 print 'Could not find username' |
| 381 return 6 | 348 return 6 |
| 382 | 349 |
| 383 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') | 350 build_skip_tests = os.environ.get('DART_SKIP_RUNNING_TESTS') |
| 384 sdk_environment = os.environ | 351 sdk_environment = os.environ |
| 385 if sdk_environment.has_key('JAVA_HOME'): | 352 if sdk_environment.has_key('JAVA_HOME'): |
| 386 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) | 353 print 'JAVA_HOME = {0}'.format(str(sdk_environment['JAVA_HOME'])) |
| 387 | 354 |
| 388 # dart-editor[-trunk], dart-editor-(win/mac/linux)[-trunk/be/dev/stable] | |
| 389 builder_name = str(options.name) | |
| 390 | |
| 391 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?' | 355 EDITOR_REGEXP = (r'^dart-editor(-(?P<installer>(installer)))?' |
| 392 '(-(?P<system>(win|mac|linux)))?' + | 356 '(-(?P<system>(win|mac|linux)))?' + |
| 393 '(-(?P<channel>(trunk|be|dev|stable)))?$') | 357 '(-(?P<channel>(be|dev|stable)))?$') |
| 358 builder_name = str(options.name) |
| 394 match = re.match(EDITOR_REGEXP, builder_name) | 359 match = re.match(EDITOR_REGEXP, builder_name) |
| 395 if not match: | 360 if not match: |
| 396 raise Exception("Buildername '%s' does not match pattern '%s'." | 361 raise Exception("Buildername '%s' does not match pattern '%s'." |
| 397 % (builder_name, EDITOR_REGEXP)) | 362 % (builder_name, EDITOR_REGEXP)) |
| 398 | 363 |
| 399 CHANNEL = match.groupdict()['channel'] or 'be' | 364 CHANNEL = match.groupdict()['channel'] or 'be' |
| 400 SYSTEM = match.groupdict()['system'] | 365 SYSTEM = match.groupdict()['system'] |
| 401 BUILD_INSTALLER = bool(match.groupdict()['installer']) | 366 BUILD_INSTALLER = bool(match.groupdict()['installer']) |
| 402 | 367 |
| 403 TRUNK_BUILD = CHANNEL == 'trunk' | |
| 404 PLUGINS_BUILD = SYSTEM is None | 368 PLUGINS_BUILD = SYSTEM is None |
| 405 REVISION = revision | 369 REVISION = revision |
| 406 | 370 |
| 407 # Make sure the buildername and the options agree | 371 # Make sure the buildername and the options agree |
| 408 assert BUILD_INSTALLER == options.build_installer | 372 assert BUILD_INSTALLER == options.build_installer |
| 409 | 373 |
| 410 if username.startswith('chrome'): | 374 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 | |
| 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) | |
| 424 | 375 |
| 425 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 376 homegsutil = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
| 426 gsu = gsutil.GsUtil(False, homegsutil, | 377 gsu = gsutil.GsUtil(False, homegsutil, |
| 427 running_on_buildbot=running_on_buildbot) | 378 running_on_buildbot=running_on_buildbot) |
| 428 | 379 |
| 429 def build_installer(): | 380 def build_installer(): |
| 430 release_type = bot_utils.ReleaseType.SIGNED | 381 release_type = bot_utils.ReleaseType.SIGNED |
| 431 if CHANNEL == 'be': | 382 if CHANNEL == 'be': |
| 432 # We don't have signed bits on bleeding_edge, so we take the unsigned | 383 # We don't have signed bits on bleeding_edge, so we take the unsigned |
| 433 # editor. | 384 # editor. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 _InstallArtifacts(buildout, buildos, extra_artifacts) | 543 _InstallArtifacts(buildout, buildos, extra_artifacts) |
| 593 | 544 |
| 594 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip | 545 # dart-editor-linux.gtk.x86.zip --> darteditor-linux-32.zip |
| 595 RenameRcpZipFiles(buildout) | 546 RenameRcpZipFiles(buildout) |
| 596 | 547 |
| 597 PostProcessEditorBuilds(buildout, buildos) | 548 PostProcessEditorBuilds(buildout, buildos) |
| 598 | 549 |
| 599 if running_on_buildbot: | 550 if running_on_buildbot: |
| 600 version_file = _FindVersionFile(buildout) | 551 version_file = _FindVersionFile(buildout) |
| 601 if version_file: | 552 if version_file: |
| 602 UploadFile(version_file, False) | |
| 603 DartArchiveUploadVersionFile(version_file) | 553 DartArchiveUploadVersionFile(version_file) |
| 604 | 554 |
| 605 found_zips = _FindRcpZipFiles(buildout) | 555 found_zips = _FindRcpZipFiles(buildout) |
| 606 for zipfile in found_zips: | 556 for zipfile in found_zips: |
| 607 UploadFile(zipfile) | |
| 608 DartArchiveUploadEditorZipFile(zipfile) | 557 DartArchiveUploadEditorZipFile(zipfile) |
| 609 | 558 |
| 610 return 0 | 559 return 0 |
| 611 | 560 |
| 612 if BUILD_INSTALLER: | 561 if BUILD_INSTALLER: |
| 613 build_installer() | 562 build_installer() |
| 614 else: | 563 else: |
| 615 build_editor(sdk_zip) | 564 build_editor(sdk_zip) |
| 616 finally: | 565 finally: |
| 617 if ant_property_file is not None: | 566 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. | 762 # black/white-listing mechanism. |
| 814 FileDelete(join(add_path, 'mini_installer.exe')) | 763 FileDelete(join(add_path, 'mini_installer.exe')) |
| 815 FileDelete(join(add_path, 'sync_unit_tests.exe')) | 764 FileDelete(join(add_path, 'sync_unit_tests.exe')) |
| 816 FileDelete(join(add_path, 'chrome.packed.7z')) | 765 FileDelete(join(add_path, 'chrome.packed.7z')) |
| 817 | 766 |
| 818 # Add dartium to the rcp zip | 767 # Add dartium to the rcp zip |
| 819 dart_zip.AddDirectoryTree(add_path, 'dart/chromium') | 768 dart_zip.AddDirectoryTree(add_path, 'dart/chromium') |
| 820 shutil.rmtree(tmp_dir, True) | 769 shutil.rmtree(tmp_dir, True) |
| 821 | 770 |
| 822 | 771 |
| 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): | 772 def InstallDartium(buildroot, buildout, buildos, gsu): |
| 922 if TRUNK_BUILD: | 773 # 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 | 774 # gs://dart-archive/ location. |
| 924 # dartium-*-trunk builders archive to) | 775 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 | 776 |
| 931 | 777 |
| 932 def _InstallArtifacts(buildout, buildos, extra_artifacts): | 778 def _InstallArtifacts(buildout, buildos, extra_artifacts): |
| 933 """Install extra build artifacts into the RCP zip files. | 779 """Install extra build artifacts into the RCP zip files. |
| 934 | 780 |
| 935 Args: | 781 Args: |
| 936 buildout: the location of the ant build output | 782 buildout: the location of the ant build output |
| 937 buildos: the OS the build is running under | 783 buildos: the OS the build is running under |
| 938 extra_artifacts: the directory containing the extra artifacts | 784 extra_artifacts: the directory containing the extra artifacts |
| 939 """ | 785 """ |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 readme_file = join('dart', 'README') | 905 readme_file = join('dart', 'README') |
| 1060 if (basename.startswith('darteditor-win32-')): | 906 if (basename.startswith('darteditor-win32-')): |
| 1061 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe') | 907 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) | 908 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ) |
| 1063 else: | 909 else: |
| 1064 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ) | 910 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ) |
| 1065 | 911 |
| 1066 # If we're on -dev/-stable build: add an editor.properties file | 912 # 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 | 913 # pointing to the correct update location of the editor for the channel |
| 1068 # we're building for. | 914 # we're building for. |
| 1069 if not TRUNK_BUILD and CHANNEL != 'be': | 915 if CHANNEL != 'be': |
| 1070 f = ziputils.ZipUtil(zipFile, buildos) | 916 f = ziputils.ZipUtil(zipFile, buildos) |
| 1071 f.AddFile(editor_properties, 'dart/editor.properties') | 917 f.AddFile(editor_properties, 'dart/editor.properties') |
| 1072 | 918 |
| 1073 # Add a shell/bat script to download contentshell and dartium debug. | 919 # Add a shell/bat script to download contentshell and dartium debug. |
| 1074 # (including the necessary tools/dartium/download_file.dart helper). | 920 # (including the necessary tools/dartium/download_file.dart helper). |
| 1075 add_download_scripts(zipFile, '64' if is_64bit else '32') | 921 add_download_scripts(zipFile, '64' if is_64bit else '32') |
| 1076 | 922 |
| 1077 # adjust memory params for 64 bit versions | 923 # adjust memory params for 64 bit versions |
| 1078 if is_64bit: | 924 if is_64bit: |
| 1079 if (basename.startswith('darteditor-macos-')): | 925 if (basename.startswith('darteditor-macos-')): |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 | 960 |
| 1115 def Modify64BitDartEditorIni(iniFilePath): | 961 def Modify64BitDartEditorIni(iniFilePath): |
| 1116 f = open(iniFilePath, 'r') | 962 f = open(iniFilePath, 'r') |
| 1117 lines = f.readlines() | 963 lines = f.readlines() |
| 1118 f.close() | 964 f.close() |
| 1119 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' | 965 lines[lines.index('-Xms40m\n')] = '-Xms256m\n' |
| 1120 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' | 966 lines[lines.index('-Xmx1000m\n')] = '-Xmx2000m\n' |
| 1121 # Add -d64 to give better error messages to user in 64 bit mode. | 967 # Add -d64 to give better error messages to user in 64 bit mode. |
| 1122 lines[lines.index('-vmargs\n')] = '-vmargs\n-d64\n' | 968 lines[lines.index('-vmargs\n')] = '-vmargs\n-d64\n' |
| 1123 f = open(iniFilePath, 'w') | 969 f = open(iniFilePath, 'w') |
| 1124 f.writelines(lines); | 970 f.writelines(lines) |
| 1125 f.close() | 971 f.close() |
| 1126 | 972 |
| 1127 | 973 |
| 1128 def RunEditorTests(buildout, buildos): | 974 def RunEditorTests(buildout, buildos): |
| 1129 StartBuildStep('run_tests') | 975 StartBuildStep('run_tests') |
| 1130 | 976 |
| 1131 for editorArchive in _GetTestableRcpArchives(buildout): | 977 for editorArchive in _GetTestableRcpArchives(buildout): |
| 1132 with utils.TempDir('editor_') as tempDir: | 978 with utils.TempDir('editor_') as tempDir: |
| 1133 print 'Running tests for %s...' % editorArchive | 979 print 'Running tests for %s...' % editorArchive |
| 1134 | 980 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 | 1054 |
| 1209 def BuildUpdateSite(ant, revision, name, buildroot, buildout, | 1055 def BuildUpdateSite(ant, revision, name, buildroot, buildout, |
| 1210 editorpath, buildos): | 1056 editorpath, buildos): |
| 1211 status = ant.RunAnt('../com.google.dart.eclipse.feature_releng', | 1057 status = ant.RunAnt('../com.google.dart.eclipse.feature_releng', |
| 1212 'build.xml', revision, name, buildroot, buildout, | 1058 'build.xml', revision, name, buildroot, buildout, |
| 1213 editorpath, buildos, ['-Dbuild.dir=%s' % buildout]) | 1059 editorpath, buildos, ['-Dbuild.dir=%s' % buildout]) |
| 1214 if status: | 1060 if status: |
| 1215 BuildStepFailure() | 1061 BuildStepFailure() |
| 1216 else: | 1062 else: |
| 1217 StartBuildStep('upload_artifacts') | 1063 StartBuildStep('upload_artifacts') |
| 1218 UploadSite(buildout, "%s/%s" % (GSU_PATH_REV, 'eclipse-update')) | 1064 DartArchiveUploadUpdateSite(join(buildout, 'buildRepo')) |
| 1219 UploadSite(buildout, "%s/%s" % (GSU_PATH_LATEST, 'eclipse-update')) | |
| 1220 return status | 1065 return status |
| 1221 | 1066 |
| 1222 | 1067 |
| 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): | 1068 def CreateApiDocs(buildLocation): |
| 1241 """Zip up api_docs, upload it, and upload the raw tree of docs""" | 1069 """Zip up api_docs, upload it, and upload the raw tree of docs""" |
| 1242 | 1070 |
| 1243 apidir = join(DART_PATH, | 1071 apidir = join(DART_PATH, |
| 1244 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), | 1072 utils.GetBuildRoot(BUILD_OS, 'release', 'ia32'), |
| 1245 'api_docs') | 1073 'api_docs') |
| 1246 | 1074 |
| 1247 shutil.rmtree(apidir, ignore_errors = True) | 1075 shutil.rmtree(apidir, ignore_errors = True) |
| 1248 | 1076 |
| 1249 CallBuildScript('release', 'ia32', 'api_docs') | 1077 CallBuildScript('release', 'ia32', 'api_docs') |
| 1250 | 1078 |
| 1251 UploadApiDocs(apidir) | 1079 UploadApiDocs(apidir) |
| 1252 | 1080 |
| 1253 api_zip = join(buildLocation, 'dart-api-docs.zip') | 1081 api_zip = join(buildLocation, 'dart-api-docs.zip') |
| 1254 | 1082 |
| 1255 CreateZip(apidir, api_zip) | 1083 CreateZip(apidir, api_zip) |
| 1256 | 1084 |
| 1257 # upload to continuous/svn_rev and to continuous/latest | |
| 1258 UploadFile(api_zip, False) | |
| 1259 | |
| 1260 DartArchiveUploadAPIDocs(api_zip) | 1085 DartArchiveUploadAPIDocs(api_zip) |
| 1261 | 1086 |
| 1262 | 1087 |
| 1263 def CreateSDK(sdkpath): | 1088 def CreateSDK(sdkpath): |
| 1264 """Create the dart-sdk's for the current OS""" | 1089 """Create the dart-sdk's for the current OS""" |
| 1265 | 1090 |
| 1266 if BUILD_OS == 'linux': | 1091 if BUILD_OS == 'linux': |
| 1267 return CreateLinuxSDK(sdkpath) | 1092 return CreateLinuxSDK(sdkpath) |
| 1268 if BUILD_OS == 'macos': | 1093 if BUILD_OS == 'macos': |
| 1269 return CreateMacosSDK(sdkpath) | 1094 return CreateMacosSDK(sdkpath) |
| 1270 if BUILD_OS == 'win32': | 1095 if BUILD_OS == 'win32': |
| 1271 return CreateWin32SDK(sdkpath) | 1096 return CreateWin32SDK(sdkpath) |
| 1272 | 1097 |
| 1273 def CreateLinuxSDK(sdkpath): | 1098 def CreateLinuxSDK(sdkpath): |
| 1274 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), | 1099 sdkdir32 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'ia32'), |
| 1275 'dart-sdk') | 1100 'dart-sdk') |
| 1276 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), | 1101 sdkdir64 = join(DART_PATH, utils.GetBuildRoot('linux', 'release', 'x64'), |
| 1277 'dart-sdk') | 1102 'dart-sdk') |
| 1278 | 1103 |
| 1279 # Build the SDK | 1104 # Build the SDK |
| 1280 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1105 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
| 1281 | 1106 |
| 1282 sdk32_zip = join(sdkpath, 'dartsdk-linux-32.zip') | 1107 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') | 1108 sdk64_zip = join(sdkpath, 'dartsdk-linux-64.zip') |
| 1285 sdk64_tgz = join(sdkpath, 'dartsdk-linux-64.tar.gz') | |
| 1286 | 1109 |
| 1287 CreateZip(sdkdir32, sdk32_zip) | 1110 CreateZip(sdkdir32, sdk32_zip) |
| 1288 CreateTgz(sdkdir32, sdk32_tgz) | |
| 1289 CreateZip(sdkdir64, sdk64_zip) | 1111 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 | 1112 |
| 1297 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip) | 1113 DartArchiveUploadSDKs('linux', sdk32_zip, sdk64_zip) |
| 1298 | 1114 |
| 1299 return sdk32_zip | 1115 return sdk32_zip |
| 1300 | 1116 |
| 1301 | 1117 |
| 1302 def CreateMacosSDK(sdkpath): | 1118 def CreateMacosSDK(sdkpath): |
| 1303 # Build the SDK | 1119 # Build the SDK |
| 1304 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1120 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
| 1305 | 1121 |
| 1306 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') | 1122 sdk32_zip = join(sdkpath, 'dartsdk-macos-32.zip') |
| 1307 sdk64_zip = join(sdkpath, 'dartsdk-macos-64.zip') | 1123 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 | 1124 |
| 1311 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), | 1125 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'ia32'), |
| 1312 'dart-sdk'), sdk32_zip) | 1126 'dart-sdk'), sdk32_zip) |
| 1313 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), | 1127 CreateZip(join(DART_PATH, utils.GetBuildRoot('macos', 'release', 'x64'), |
| 1314 'dart-sdk'), sdk64_zip) | 1128 '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 | 1129 |
| 1325 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip) | 1130 DartArchiveUploadSDKs('macos', sdk32_zip, sdk64_zip) |
| 1326 | 1131 |
| 1327 return sdk32_zip | 1132 return sdk32_zip |
| 1328 | 1133 |
| 1329 | 1134 |
| 1330 def CreateWin32SDK(sdkpath): | 1135 def CreateWin32SDK(sdkpath): |
| 1331 # Build the SDK | 1136 # Build the SDK |
| 1332 CallBuildScript('release', 'ia32,x64', 'create_sdk') | 1137 CallBuildScript('release', 'ia32,x64', 'create_sdk') |
| 1333 | 1138 |
| 1334 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') | 1139 sdk32_zip = join(sdkpath, 'dartsdk-win32-32.zip') |
| 1335 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') | 1140 sdk64_zip = join(sdkpath, 'dartsdk-win32-64.zip') |
| 1336 | 1141 |
| 1337 CreateZipWindows(join(DART_PATH, | 1142 CreateZipWindows(join(DART_PATH, |
| 1338 utils.GetBuildRoot('win32', 'release', 'ia32'), | 1143 utils.GetBuildRoot('win32', 'release', 'ia32'), |
| 1339 'dart-sdk'), sdk32_zip) | 1144 'dart-sdk'), sdk32_zip) |
| 1340 CreateZipWindows(join(DART_PATH, | 1145 CreateZipWindows(join(DART_PATH, |
| 1341 utils.GetBuildRoot('win32', 'release', 'x64'), | 1146 utils.GetBuildRoot('win32', 'release', 'x64'), |
| 1342 'dart-sdk'), sdk64_zip) | 1147 'dart-sdk'), sdk64_zip) |
| 1343 | 1148 |
| 1344 UploadFile(sdk32_zip) | |
| 1345 UploadFile(sdk64_zip) | |
| 1346 | |
| 1347 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip) | 1149 DartArchiveUploadSDKs('win32', sdk32_zip, sdk64_zip) |
| 1348 | 1150 |
| 1349 return sdk32_zip | 1151 return sdk32_zip |
| 1350 | 1152 |
| 1351 | 1153 |
| 1352 def CallBuildScript(mode, arch, target): | 1154 def CallBuildScript(mode, arch, target): |
| 1353 """invoke tools/build.py""" | 1155 """invoke tools/build.py""" |
| 1354 buildScript = join(TOOLS_PATH, 'build.py') | 1156 buildScript = join(TOOLS_PATH, 'build.py') |
| 1355 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, | 1157 cmd = [sys.executable, buildScript, '--mode=%s' % mode, '--arch=%s' % arch, |
| 1356 target] | 1158 target] |
| 1357 try: | 1159 try: |
| 1358 ExecuteCommand(cmd, DART_PATH) | 1160 ExecuteCommand(cmd, DART_PATH) |
| 1359 except: | 1161 except Exception as error: |
| 1360 print '%s build failed: %s' % (target, status) | 1162 print '%s build failed: %s' % (target, error) |
| 1361 BuildStepFailure() | 1163 BuildStepFailure() |
| 1362 raise Exception('%s build failed' % target) | 1164 raise Exception('%s build failed' % target) |
| 1363 | 1165 |
| 1364 | 1166 |
| 1365 def CreateZip(directory, targetFile): | 1167 def CreateZip(directory, targetFile): |
| 1366 """zip the given directory into the file""" | 1168 """zip the given directory into the file""" |
| 1367 EnsureDirectoryExists(targetFile) | 1169 EnsureDirectoryExists(targetFile) |
| 1368 FileDelete(targetFile) | 1170 FileDelete(targetFile) |
| 1369 ExecuteCommand(['zip', '-yrq9', targetFile, os.path.basename(directory)], | 1171 ExecuteCommand(['zip', '-yrq9', targetFile, os.path.basename(directory)], |
| 1370 os.path.dirname(directory)) | 1172 os.path.dirname(directory)) |
| 1371 | 1173 |
| 1372 | 1174 |
| 1373 def CreateZipWindows(directory, targetFile): | 1175 def CreateZipWindows(directory, targetFile): |
| 1374 """zip the given directory into the file - win32 specific""" | 1176 """zip the given directory into the file - win32 specific""" |
| 1375 EnsureDirectoryExists(targetFile) | 1177 EnsureDirectoryExists(targetFile) |
| 1376 FileDelete(targetFile) | 1178 FileDelete(targetFile) |
| 1377 ExecuteCommand([join(DART_PATH, 'third_party', '7zip', '7za'), 'a', '-tzip', | 1179 ExecuteCommand([join(DART_PATH, 'third_party', '7zip', '7za'), 'a', '-tzip', |
| 1378 targetFile, | 1180 targetFile, |
| 1379 os.path.basename(directory)], | 1181 os.path.basename(directory)], |
| 1380 os.path.dirname(directory)) | 1182 os.path.dirname(directory)) |
| 1381 | 1183 |
| 1382 | 1184 |
| 1383 def CreateTgz(directory, targetFile): | 1185 def UploadApiDocs(dirName): |
| 1384 """tar gzip the given directory into the file""" | 1186 apidocs_namer = bot_utils.GCSNamerApiDocs(CHANNEL) |
| 1385 EnsureDirectoryExists(targetFile) | 1187 apidocs_destination_gcsdir = apidocs_namer.docs_dirpath(REVISION) |
| 1386 FileDelete(targetFile) | 1188 apidocs_destination_latestfile = apidocs_namer.docs_latestpath(REVISION) |
| 1387 ExecuteCommand(['tar', 'czf', targetFile, os.path.basename(directory)], | |
| 1388 os.path.dirname(directory)) | |
| 1389 | 1189 |
| 1190 # Delete the old revision specific apidocs directory if present. |
| 1191 Gsutil(['-m', 'rm', '-R', '-f', apidocs_destination_gcsdir]) |
| 1390 | 1192 |
| 1391 def UploadFile(targetFile, createChecksum=True): | 1193 # Upload everything inside the built apidocs directory. |
| 1392 """Upload the given file to google storage.""" | 1194 Gsutil(['-m', 'cp', '-R', '-a', 'public-read', dirName, |
| 1195 apidocs_destination_gcsdir]) |
| 1393 | 1196 |
| 1394 if (NO_UPLOAD): | 1197 # Update latest.txt to contain the newest revision. |
| 1395 return | 1198 with utils.TempDir('latest_file') as temp_dir: |
| 1199 latest_file = join(temp_dir, 'latest.txt') |
| 1200 with open(latest_file, 'w') as f: |
| 1201 f.write('%s' % REVISION) |
| 1396 | 1202 |
| 1397 filePathRev = "%s/%s" % (GSU_PATH_REV, os.path.basename(targetFile)) | 1203 Gsutil(['cp', '-a', 'public-read', latest_file, |
| 1398 filePathLatest = "%s/%s" % (GSU_PATH_LATEST, os.path.basename(targetFile)) | 1204 apidocs_destination_latestfile]) |
| 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): | |
| 1417 Gsutil(['-m', 'cp', '-a', 'public-read', '-r'] + filesToUpload + [gs_dir]) | |
| 1418 | |
| 1419 | |
| 1420 def UploadApiDocs(dirName): | |
| 1421 # create file in dartlang-api-docs/REVISION/index.html | |
| 1422 # this lets us do the recursive copy in the next step | |
| 1423 | |
| 1424 localIndexFile = join(dirName, 'index.html') | |
| 1425 destIndexFile = GSU_API_DOCS_PATH + '/index.html' | |
| 1426 | |
| 1427 Gsutil(['cp', '-a', 'public-read', localIndexFile, destIndexFile]) | |
| 1428 | |
| 1429 # copy -R api_docs into dartlang-api-docs/REVISION | |
| 1430 filesToUpload = glob.glob(join(dirName, '*')) | |
| 1431 result = Gsutil(['-m', 'cp', '-q', '-a', 'public-read', '-r'] + | |
| 1432 filesToUpload + [GSU_API_DOCS_PATH]) | |
| 1433 | |
| 1434 if result == 0: | |
| 1435 destLatestRevFile = GSU_API_DOCS_BUCKET + '/latest.txt' | |
| 1436 localLatestRevFilename = join(dirName, 'latest.txt') | |
| 1437 with open(localLatestRevFilename, 'w+') as f: | |
| 1438 f.write(REVISION) | |
| 1439 | |
| 1440 # overwrite dartlang-api-docs/latest.txt to contain REVISION | |
| 1441 Gsutil(['cp', '-a', 'public-read', localLatestRevFilename, | |
| 1442 destLatestRevFile]) | |
| 1443 | 1205 |
| 1444 | 1206 |
| 1445 def Gsutil(cmd): | 1207 def Gsutil(cmd): |
| 1446 gsutilTool = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') | 1208 gsutilTool = join(DART_PATH, 'third_party', 'gsutil', 'gsutil') |
| 1447 ExecuteCommand([sys.executable, gsutilTool] + cmd) | 1209 ExecuteCommand([sys.executable, gsutilTool] + cmd) |
| 1448 | 1210 |
| 1449 | 1211 |
| 1450 def EnsureDirectoryExists(f): | 1212 def EnsureDirectoryExists(f): |
| 1451 d = os.path.dirname(f) | 1213 d = os.path.dirname(f) |
| 1452 if not os.path.exists(d): | 1214 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""" | 1229 """delete the given file - do not re-throw any exceptions that occur""" |
| 1468 if os.path.exists(f): | 1230 if os.path.exists(f): |
| 1469 try: | 1231 try: |
| 1470 os.remove(f) | 1232 os.remove(f) |
| 1471 except OSError: | 1233 except OSError: |
| 1472 print 'error deleting %s' % f | 1234 print 'error deleting %s' % f |
| 1473 | 1235 |
| 1474 | 1236 |
| 1475 if __name__ == '__main__': | 1237 if __name__ == '__main__': |
| 1476 sys.exit(main()) | 1238 sys.exit(main()) |
| OLD | NEW |