Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: editor/build/build.py

Issue 47553006: Add windows installer functionallity to editor build script. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/bots/bot_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 # Remove this once the channel transition is done. 124 # Remove this once the channel transition is done.
125 if CHANNEL == 'trunk': return 125 if CHANNEL == 'trunk': return
126 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 126 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
127 for revision in [REVISION, 'latest']: 127 for revision in [REVISION, 'latest']:
128 DartArchiveFile(version_file, namer.version_filepath(revision), 128 DartArchiveFile(version_file, namer.version_filepath(revision),
129 create_md5sum=False) 129 create_md5sum=False)
130 130
131 def DartArchiveUploadInstaller( 131 def DartArchiveUploadInstaller(
132 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): 132 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW):
133 namer = bot_utils.GCSNamer(CHANNEL, release_type) 133 namer = bot_utils.GCSNamer(CHANNEL, release_type)
134 gsu_path = namer.editor_installer_zipfilepath( 134 gsu_path = namer.editor_installer_filepath(
135 REVISION, SYSTEM, arch, extension) 135 REVISION, SYSTEM, arch, extension)
136 DartArchiveFile(installer_file, gsu_path, create_md5sum=False) 136 DartArchiveFile(installer_file, gsu_path, create_md5sum=False)
137 137
138 class AntWrapper(object): 138 class AntWrapper(object):
139 """A wrapper for ant build invocations""" 139 """A wrapper for ant build invocations"""
140 140
141 _antpath = None 141 _antpath = None
142 _bzippath = None 142 _bzippath = None
143 _propertyfile = None 143 _propertyfile = None
144 144
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 os_rename = {'win': 'win32', 'mac': 'macos', 'linux': 'linux'} 436 os_rename = {'win': 'win32', 'mac': 'macos', 'linux': 'linux'}
437 system = os_rename[SYSTEM] 437 system = os_rename[SYSTEM]
438 return ( 438 return (
439 ("%s/darteditor-%s-%s.zip" % (GSU_PATH_REV, system, arch)), 439 ("%s/darteditor-%s-%s.zip" % (GSU_PATH_REV, system, arch)),
440 ("%s/darteditor-installer-%s-%s.%s" 440 ("%s/darteditor-installer-%s-%s.%s"
441 % (GSU_PATH_REV, system, arch, extension))) 441 % (GSU_PATH_REV, system, arch, extension)))
442 442
443 def new_location_pair(arch, extension): 443 def new_location_pair(arch, extension):
444 namer = bot_utils.GCSNamer(CHANNEL, release_type) 444 namer = bot_utils.GCSNamer(CHANNEL, release_type)
445 editor_path = namer.editor_zipfilepath(REVISION, SYSTEM, arch) 445 editor_path = namer.editor_zipfilepath(REVISION, SYSTEM, arch)
446 installer_path = namer.editor_installer_zipfilepath( 446 installer_path = namer.editor_installer_filepath(
447 REVISION, SYSTEM, arch, extension) 447 REVISION, SYSTEM, arch, extension)
448 return (editor_path, installer_path) 448 return (editor_path, installer_path)
449 449
450 def create_mac_installer(arch): 450 def create_windows_installer(installer_file, input_dir):
451 with utils.TempDir('build_editor_installer') as temp_dir: 451 msi_builder = os.path.join(DART_PATH, 'tools',
452 with utils.ChangedWorkingDirectory(temp_dir): 452 'create_windows_installer.py')
453 if CHANNEL == 'dev': 453 wix_bin = os.path.join(DART_PATH, 'third_party',
454 # On the dev channel we currently use the bits from trunk. 454 'wix')
455 (gsu_editor_zip, gsu_editor_dmg) = old_location_pair(arch, 'dmg') 455 version = utils.GetShortVersion()
456 else: 456 bot_utils.run(['python', msi_builder,
457 (gsu_editor_zip, gsu_editor_dmg) = new_location_pair(arch, 'dmg') 457 '--msi_location=%s' % installer_file,
458 # Fetch the editor zip file from the old location. 458 '--input_directory=%s' % input_dir,
459 if gsu.Copy(gsu_editor_zip, 'editor.zip', False): 459 '--version=%s' % version,
460 raise Exception("gsutil command failed, aborting.") 460 '--wix_bin=%s' % wix_bin])
461 461
462 # Unzip the editor (which contains a directory named 'dart'). 462 def create_mac_installer(installer_file):
463 bot_utils.run(['unzip', 'editor.zip']) 463 dart_folder_icon = os.path.join(DART_PATH,
464 assert os.path.exists('dart') and os.path.isdir('dart') 464 'editor/tools/plugins/com.google.dart.tools.ui/' +
465 'icons/dart_about_140_160.png')
466 dmg_builder = os.path.join(DART_PATH, 'tools',
467 'mac_build_editor_dmg.sh')
468 bot_utils.run([dmg_builder, installer_file, 'dart',
469 dart_folder_icon, "Dart Installer"])
465 470
466 # Build the dmg installer
467 dmg_installer = os.path.join(temp_dir,'darteditor-installer.dmg')
468 dart_folder_icon = os.path.join(DART_PATH,
469 'editor/tools/plugins/com.google.dart.tools.ui/' +
470 'icons/dart_about_140_160.png')
471 dmg_builder = os.path.join(DART_PATH, 'tools',
472 'mac_build_editor_dmg.sh')
473 bot_utils.run([dmg_builder, dmg_installer, 'dart',
474 dart_folder_icon, "Dart Distribution"])
475 assert os.path.isfile(dmg_installer)
476 471
477 if CHANNEL == 'dev': 472 if SYSTEM == 'mac' or SYSTEM == 'win':
478 # Archive to old bucket 473 for arch in ['32', '64']:
479 # TODO(kustermann/ricow): Remove all the old archiving code, 474 extension = 'dmg' if SYSTEM == 'mac' else 'msi'
480 # once everything points to the new location. 475 with utils.TempDir('build_editor_installer') as temp_dir:
481 if gsu.Copy(dmg_installer, gsu_editor_dmg): 476 with utils.ChangedWorkingDirectory(temp_dir):
477 if CHANNEL == 'dev':
478 # On the dev channel we currently use the bits from trunk.
479 (gsu_editor_zip,
480 gsu_editor_installer) = old_location_pair(arch, extension)
481 else:
482 (gsu_editor_zip,
483 gsu_editor_installer) = new_location_pair(arch, extension)
484 # Fetch the editor zip file from the old location.
485 zip_location = os.path.join(temp_dir, 'editor.zip')
486 if gsu.Copy(gsu_editor_zip, zip_location, False):
482 raise Exception("gsutil command failed, aborting.") 487 raise Exception("gsutil command failed, aborting.")
488 # Unzip the editor (which contains a directory named 'dart').
489 editor_zip = ziputils.ZipUtil(zip_location, buildos)
490 editor_zip.UnZip(temp_dir)
491 unzip_dir = os.path.join(temp_dir, 'dart')
492
493 assert os.path.exists('dart') and os.path.isdir('dart')
494 installer_name = 'darteditor-installer.%s' % extension
495 installer_file = os.path.join(temp_dir, installer_name)
496 if SYSTEM == 'mac':
497 create_mac_installer(installer_file)
498 else:
499 create_windows_installer(installer_file, unzip_dir)
500 assert os.path.isfile(installer_file)
483 501
484 # Archive to new bucket 502 if CHANNEL == 'dev':
485 # NOTE: This is a little bit hackisch, we fetch the editor from 503 # Archive to old bucket
486 # the old bucket and archive the dmg to the new bucket here. 504 # TODO(kustermann/ricow): Remove all the old archiving code,
487 DartArchiveUploadInstaller(arch, dmg_installer, 'dmg', 505 # once everything points to the new location.
488 release_type=release_type) 506 if gsu.Copy(installer_file, gsu_editor_installer):
507 raise Exception("gsutil command failed, aborting.")
489 508
490 if SYSTEM == 'mac': 509 # Archive to new bucket
491 for arch in ['32', '64']: 510 # NOTE: This is a little bit hackisch, we fetch the editor from
492 create_mac_installer(arch) 511 # the old bucket and archive the dmg to the new bucket here.
512 DartArchiveUploadInstaller(arch, installer_file, extension,
513 release_type=release_type)
514
493 else: 515 else:
494 raise Exception( 516 raise Exception(
495 "We currently cannot build installers for %s" % SYSTEM) 517 "We currently cannot build installers for %s" % SYSTEM)
496 def build_editor(sdk_zip): 518 def build_editor(sdk_zip):
497 ant_property_file = tempfile.NamedTemporaryFile(suffix='.property', 519 ant_property_file = tempfile.NamedTemporaryFile(suffix='.property',
498 prefix='AntProperties', 520 prefix='AntProperties',
499 delete=False) 521 delete=False)
500 ant_property_file.close() 522 ant_property_file.close()
501 ant = AntWrapper(ant_property_file.name, os.path.join(antpath, 'bin'), 523 ant = AntWrapper(ant_property_file.name, os.path.join(antpath, 'bin'),
502 bzip2libpath) 524 bzip2libpath)
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 """delete the given file - do not re-throw any exceptions that occur""" 1378 """delete the given file - do not re-throw any exceptions that occur"""
1357 if os.path.exists(f): 1379 if os.path.exists(f):
1358 try: 1380 try:
1359 os.remove(f) 1381 os.remove(f)
1360 except OSError: 1382 except OSError:
1361 print 'error deleting %s' % f 1383 print 'error deleting %s' % f
1362 1384
1363 1385
1364 if __name__ == '__main__': 1386 if __name__ == '__main__':
1365 sys.exit(main()) 1387 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/bots/bot_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698