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

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

Issue 60293003: Version 0.8.10.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
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 | dart/runtime/bin/socket.h » ('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
11 import os 11 import os
12 import re 12 import re
13 import shutil 13 import shutil
14 import stat
14 import subprocess 15 import subprocess
15 import sys 16 import sys
16 import tempfile 17 import tempfile
17 import zipfile 18 import zipfile
18 import ziputils 19 import ziputils
19 20
20 from os.path import join 21 from os.path import join
21 22
22 BUILD_OS = None 23 BUILD_OS = None
23 DART_PATH = None 24 DART_PATH = None
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 959
959 for zipFile in _FindRcpZipFiles(out_dir): 960 for zipFile in _FindRcpZipFiles(out_dir):
960 basename = os.path.basename(zipFile) 961 basename = os.path.basename(zipFile)
961 if renameMap[basename] != None: 962 if renameMap[basename] != None:
962 os.rename(zipFile, join(os.path.dirname(zipFile), renameMap[basename])) 963 os.rename(zipFile, join(os.path.dirname(zipFile), renameMap[basename]))
963 964
964 965
965 def PostProcessEditorBuilds(out_dir, buildos): 966 def PostProcessEditorBuilds(out_dir, buildos):
966 """Post-process the created RCP builds""" 967 """Post-process the created RCP builds"""
967 with utils.TempDir('editor_scratch') as scratch_dir: 968 with utils.TempDir('editor_scratch') as scratch_dir:
969
970 def instantiate_download_script_template(destination, replacements):
971 """Helper function for replacing variables in the
972 tools/dartium/download_shellscript_templates.{sh,bat} scripts. It will
973 write the final download script to [destination] after doing all
974 replacements given in the [replacements] dictionary."""
975 template_location = {
976 'win' : join(
977 DART_DIR, 'tools', 'dartium', 'download_shellscript_template.bat'),
978 'linux' : join(
979 DART_DIR, 'tools', 'dartium', 'download_shellscript_template.sh'),
980 'mac' : join(
981 DART_DIR, 'tools', 'dartium', 'download_shellscript_template.sh'),
982 }[SYSTEM]
983
984 with open(template_location) as fd:
985 content = fd.read()
986 for key in replacements:
987 content = content.replace(key, replacements[key])
988 with open(destination, 'w') as fd:
989 fd.write(content)
990
991 # Make it executable if we are not on windows
992 if SYSTEM != 'win':
993 os.chmod(destination, os.stat(destination).st_mode | stat.S_IEXEC)
994
995 def add_download_scripts(zipFile, arch):
996 shell_ending = {
997 'win' : '.bat',
998 'linux' : '.sh',
999 'mac' : '.sh',
1000 }[SYSTEM]
1001
1002 # We don't have 64-bit versions of dartium/content_shell for
1003 # macos/windows.
1004 if SYSTEM in ['mac', 'win']:
1005 arch = '32'
1006
1007 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RELEASE)
1008
1009 # We're adding download scripts to the chromium directory.
1010 # The directory tree will look like this after that:
1011 # dart/dart-sdk/bin/dart{,.exe}
1012 # /chromium/download_contentshell.{sh,bat}
1013 # /chromium/download_dartium_debug.{sh,bat}
1014 # /chromium/download_file.dart
1015
1016 # Add download_file.dart helper utility to the zip file.
1017 f = ziputils.ZipUtil(zipFile, buildos)
1018 f.AddFile(join(DART_DIR, 'tools', 'dartium', 'download_file.dart'),
1019 'dart/chromium/download_file.dart')
1020
1021 # Add content shell download script
1022 contentshell_name = namer.dartium_variant_zipfilename(
1023 'content_shell', SYSTEM, arch, 'release')
1024 contentshell_download_script = join(scratch_dir, 'download_contentshell')
1025 instantiate_download_script_template(contentshell_download_script, {
1026 'VAR_DESTINATION' : contentshell_name,
1027 'VAR_DOWNLOAD_URL' :
1028 ("http://dartlang.org/editor/update/channels/%s/%s/dartium/%s"
1029 % (CHANNEL, REVISION, contentshell_name)),
1030 })
1031 f.AddFile(contentshell_download_script,
1032 'dart/chromium/download_contentshell%s' % shell_ending)
1033
1034 # Add dartium debug download script
1035 dartium_debug_name = namer.dartium_variant_zipfilename(
1036 'dartium', SYSTEM, arch, 'debug')
1037 dartium_download_script = join(scratch_dir, 'download_dartium_debug')
1038 instantiate_download_script_template(dartium_download_script, {
1039 'VAR_DESTINATION' : dartium_debug_name,
1040 'VAR_DOWNLOAD_URL' :
1041 ("http://dartlang.org/editor/update/channels/%s/%s/dartium/%s"
1042 % (CHANNEL, REVISION, dartium_debug_name)),
1043 })
1044 f.AddFile(dartium_download_script,
1045 'dart/chromium/download_dartium_debug%s' % shell_ending)
1046
968 # Create a editor.properties 1047 # Create a editor.properties
969 editor_properties = os.path.join(scratch_dir, 'editor.properties') 1048 editor_properties = os.path.join(scratch_dir, 'editor.properties')
970 with open(editor_properties, 'w') as fd: 1049 with open(editor_properties, 'w') as fd:
971 fd.write("com.dart.tools.update.core.url=http://dartlang.org" 1050 fd.write("com.dart.tools.update.core.url=http://dartlang.org"
972 "/editor/update/channels/%s/\n" % CHANNEL) 1051 "/editor/update/channels/%s/\n" % CHANNEL)
973 1052
974 for zipFile in _FindRcpZipFiles(out_dir): 1053 for zipFile in _FindRcpZipFiles(out_dir):
975 basename = os.path.basename(zipFile) 1054 basename = os.path.basename(zipFile)
1055 is_64bit = basename.endswith('-64.zip')
976 1056
977 print(' processing %s' % basename) 1057 print(' processing %s' % basename)
978 1058
979 readme_file = join('dart', 'README') 1059 readme_file = join('dart', 'README')
980 if (basename.startswith('darteditor-win32-')): 1060 if (basename.startswith('darteditor-win32-')):
981 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe') 1061 seven_zip = os.path.join(DART_DIR, 'third_party', '7zip', '7za.exe')
982 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ) 1062 bot_utils.run([seven_zip, 'd', zipFile, readme_file], env=os.environ)
983 else: 1063 else:
984 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ) 1064 bot_utils.run(['zip', '-d', zipFile, readme_file], env=os.environ)
985 1065
986 # If we're on -dev/-stable build: add an editor.properties file 1066 # If we're on -dev/-stable build: add an editor.properties file
987 # pointing to the correct update location of the editor for the channel 1067 # pointing to the correct update location of the editor for the channel
988 # we're building for. 1068 # we're building for.
989 if not TRUNK_BUILD and CHANNEL != 'be': 1069 if not TRUNK_BUILD and CHANNEL != 'be':
990 f = ziputils.ZipUtil(zipFile, buildos) 1070 f = ziputils.ZipUtil(zipFile, buildos)
991 f.AddFile(editor_properties, 'dart/editor.properties') 1071 f.AddFile(editor_properties, 'dart/editor.properties')
992 1072
1073 # Add a shell/bat script to download contentshell and dartium debug.
1074 # (including the necessary tools/dartium/download_file.dart helper).
1075 add_download_scripts(zipFile, '64' if is_64bit else '32')
1076
993 # adjust memory params for 64 bit versions 1077 # adjust memory params for 64 bit versions
994 if (basename.endswith('-64.zip')): 1078 if is_64bit:
995 if (basename.startswith('darteditor-macos-')): 1079 if (basename.startswith('darteditor-macos-')):
996 inifile = join('dart', 'DartEditor.app', 'Contents', 'MacOS', 1080 inifile = join('dart', 'DartEditor.app', 'Contents', 'MacOS',
997 'DartEditor.ini') 1081 'DartEditor.ini')
998 else: 1082 else:
999 inifile = join('dart', 'DartEditor.ini') 1083 inifile = join('dart', 'DartEditor.ini')
1000 1084
1001 if (basename.startswith('darteditor-win32-')): 1085 if (basename.startswith('darteditor-win32-')):
1002 f = zipfile.ZipFile(zipFile) 1086 f = zipfile.ZipFile(zipFile)
1003 f.extract(inifile.replace('\\','/')) 1087 f.extract(inifile.replace('\\','/'))
1004 f.close() 1088 f.close()
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 """delete the given file - do not re-throw any exceptions that occur""" 1467 """delete the given file - do not re-throw any exceptions that occur"""
1384 if os.path.exists(f): 1468 if os.path.exists(f):
1385 try: 1469 try:
1386 os.remove(f) 1470 os.remove(f)
1387 except OSError: 1471 except OSError:
1388 print 'error deleting %s' % f 1472 print 'error deleting %s' % f
1389 1473
1390 1474
1391 if __name__ == '__main__': 1475 if __name__ == '__main__':
1392 sys.exit(main()) 1476 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | dart/runtime/bin/socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698